fix: toLowerCase 报错

This commit is contained in:
ikechan8370 2023-03-18 00:53:48 +08:00
parent 8f296fa39e
commit c5976439cb
2 changed files with 7 additions and 5 deletions

View file

@ -603,10 +603,12 @@ export class chatgpt extends plugin {
}
let response = chatMessage?.text
// 检索是否有屏蔽词
const blockWord = Config.blockWords.find(word => response.toLowerCase().includes(word.toLowerCase()))
if (blockWord) {
await this.reply('返回内容存在敏感词,我不想回答你', true)
return false
if (response) {
const blockWord = Config.blockWords.find(word => response.toLowerCase().includes(word.toLowerCase()))
if (blockWord) {
await this.reply('返回内容存在敏感词,我不想回答你', true)
return false
}
}
let quotemessage = []

View file

@ -583,7 +583,7 @@ export default class SydneyAIClient {
// adaptiveCardsSoFar || (message.adaptiveCards[0].body[0].text = replySoFar)
console.log({ replySoFar, message })
message.adaptiveCards = adaptiveCardsSoFar
message.text = replySoFar
message.text = replySoFar || message.spokenText
resolve({
message,
conversationExpiryTime: event?.item?.conversationExpiryTime