fix: 尝试修复错误直接对话没了的问题(不知道好使不)

This commit is contained in:
ikechan8370 2023-03-29 22:49:28 +08:00
parent 3121b0e463
commit 0755b54486

View file

@ -674,33 +674,37 @@ export default class SydneyAIClient {
}
ws.send(`${messageJson}`)
const {
message: reply,
conversationExpiryTime
} = await messagePromise
try {
const {
message: reply,
conversationExpiryTime
} = await messagePromise
const replyMessage = {
id: crypto.randomUUID(),
parentMessageId: userMessage.id,
role: 'Bing',
message: reply.text,
details: reply
}
if (!Config.sydneyApologyIgnored || !apology) {
conversation.messages.push(userMessage)
conversation.messages.push(replyMessage)
}
const replyMessage = {
id: crypto.randomUUID(),
parentMessageId: userMessage.id,
role: 'Bing',
message: reply.text,
details: reply
}
if (!Config.sydneyApologyIgnored || !apology) {
conversation.messages.push(userMessage)
conversation.messages.push(replyMessage)
}
await this.conversationsCache.set(conversationKey, conversation)
return {
conversationSignature,
conversationId,
clientId,
invocationId: invocationId + 1,
messageId: replyMessage.id,
conversationExpiryTime,
response: reply.text,
details: reply,
apology: Config.sydneyApologyIgnored && apology
return {
conversationSignature,
conversationId,
clientId,
invocationId: invocationId + 1,
messageId: replyMessage.id,
conversationExpiryTime,
response: reply.text,
details: reply,
apology: Config.sydneyApologyIgnored && apology
}
} catch (err) {
await this.conversationsCache.set(conversationKey, conversation)
throw err
}
}