修复模型占用的问题

This commit is contained in:
2026-09-21 11:08:43 +08:00
parent 1fd4fa81a0
commit ae28587c02
5 changed files with 63 additions and 34 deletions
+3
View File
@@ -120,6 +120,9 @@ function initDb(dbPath) {
// 迁移:旧库补 held_at 列(held 保持租约起始时间)
const cols = db.prepare('PRAGMA table_info(sessions)').all();
if (!cols.some(c => c.name === 'held_at')) db.exec('ALTER TABLE sessions ADD COLUMN held_at INTEGER');
// 迁移:model_slot 记会话占用的具体池槽位(「模型id#key下标」,同模型多 key 并行占用),
// model_id 仍存模型 id 供展示/统计(见 engine.bindModel)。
if (!cols.some(c => c.name === 'model_slot')) db.exec('ALTER TABLE sessions ADD COLUMN model_slot TEXT');
// 迁移:last_model_id 记住会话最近用过的模型,释放后新消息优先回绑(见 engine.dispatchQueued)
if (!cols.some(c => c.name === 'last_model_id')) {
db.exec('ALTER TABLE sessions ADD COLUMN last_model_id TEXT');