feat: persist sgclaw browser conversations
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user