uint8_t GetChatContentListCount(void);
// 更新和清空问题及回答
- void RemoveLastTwoItemsOrClear();
+ bool RemoveLastTwoItemsOrClear();
bool UpdateUserQuestionStr(void);
bool UpdateAiAnswerStr(void);
void ClearQuestionAndAiAnswerStr(void);
}
// 函数定义:移除列表的最后两项或清空列表
- void AiVoiceModel::RemoveLastTwoItemsOrClear()
+ bool AiVoiceModel::RemoveLastTwoItemsOrClear()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::RemoveLastTwoItemsOrClear");
AivoiceReturnResultTextView *p_AivoiceReturnResultTextView = AivoiceReturnResultTextView::GetInstance();
if (p_AivoiceReturnResultTextView == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AivoiceReturnResultTextView::GetInstance fail!!");
- return;
+ return false;
}
// 获取适配器
AivoiceChatContentListAdapter *adapter = p_AivoiceReturnResultTextView->GetAivoiceChatContentListAdapter();
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "listSize = %d", listSize);
ChatContentListCount -= (listSize < 2 ? listSize : 2);
}
+ {
+ return false;
+ }
+ return true;
}
/* 更新用户问题字符串 */
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::UpdateUserQuestionStr");
- RemoveLastTwoItemsOrClear();
+ if(!RemoveLastTwoItemsOrClear())
+ {
+ return false;
+ }
if (!AddUserQuestionToChatItems())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddUserQuestionToChatItems fail!!");
{
if(view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true)
{
- int index = model->GetSelectAiModel() + 1;
- if (index >= AIMODES_MAX_NUM)
+ int index = model->GetSelectAiModel() - 1;
+ if (index < 0)
{
- index = 0;
+ index = AIMODES_CHATGPT;
}
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index);
model->SetSelectAiModel(index);
{
if(view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true)
{
- int index = model->GetSelectAiModel() - 1;
- if (index < 0)
+ int index = model->GetSelectAiModel() + 1;
+ if (index >= AIMODES_MAX_NUM)
{
- index = AIMODES_CHATGPT;
+ index = 0;
}
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index);
model->SetSelectAiModel(index);
if (isScroll)
{
// 监听,让List实现滚动
- AivoiceReturnResultTextView::GetInstance()->GetChatContentList()->ScrollBy(-150);
+ AivoiceReturnResultTextView::GetInstance()->GetChatContentList()->ScrollBy(-120);
isScroll = false;
}
}