This commit is contained in:
2026-01-26 18:51:37 +08:00
parent a22599feda
commit 3a5a6395af
4 changed files with 43 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ typedef void (^AiVMAudioURLCompletion)(NSString *_Nullable audioURL,
completion:(AiVMSyncCompletion)completion;
- (void)requestChatMessageWithContent:(NSString *)content
companionId:(NSInteger)companionId
completion:(AiVMMessageCompletion)completion;
/// 根据 audioId 获取音频 URL

View File

@@ -95,6 +95,7 @@ autoShowBusinessError:NO
}
- (void)requestChatMessageWithContent:(NSString *)content
companionId:(NSInteger)companionId
completion:(AiVMMessageCompletion)completion {
if (content.length == 0) {
NSError *error = [NSError
@@ -111,9 +112,12 @@ autoShowBusinessError:NO
[content stringByAddingPercentEncodingWithAllowedCharacters:
[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *path = [NSString
stringWithFormat:@"%@?content=%@", API_AI_CHAT_MESSAGE,
encodedContent ?: @""];
NSDictionary *params = @{ @"content" : content ?: @"" };
stringWithFormat:@"%@?content=%@&companionId=%ld", API_AI_CHAT_MESSAGE,
encodedContent ?: @"", (long)companionId];
NSDictionary *params = @{
@"content" : content ?: @"",
@"companionId" : @(companionId)
};
[[KBNetworkManager shared]
POST:path
jsonBody:params