diff --git a/src/views/chat/components/ai-assistant.vue b/src/views/chat/components/ai-assistant.vue index 9666d8a..60fa52f 100644 --- a/src/views/chat/components/ai-assistant.vue +++ b/src/views/chat/components/ai-assistant.vue @@ -227,7 +227,7 @@ const autoMessage = async () => { if (error.message === 'canceled') { return } - const errorMessage = error?.errmsg ?? '好像出错了,请稍后再试。' + const errorMessage = error?.errmsg ?? '出现异常,请刷新页面再试。' contenText.value = errorMessage } finally { contentLoading.value = false @@ -314,7 +314,7 @@ const sendMessage = async () => { }) return } - const errorMessage = error?.errmsg ?? '好像出错了,请稍后再试。' + const errorMessage = error?.errmsg ?? '出现异常,请刷新页面再试。' aiChatStore.updateChatSomeByUuid(uuid, dataSources.value.length - 1, { loading: false, diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index add5221..8bd3b51 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -272,7 +272,7 @@ async function onConversation(action = 'next', file, fileText) { action: action, conversation_id: chatStore.active, message: { - text: message?.substring(0, 4000), + text: message, id: uuidv4(), type: (file?.extension === 'doc' ? 'docx' : file?.extension) || 'text', fileInfo: file, @@ -307,7 +307,7 @@ async function onConversation(action = 'next', file, fileText) { conversationUserList.value[conversationUserList.value.length - 1] if (lastUserContext) { const obj = lastUserContext[Object.keys(lastUserContext)[0]] - params.message.text = obj.text?.substring(0, 4000) + params.message.text = obj.text params.message.id = obj.id params.parent_message_id = obj.id } @@ -326,6 +326,26 @@ async function onConversation(action = 'next', file, fileText) { scrollToBottom() let tempMessage_id = null try { + + + let lastFileContext = '' + + const _fileListConversation = conversationUserList.value.filter((item) => { + const key = Object.keys(item)[0] + const value = item[key] + return value.type !== 'text' + }) + + if (_fileListConversation.length && params.message.type === 'text') { + const _obj = _fileListConversation[_fileListConversation.length - 1] + const _currentMsg = _obj[Object.keys(_obj)[0]] + lastFileContext = _currentMsg.text + if (_currentMsg.fileInfo) + params.message.quote = lastFileContext.substring(0, 4000) + } + + params.message.text = params.message.text.substring(0, 4000) + const fetchChatAPIOnce = async () => { await http.post('/api/v1/conversation', params, { signal: controller.signal, @@ -366,6 +386,8 @@ async function onConversation(action = 'next', file, fileText) { } await fetchChatAPIOnce() + loading.value = false + userInfo.getUserInfo() } catch (error) { if (error.message === 'canceled') { chatStore.updateChatSome(chatStore.getCurrentChat.length - 1, { @@ -373,15 +395,16 @@ async function onConversation(action = 'next', file, fileText) { }) return } - const errorMessage = error?.errmsg ?? '好像出错了,请稍后再试。' + const errorMessage = error?.errmsg ?? '出现异常,请刷新页面再试。' chatStore.updateChatSome(chatStore.getCurrentChat.length - 1, { loading: false, text: errorMessage, }) - } finally { loading.value = false userInfo.getUserInfo() + } finally { + } } diff --git a/src/views/communication/components/contacts.vue b/src/views/communication/components/contacts.vue index e30b359..f415e9c 100644 --- a/src/views/communication/components/contacts.vue +++ b/src/views/communication/components/contacts.vue @@ -7,28 +7,29 @@ background: '#161718', borderRadius: '6px', width: '90%', + height: '80%', }" >
感谢您对海兔AI的关注
-请留下您的信息
-我们会尽快联系您!
+请留下您的信息
+我们会尽快联系您!
+了解更多,一键扫码咨询
+