From: luozheng <1732036298@qq.com> Date: Tue, 19 Nov 2024 14:16:44 +0000 (+0800) Subject: 解决ChatGPT,设置Key后不能用问题 X-Git-Tag: fd230_release_V1.3.102~29^2~18 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1429%2F2;p=mirrors%2FFD230.git 解决ChatGPT,设置Key后不能用问题 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp index 8f21d1832..dbecef250 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:11:17 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-11-05 11:17:28 + * @LastEditTime: 2024-11-19 22:08:14 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp */ #include "AppViewIDs.h" @@ -129,7 +129,14 @@ namespace OHOS } else { - ChangeViewAndLogicOperator(AIVOICE_AIMODE_CONNECTING, AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); + if(model->GetAiModelTextId() == STR_AIMODES_CHATGPT) //如果当前是在chatgpt模型*/ + { + ChangeViewAndLogicOperator(AIVOICE_AIMODE_CONNECTING, AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ + } + else + { + ChangeViewAndLogicOperator(AIVOICE_AIMODE_CONNECTING, AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); + } } } else @@ -325,12 +332,12 @@ namespace OHOS model->reset_ai_screen60s_timer_time(); /* -------------------------------------------------------------------------- */ - if ((viewId == AIVOICE_CHAT_BUTTON_VIEW_ID) && model->IsExistOpenAIAPIKeys() == false) // 如果点击的是(对话按钮)且未配置apikey - { - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ - return true; - } - else if (viewId == AIVOICE_APIKEYS_BUTTON_VIEW_ID) // 如果点击的是API Keys按钮(注:暂时不用) + // if ((viewId == AIVOICE_CHAT_BUTTON_VIEW_ID) && model->IsExistOpenAIAPIKeys() == false) // 如果点击的是(对话按钮)且未配置apikey + // { + // ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ + // return true; + // } + if (viewId == AIVOICE_APIKEYS_BUTTON_VIEW_ID) // 如果点击的是API Keys按钮(注:暂时不用) { if (model->IsExistOpenAIAPIKeys() == true) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp index a12d46886..8a589eac3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-11-05 11:18:37 + * @LastEditTime: 2024-11-19 22:07:15 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp */ #include "aivoice/include/AiVoicePresenter.h" @@ -327,6 +327,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::aiModelImage is nullptr!!"); return false; } + upImage->SetVisible(false); return true; } @@ -356,7 +357,8 @@ namespace OHOS .y = 328, .w = 380, .h = 80, - .ViewId = AIVOICE_CHAT_BUTTON_VIEW_ID, + // .ViewId = AIVOICE_CHAT_BUTTON_VIEW_ID, + .ViewId = AIVOICE_START_CHAT_BUTTON_VIEW_ID, }; chatButton = AiVoiceViewButtonInit(buttonconfig); if (chatButton == nullptr) @@ -912,7 +914,7 @@ namespace OHOS // SetComponentVisibility(chatLabel, isAiModeChatGpt); // SetComponentVisibility(apiKeysButton, isAiModeChatGpt); // SetComponentVisibility(apiKeysLabel, isAiModeChatGpt); - SetComponentVisibility(upImage, isAiModeChatGpt); + // SetComponentVisibility(upImage, isAiModeChatGpt); // SetComponentVisibility(startChatLabel, !isAiModeChatGpt); SetComponentVisibility(startChatButton, !isAiModeChatGpt);