feat(chat): 解析/存储/发送思考(reasoning 或 reasoning_content) — DB 新增 reasoning 列,SSE 加 reasoning_delta,前端折叠面板

This commit is contained in:
2026-09-03 23:44:52 +08:00
parent 65ca28072f
commit 39c46072fa
6 changed files with 133 additions and 25 deletions
+3
View File
@@ -29,12 +29,15 @@ function initDb(dbPath) {
session_id TEXT NOT NULL,
role TEXT NOT NULL,
content TEXT,
reasoning TEXT,
tool_calls TEXT,
tool_call_id TEXT,
name TEXT,
created_at INTEGER NOT NULL,
FOREIGN KEY (session_id) REFERENCES sessions(id)
);
// 升级老库:早期表不带 reasoning 列,补上(重入安全)
try { db.exec('ALTER TABLE messages ADD COLUMN reasoning TEXT'); } catch (_) { /* 已存在 */ }
CREATE TABLE IF NOT EXISTS files (
id INTEGER PRIMARY KEY AUTOINCREMENT,