Add token and context window tracking
This commit is contained in:
@@ -12,6 +12,7 @@ install_deps() {
|
||||
command -v socat &>/dev/null || needed="$needed socat"
|
||||
command -v jq &>/dev/null || needed="$needed jq"
|
||||
command -v sqlite3 &>/dev/null || needed="$needed sqlite3"
|
||||
command -v bc &>/dev/null || needed="$needed bc"
|
||||
|
||||
if [ -n "$needed" ]; then
|
||||
echo "Installing dependencies:$needed"
|
||||
@@ -63,6 +64,10 @@ CREATE TABLE IF NOT EXISTS conversations (
|
||||
instance_id TEXT,
|
||||
started_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
status TEXT DEFAULT 'active',
|
||||
tokens_in INTEGER DEFAULT 0,
|
||||
tokens_out INTEGER DEFAULT 0,
|
||||
total_tokens INTEGER DEFAULT 0,
|
||||
max_context INTEGER DEFAULT 200000,
|
||||
FOREIGN KEY (instance_id) REFERENCES instances(id)
|
||||
);
|
||||
|
||||
@@ -72,6 +77,7 @@ CREATE TABLE IF NOT EXISTS messages (
|
||||
role TEXT,
|
||||
content TEXT,
|
||||
tool_calls TEXT,
|
||||
tokens INTEGER DEFAULT 0,
|
||||
timestamp TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (conversation_id) REFERENCES conversations(id)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user