feat: add session_messages table for conversation history
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
Add a session_messages table that stores the full user/assistant conversation history within a session. Each session request now persists both the user message and assistant response atomically alongside the session_request and balance update. - New schema: session_messages (id, session_id, role, content, session_request_id, created_at) with index on session_id - New migration: 0008_session_messages.sql - New endpoint: GET /sessions/:id/messages (macaroon-authed) - Messages inserted transactionally during POST /sessions/:id/request Fixes #37 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
lib/db/migrations/0008_session_messages.sql
Normal file
13
lib/db/migrations/0008_session_messages.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- Migration: Session messages for conversation history
|
||||
-- Stores user/assistant message pairs produced during session requests.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS session_messages (
|
||||
id SERIAL PRIMARY KEY,
|
||||
session_id TEXT NOT NULL REFERENCES sessions(id),
|
||||
role TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
session_request_id TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX idx_session_messages_session_id ON session_messages(session_id);
|
||||
Reference in New Issue
Block a user