persist perplexity per assistant message; display on loaded convos
This commit is contained in:
@@ -123,6 +123,7 @@ def init_db():
|
||||
CREATE TABLE IF NOT EXISTS messages (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT, conversation_id TEXT NOT NULL,
|
||||
role TEXT NOT NULL, content TEXT NOT NULL, created_at TEXT NOT NULL,
|
||||
perplexity REAL,
|
||||
FOREIGN KEY (conversation_id) REFERENCES conversations(id) ON DELETE CASCADE
|
||||
)
|
||||
""")
|
||||
@@ -164,6 +165,11 @@ def init_db():
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
conn.execute("ALTER TABLE messages ADD COLUMN perplexity REAL")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if not conn.execute("SELECT id FROM profile WHERE id = 1").fetchone():
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
conn.execute("INSERT INTO profile (id, content, updated_at) VALUES (1, ?, ?)", (DEFAULT_PROFILE, now))
|
||||
|
||||
Reference in New Issue
Block a user