处理语音

This commit is contained in:
2026-01-29 20:56:24 +08:00
parent 23c0d14128
commit 36135313d8
8 changed files with 236 additions and 9 deletions

View File

@@ -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];
}
});