Querying Chat History from Both DM Systems¶
RPG-API (Pydantic AI Agent)¶
Chat history is stored in Supabase Sandbox PostgreSQL.
# Get recent messages for a campaign
kubectl exec -n supabase-sandbox postgres-0 -- psql -U postgres -d postgres -c "
SELECT m.role, m.content, m.created_at
FROM rpg.sessions s
JOIN rpg.chat_messages m ON m.session_id = s.id
WHERE s.campaign_id = '<CAMPAIGN_UUID>'
AND m.role IN ('user', 'assistant')
ORDER BY m.created_at DESC
LIMIT 10;"
# To get campaign UUID:
kubectl exec -n supabase-sandbox postgres-0 -- psql -U postgres -d postgres -c "
SELECT id, name FROM rpg.campaigns;"
Campaign UUIDs:
- Seagate: 967042e1-7989-4fbe-8650-dea279b8fadf
- Ironvale: 2c59efa4-efb3-471d-b94e-37ea54418b48
- Testvale: 85eed24d-fecc-4139-86bf-6e6db353d2b7
AnythingLLM (Legacy)¶
Chat history is stored in SQLite inside the AnythingLLM pod.
# Copy database locally
kubectl cp anythingllm/<POD_NAME>:/app/server/storage/anythingllm.db /tmp/anythingllm.db -c anythingllm
# Get pod name
kubectl get pods -n anythingllm
# Query workspaces
sqlite3 /tmp/anythingllm.db "SELECT id, name, slug FROM workspaces;"
# Query chats for a workspace (e.g., Seagate DM = id 17)
sqlite3 /tmp/anythingllm.db "SELECT prompt, response, createdAt FROM workspace_chats WHERE workspaceId = 17 ORDER BY createdAt DESC LIMIT 10;"
Workspace IDs: - Seagate DM: 17 - Ironvale DM: 18 - Shadows of Ashwick DM: 13 - Mojave Courier DM: 14
Response Format Differences¶
AnythingLLM stores response as JSON with structure:
{
"text": "DM narrative...",
"sources": [...],
"metrics": {"completion_tokens": 594, ...},
"thoughts": ["@agent is executing..."] // For tool calls
}
RPG-API stores response as plain text in content column.