chat: interactive mode (natural language -> tool calls), shared LLM driver refactor, run_chat.sh; verified with gemma4:e2b and gemma4:12b
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Interactive chat mode: bridge + live viewer + chat REPL in one command.
|
||||
# Open http://127.0.0.1:8000 to watch the capsule while you talk to it.
|
||||
# Usage: scripts/run_chat.sh [--model gemma4:e2b]
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
BRIDGE_PID=""
|
||||
LIVE_PID=""
|
||||
|
||||
# 1. bridge (reuse an already-running one)
|
||||
if python3 -c 'import socket,sys; s=socket.socket(); sys.exit(0 if s.connect_ex(("127.0.0.1",8765))==0 else 1)'; then
|
||||
echo "[chat] bridge already running on 8765"
|
||||
else
|
||||
testbed/.venv/bin/python -m testbed.bridge --port 8765 >/tmp/aicc-bridge.log 2>&1 &
|
||||
BRIDGE_PID=$!
|
||||
sleep 1.5
|
||||
echo "[chat] bridge started (pid $BRIDGE_PID)"
|
||||
fi
|
||||
|
||||
# 2. live viewer (optional but nice: watch while chatting)
|
||||
testbed/.venv/bin/python -m testbed.live --http-port 8000 --ws-port 8001 >/tmp/aicc-live.log 2>&1 &
|
||||
LIVE_PID=$!
|
||||
sleep 1.5
|
||||
echo "[chat] live view: open http://127.0.0.1:8000 in your browser"
|
||||
|
||||
# 3. chat REPL (foreground)
|
||||
testbed/.venv/bin/python -m testbed.chat "$@"
|
||||
EXIT=$?
|
||||
|
||||
kill "$LIVE_PID" 2>/dev/null || true
|
||||
if [ -n "$BRIDGE_PID" ]; then kill "$BRIDGE_PID" 2>/dev/null || true; fi
|
||||
exit $EXIT
|
||||
Reference in New Issue
Block a user