发问准备可以并行,三个开关先保持关闭(BUG-1337~1339)
开流前的注销检查可以和读会话、解析模型同时进行;审核改到扣点前等待,不再挡住第一行;模型版本可以短缓存;两个领域可以一起算。本机没有数据库中位数,也没有带星盘网络库的镜像,所以默认仍是关闭、缓存 0、领域逐个算。 自测:tsc 0 错;lint 0 error;相关测试失败 0、取消 0。test:db 未跑。 Co-Authored-By: Grok (agent loop)
This commit is contained in:
co-authored by
Grok (agent loop)
parent
66cd60081f
commit
a0e223e20c
@@ -45,9 +45,18 @@ test("catalog cache is short-lived and failure stays fail-closed without env fal
|
||||
test("session model resolution is async and pins published or retired database versions", () => {
|
||||
assert.match(catalog, /export async function resolveSessionLanguageModel/);
|
||||
assert.match(catalog, /c\.model_id=\$1 and v\.version=\$2 and v\.status in \('published','retired'\)/);
|
||||
assert.match(catalog, /return await readVersion\(modelId, configVersion\)/);
|
||||
// 原值: return await readVersion(modelId, configVersion)
|
||||
// 新值: const model = await readVersion(modelId, configVersion),只有非空结果写入短缓存
|
||||
// 原因: 绑版本的解析与目录共用 15 秒上限,失败和空结果不缓存
|
||||
assert.match(catalog, /const model = await readVersion\(modelId, configVersion\)/);
|
||||
assert.match(catalog, /if \(model && ttl > 0\) cache\.set\(key, \{ expiresAt: Date\.now\(\) \+ ttl, model \}\)/);
|
||||
assert.match(routes.consult, /await resolveSessionLanguageModel\(\s*chatSession\.model_id,\s*chatSession\.model_config_version/);
|
||||
assert.match(routes.consult, /if \(!sessionModel\)[\s\S]*status: 503/);
|
||||
// 原值: route.ts 里 if (!sessionModel) 之后是 status 503
|
||||
// 新值: turn-prep.ts 里 if (!sessionModel) 返回 modelUnavailable(),正文 status 503
|
||||
// 原因: 模型不可用仍是开流前的 503,文案随准备步骤一起搬走
|
||||
const head = readFileSync(new URL("../src/lib/consult/turn-prep.ts", import.meta.url), "utf8");
|
||||
assert.match(head, /if \(!sessionModel\) return \{ ok: false, response: modelUnavailable\(\) \}/);
|
||||
assert.match(head, /function modelUnavailable\(\)[\s\S]*status: 503/);
|
||||
assert.doesNotMatch(routes.consult, /languageModelConfigurationMessage/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user