From: liangzhenying <867174124@qq.com> Date: Thu, 13 Mar 2025 03:29:19 +0000 (+0800) Subject: 修复结束对话逻辑 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=1f0d977d54921fc2a149cd766eee6dc11d443306;p=mirrors%2FIOTBluetooth-iOS.git 修复结束对话逻辑 --- diff --git "a/Doc/\346\234\200\346\226\260/.~\346\211\213\350\241\250AI\345\215\217\350\256\256.docx" "b/Doc/\346\234\200\346\226\260/.~\346\211\213\350\241\250AI\345\215\217\350\256\256.docx" new file mode 100644 index 0000000..ab7a7ee Binary files /dev/null and "b/Doc/\346\234\200\346\226\260/.~\346\211\213\350\241\250AI\345\215\217\350\256\256.docx" differ diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate b/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate index 5ea63ee..0e38908 100644 Binary files a/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate and b/IOTBluetooth/IOTBluetooth/IOTBluetooth.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAiManager.swift b/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAiManager.swift index eb4a912..1a3fafd 100644 --- a/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAiManager.swift +++ b/IOTBluetooth/IOTBluetooth/IOTBluetooth/IBAiManager.swift @@ -82,13 +82,6 @@ public class IBAiManager{ else{ sendAiState(isValid: true, gptKey: nil) } - if platform == .chatGPT { - MixSdk.shared.chatGpt.changeModel(model:gptModel) - MixSdk.shared.setPlatform(platform,key: nil) - } - else{ - MixSdk.shared.setPlatform(platform,key: nil) - } } } @@ -127,13 +120,13 @@ public class IBAiManager{ Logger.log("使用模型:",platform.title) useMode?(platform) -// if platform == .chatGPT { -// MixSdk.shared.chatGpt.changeModel(model:gptModel) -// MixSdk.shared.setPlatform(platform,key: nil) -// } -// else{ -// MixSdk.shared.setPlatform(platform,key: nil) -// } + if platform == .chatGPT { + MixSdk.shared.chatGpt.changeModel(model:gptModel) + MixSdk.shared.setPlatform(platform,key: nil) + } + else{ + MixSdk.shared.setPlatform(platform,key: nil) + } responseId = "\(Date().timeIntervalSince1970)" MixSdk.shared.voiceChat.start() } diff --git a/IOTBluetooth/IOTBluetooth/IOTBluetooth/MixSdk/MixSdk/MixSdk/MSVoiceChat.swift b/IOTBluetooth/IOTBluetooth/IOTBluetooth/MixSdk/MixSdk/MixSdk/MSVoiceChat.swift index 6803b7b..4c80a8d 100644 --- a/IOTBluetooth/IOTBluetooth/IOTBluetooth/MixSdk/MixSdk/MixSdk/MSVoiceChat.swift +++ b/IOTBluetooth/IOTBluetooth/IOTBluetooth/MixSdk/MixSdk/MixSdk/MSVoiceChat.swift @@ -273,19 +273,28 @@ extension MSVoiceChat:WebSocketDelegate{ } - if model.event == "RespondingEnded"{ - let tmpModel = MSChatModel() - tmpModel.type = "end" - tmpModel.content = nil - lastChatModel = tmpModel - callBack?(tmpModel) - } +// if model.event == "RespondingEnded"{ +// let tmpModel = MSChatModel() +// tmpModel.type = "end" +// tmpModel.content = nil +// lastChatModel = tmpModel +// callBack?(tmpModel) +// } if model.event == "RespondingContent",let payload = model.payload,let text = payload.text{ - let tmpModel = MSChatModel() - tmpModel.type = "middle" - tmpModel.content = text - lastChatModel = tmpModel - callBack?(tmpModel) + if let finish = payload.finished,finish == false { + let tmpModel = MSChatModel() + tmpModel.type = "middle" + tmpModel.content = text + lastChatModel = tmpModel + callBack?(tmpModel) + } + else{ + let tmpModel = MSChatModel() + tmpModel.type = "end" + tmpModel.content = nil + lastChatModel = tmpModel + callBack?(tmpModel) + } } }