44 lines
2.2 KiB
Bash
Executable File
44 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# chatbot-memory-test.sh — Tester la mémoire persistante (doctrine 146) d'un chatbot
|
|
# Usage: chatbot-memory-test.sh <chatbot_name> [provider] [model]
|
|
|
|
CHATBOT="${1:-openclaw-proxy}"
|
|
PROVIDER="${2:-mistral}"
|
|
MODEL="${3:-mistral-small-latest}"
|
|
|
|
case "$CHATBOT" in
|
|
l99-chat)
|
|
URL="https://weval-consulting.com/api/l99-chat.php?token=L99CHAT2026&q=WEVIA+autonomy+test+doctrine+146"
|
|
timeout 15 curl -sk -N "$URL" > /dev/null 2>&1
|
|
;;
|
|
openclaw-proxy)
|
|
curl -sk -m 20 -X POST "https://weval-consulting.com/api/openclaw-proxy.php" \
|
|
-H "Content-Type: application/json" \
|
|
--data-raw "{\"provider\":\"$PROVIDER\",\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"WEVIA autonomy test doctrine 146\"}],\"stream\":false,\"max_tokens\":40}" > /dev/null 2>&1
|
|
;;
|
|
wevia-chat-v2-direct|weval-chatbot-api|saas-chat|claude-pattern-api)
|
|
curl -sk -m 20 -X POST "https://weval-consulting.com/api/${CHATBOT}.php" \
|
|
-H "Content-Type: application/json" \
|
|
--data-raw "{\"message\":\"WEVIA autonomy test doctrine 146\"}" > /dev/null 2>&1
|
|
;;
|
|
*)
|
|
echo "{\"error\":\"unknown chatbot: $CHATBOT\",\"known\":[\"l99-chat\",\"openclaw-proxy\",\"wevia-chat-v2-direct\",\"weval-chatbot-api\",\"saas-chat\",\"claude-pattern-api\"]}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
sleep 3
|
|
|
|
# Check Redis
|
|
COUNT=$(redis-cli -n 5 --scan --pattern "chatmem:${CHATBOT}:*" 2>&1 | wc -l)
|
|
LATEST=$(redis-cli -n 5 --scan --pattern "chatmem:${CHATBOT}:*" 2>&1 | sort | tail -1)
|
|
|
|
if [ -n "$LATEST" ] && [ "$COUNT" -gt 0 ]; then
|
|
# Get content len
|
|
LEN=$(redis-cli -n 5 GET "$LATEST" 2>/dev/null | python3 -c "import sys,json;d=json.loads(sys.stdin.read());print(d.get('len',0))" 2>/dev/null)
|
|
TS=$(redis-cli -n 5 GET "$LATEST" 2>/dev/null | python3 -c "import sys,json;d=json.loads(sys.stdin.read());print(d.get('ts',''))" 2>/dev/null)
|
|
echo "{\"chatbot\":\"$CHATBOT\",\"doctrine\":\"146\",\"status\":\"PASS\",\"total_keys\":$COUNT,\"latest_key\":\"$LATEST\",\"latest_response_len\":$LEN,\"latest_ts\":\"$TS\",\"provider_used\":\"$PROVIDER\",\"model_used\":\"$MODEL\"}"
|
|
else
|
|
echo "{\"chatbot\":\"$CHATBOT\",\"doctrine\":\"146\",\"status\":\"FAIL\",\"total_keys\":$COUNT,\"reason\":\"no redis key created — shutdown_function may not have fired or provider failed\"}"
|
|
fi
|