Files
vibn-frontend/lib/db/knowledge-chunks-schema.sql

22 lines
789 B
SQL

-- Add the telemetry table script alongside your existing db scripts
CREATE TABLE IF NOT EXISTS agent_telemetry (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
project_id VARCHAR(255),
model_used VARCHAR(255) NOT NULL,
system_prompt TEXT NOT NULL,
chat_history JSONB NOT NULL,
response_text TEXT,
response_thoughts TEXT,
tool_calls JSONB,
prompt_tokens INTEGER,
completion_tokens INTEGER,
total_tokens INTEGER,
duration_ms INTEGER NOT NULL
);
-- Index for fast querying by project
CREATE INDEX IF NOT EXISTS idx_agent_telemetry_project ON agent_telemetry(project_id);
-- Index for chronological sorting
CREATE INDEX IF NOT EXISTS idx_agent_telemetry_created_at ON agent_telemetry(created_at DESC);