处理语音
This commit is contained in:
@@ -964,6 +964,8 @@
|
||||
KBPersonaChatCell *currentCell = [self currentPersonaCell];
|
||||
if (currentCell && appendToUI) {
|
||||
[currentCell appendUserMessage:text];
|
||||
// 添加 loading AI 消息
|
||||
[currentCell appendLoadingAssistantMessage];
|
||||
}
|
||||
|
||||
self.isWaitingForAIResponse = YES;
|
||||
@@ -990,12 +992,20 @@
|
||||
}
|
||||
|
||||
if (response.code == 50030) {
|
||||
// 移除 loading 消息
|
||||
if (cell) {
|
||||
[cell removeLoadingAssistantMessage];
|
||||
}
|
||||
NSString *message = response.message ?: @"";
|
||||
[strongSelf showChatLimitPopWithMessage:message];
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response || !response.data) {
|
||||
// 移除 loading 消息
|
||||
if (cell) {
|
||||
[cell removeLoadingAssistantMessage];
|
||||
}
|
||||
NSString *message = response.message ?: @"聊天响应为空";
|
||||
NSLog(@"[KBAIHomeVC] 聊天响应为空:%@", message);
|
||||
if (message.length > 0) {
|
||||
@@ -1007,11 +1017,16 @@
|
||||
NSString *aiResponse = response.data.aiResponse ?: response.data.content ?: response.data.text ?: response.data.message ?: @"";
|
||||
NSString *audioId = response.data.audioId;
|
||||
if (aiResponse.length == 0) {
|
||||
// 移除 loading 消息
|
||||
if (cell) {
|
||||
[cell removeLoadingAssistantMessage];
|
||||
}
|
||||
NSLog(@"[KBAIHomeVC] AI 回复为空");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cell) {
|
||||
// appendAssistantMessage 内部会自动移除 loading 消息
|
||||
[cell appendAssistantMessage:aiResponse audioId:audioId];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user