HEL-780: connect persistent companion and real streaming text chat

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
白栖知
2026-10-22 16:25:35 +08:00
co-authored by multica-agent
parent 4984293998
commit f6614d4bf9
39 changed files with 1591 additions and 64 deletions
+16
View File
@@ -184,3 +184,19 @@ CREATE VIRTUAL TABLE IF NOT EXISTS mem_fts USING fts5(
-- epi_id INTEGER PRIMARY KEY,
-- embedding FLOAT[1024]
-- );
-- R1 additive migration: no existing memory/state table is replaced.
CREATE TABLE IF NOT EXISTS api_meta (key TEXT PRIMARY KEY, value INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS companion (
id INTEGER PRIMARY KEY CHECK(id=1), identity_json TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS chat_message (
id INTEGER PRIMARY KEY AUTOINCREMENT,
ts INTEGER NOT NULL,
role TEXT NOT NULL CHECK(role IN ('user','companion')),
text TEXT NOT NULL,
turn_id TEXT NOT NULL,
status TEXT NOT NULL CHECK(status IN ('pending','sent','failed','cancelled')),
UNIQUE(turn_id, role)
);
CREATE INDEX IF NOT EXISTS idx_chat_order ON chat_message(id);