模型保持占用(held)机制:回合结束不再立即释放模型,进入 held 租约(config.model_hold 可配:idle_release_ms 默认3分钟——页面无人观看即释放;active_max_ms 默认30分钟——有人观看的保持上限;sweep_ms 巡检间隔);held 期间追问直接复用已绑模型免排队(delivered=live);sessions 表迁移新增 held_at 列;sse 增加 clientCount 判定观看者;前端新增保持中状态标签/徽章色,终止入口扩展至 held(主动放弃占用);smoke/README/示例配置同步更新
This commit is contained in:
+5
-1
@@ -19,7 +19,8 @@ function initDb(dbPath) {
|
||||
created_at INTEGER NOT NULL,
|
||||
updated_at INTEGER NOT NULL,
|
||||
completed_at INTEGER,
|
||||
cancelled_at INTEGER
|
||||
cancelled_at INTEGER,
|
||||
held_at INTEGER
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS messages (
|
||||
@@ -60,6 +61,9 @@ function initDb(dbPath) {
|
||||
CREATE INDEX IF NOT EXISTS idx_messages_session ON messages(session_id, id);
|
||||
CREATE INDEX IF NOT EXISTS idx_files_session ON files(session_id);
|
||||
`);
|
||||
// 迁移:旧库补 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');
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user