feat: persist sgclaw browser conversations

This commit is contained in:
zyl
2026-03-27 01:57:42 +08:00
parent bae0e452a5
commit d315c13f66
11 changed files with 402 additions and 20 deletions

View File

@@ -67,6 +67,29 @@ function assertCompatRuntimeTraffic(requests) {
if (!instructions.includes('打开知乎搜索天气')) {
throw new Error('fake DeepSeek server did not receive the Zhihu smoke instruction')
}
const zhihuRequest = requests.find((entry) => {
return (entry.body?.messages ?? []).some((message) =>
message?.role === 'user' &&
normalizeSmokeInstruction(message.content) === '打开知乎搜索天气')
})
if (!zhihuRequest) {
throw new Error('fake DeepSeek server did not receive the Zhihu follow-up turn')
}
const zhihuMessages = zhihuRequest.body?.messages ?? []
const hasPriorUserTurn = zhihuMessages.some((message) =>
message?.role === 'user' &&
normalizeSmokeInstruction(message.content) === '打开百度搜索天气')
const hasPriorAssistantTurn = zhihuMessages.some((message) =>
message?.role === 'assistant' &&
typeof message.content === 'string' &&
message.content.includes('已在百度搜索天气'))
if (!hasPriorUserTurn || !hasPriorAssistantTurn) {
throw new Error('DeepSeek follow-up turn is missing prior browser conversation history')
}
}
main().catch((error) => {