key缺少,添加权限多语言
This commit is contained in:
@@ -106,7 +106,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
}
|
||||
}
|
||||
if (trim.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"请输入内容")];
|
||||
[KBHUD showInfo:KBLocalized(@"Please enter content")];
|
||||
return;
|
||||
}
|
||||
[self kb_sendChatText:trim];
|
||||
@@ -128,7 +128,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
[self kb_prefetchAvatarForMessage:outgoing];
|
||||
|
||||
if (![[KBFullAccessManager shared] ensureFullAccessOrGuideInView:self.view]) {
|
||||
[KBHUD showInfo:KBLocalized(@"请开启完全访问后使用")];
|
||||
[KBHUD showInfo:KBLocalized(@"Please enable Full Access to continue")];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -259,12 +259,12 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
if (mockPath.length > 0) {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.35 * NSEC_PER_SEC)),
|
||||
dispatch_get_main_queue(), ^{
|
||||
NSString *displayText = KBLocalized(@"语音回复");
|
||||
NSString *displayText = KBLocalized(@"Voice reply");
|
||||
KBChatMessage *incoming =
|
||||
[KBChatMessage messageWithText:displayText
|
||||
outgoing:NO
|
||||
audioFilePath:mockPath];
|
||||
incoming.displayName = KBLocalized(@"AI助手");
|
||||
incoming.displayName = KBLocalized(@"AI Assistant");
|
||||
[self kb_appendChatMessage:incoming];
|
||||
[self kb_playChatAudioAtPath:mockPath];
|
||||
});
|
||||
@@ -284,7 +284,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
}
|
||||
if (error) {
|
||||
NSString *tip = error.localizedDescription
|
||||
?: KBLocalized(@"请求失败");
|
||||
?: KBLocalized(@"Request failed");
|
||||
[KBHUD showInfo:tip];
|
||||
return;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
initWithBase64EncodedString:audioBase64
|
||||
options:0];
|
||||
if (data.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"音频数据解析失败")];
|
||||
[KBHUD showInfo:KBLocalized(@"Failed to parse audio data")];
|
||||
return;
|
||||
}
|
||||
[self kb_handleChatAudioData:data
|
||||
@@ -312,7 +312,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
displayText:displayText];
|
||||
return;
|
||||
}
|
||||
[KBHUD showInfo:KBLocalized(@"未获取到音频文件")];
|
||||
[KBHUD showInfo:KBLocalized(@"No audio file received")];
|
||||
});
|
||||
}];
|
||||
}
|
||||
@@ -352,7 +352,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
[self.chatPanelView
|
||||
kb_removeLoadingAssistantMessage];
|
||||
[KBHUD showInfo:response.message
|
||||
?: KBLocalized(@"请求失败")];
|
||||
?: KBLocalized(@"Request failed")];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
if (response.data.aiResponse.length == 0) {
|
||||
[self.chatPanelView
|
||||
kb_removeLoadingAssistantMessage];
|
||||
[KBHUD showInfo:KBLocalized(@"未获取到回复内容")];
|
||||
[KBHUD showInfo:KBLocalized(@"No reply content received")];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -450,13 +450,13 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
|
||||
if (!response.success) {
|
||||
[KBHUD showInfo:response.errorMessage
|
||||
?: KBLocalized(@"下载失败")];
|
||||
?: KBLocalized(@"Download failed")];
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response.audioData ||
|
||||
response.audioData.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"未获取到音频数据")];
|
||||
[KBHUD showInfo:KBLocalized(@"No audio data received")];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
fileExtension:(NSString *)extension
|
||||
displayText:(NSString *)displayText {
|
||||
if (data.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"音频数据为空")];
|
||||
[KBHUD showInfo:KBLocalized(@"Audio data is empty")];
|
||||
return;
|
||||
}
|
||||
NSString *ext = extension.length > 0 ? extension : @"m4a";
|
||||
@@ -487,14 +487,14 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
NSString *filePath =
|
||||
[NSTemporaryDirectory() stringByAppendingPathComponent:fileName];
|
||||
if (![data writeToFile:filePath atomically:YES]) {
|
||||
[KBHUD showInfo:KBLocalized(@"音频保存失败")];
|
||||
[KBHUD showInfo:KBLocalized(@"Failed to save audio")];
|
||||
return;
|
||||
}
|
||||
NSString *text =
|
||||
displayText.length > 0 ? displayText : KBLocalized(@"语音消息");
|
||||
displayText.length > 0 ? displayText : KBLocalized(@"Voice message");
|
||||
KBChatMessage *incoming =
|
||||
[KBChatMessage messageWithText:text outgoing:NO audioFilePath:filePath];
|
||||
incoming.displayName = KBLocalized(@"AI助手");
|
||||
incoming.displayName = KBLocalized(@"AI Assistant");
|
||||
[self kb_appendChatMessage:incoming];
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
}
|
||||
NSURL *url = [NSURL fileURLWithPath:path];
|
||||
if (![NSFileManager.defaultManager fileExistsAtPath:path]) {
|
||||
[KBHUD showInfo:KBLocalized(@"音频文件不存在")];
|
||||
[KBHUD showInfo:KBLocalized(@"Audio file does not exist")];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
AVAudioPlayer *player =
|
||||
[[AVAudioPlayer alloc] initWithContentsOfURL:url error:&playerError];
|
||||
if (playerError || !player) {
|
||||
[KBHUD showInfo:KBLocalized(@"音频播放失败")];
|
||||
[KBHUD showInfo:KBLocalized(@"Audio playback failed")];
|
||||
return;
|
||||
}
|
||||
self.chatAudioPlayer = player;
|
||||
@@ -664,7 +664,7 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
if (playerError || !player) {
|
||||
NSLog(@"[Keyboard] 音频播放器初始化失败: %@",
|
||||
playerError.localizedDescription);
|
||||
[KBHUD showInfo:KBLocalized(@"音频播放失败")];
|
||||
[KBHUD showInfo:KBLocalized(@"Audio playback failed")];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user