From 9aae2af6f3937a7d99ec619b51f457002cef969f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 14:29:37 +0800
Subject: [PATCH] 档案管理-添加导出功能
---
src/views/chatHome/chatHomeIndex/MobileChat.vue | 72 +++++++++++++++++++-----------------
1 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/src/views/chatHome/chatHomeIndex/MobileChat.vue b/src/views/chatHome/chatHomeIndex/MobileChat.vue
index 36a6dd7..adeb5e7 100644
--- a/src/views/chatHome/chatHomeIndex/MobileChat.vue
+++ b/src/views/chatHome/chatHomeIndex/MobileChat.vue
@@ -14,7 +14,7 @@
<span class="flash_cursor"></span>
</template>
<template v-else>
- <pre>{{ item.msg }}</pre>
+ <pre style="font-family: none;">{{ item.msg }}</pre>
</template>
</div>
<div class="chat-img" v-if="item.chatType == 1">
@@ -49,13 +49,13 @@
</div>
</div>
</div>
-<!-- <div class="chat-input-wrapper">-->
-<!-- <div style="display: flex; align-items: center">-->
-<!-- <input v-model="inputMsg" @change="sendText" class="input-text" autofocus placeholder="缁橠eepSeek鍙戦�佹秷鎭�" />-->
-<!-- <img class="send-icon" src="@/assets/img/emoji/rocket.png" alt="" @click="sendText" />-->
+ <div class="chat-input-wrapper">
+ <div style="display: flex; align-items: center">
+ <input v-model="inputMsg" @change="sendText" :disabled="loading" class="input-text" autofocus placeholder="缁欏皬鏅哄彂閫佹秷鎭�" />
+ <img class="send-icon" src="@/assets/img/emoji/rocket.png" alt="" @click="sendText" />
-<!-- </div>-->
-<!-- </div>-->
+ </div>
+ </div>
</div>
</template>
@@ -67,6 +67,7 @@
import headPortrait from '@/assets/img/head_portrait.jpg'
import FileCard from '@/components/FileCard.vue'
import { ElMessage } from "element-plus"
+import {checking} from './ai-wd.js'
// 瀹氫箟鍝嶅簲寮忔暟鎹�
const route = useRoute()
@@ -86,7 +87,7 @@
const isSend = ref(false)
const fileList = ref([])
const isProcessing = ref(false)
-const loading = ref(false)
+const loading = ref(true)
const srcImgList = ref([])
// 鍒犻櫎鍥剧墖
@@ -137,20 +138,19 @@
chatType: 0, //淇℃伅绫诲瀷锛�0鏂囧瓧锛�1鍥剧墖
uid: '1001' //uid
}
- sendMsg(chatMsg)
+ chatList.value.push(chatMsg)
let chatGPT = {
- headImg: headPortrait,
- name: 'DeepSeek',
+ headImg: chatGPTHeadImg,
+ name: '灏忔櫤',
time: new Date().toLocaleTimeString(),
msg: "",
chatType: 0, //淇℃伅绫诲瀷锛�0鏂囧瓧锛�1鍥剧墖
uid: '1002' //uid
}
chatList.value.push(chatGPT) // 灏嗘帴鏀跺埌鐨勬秷鎭瓨鍌ㄥ埌 messages 鏁扮粍
+ simulateStreamingOutput(chatGPT, inputMsg.value)
inputMsg.value = ''
- loading.value = true
- isSend.value = true
- websocketsend(chatMsg.msg)
+
} else {
ElMessage({
message: '娑堟伅涓嶈兘涓虹┖鍝',
@@ -185,7 +185,7 @@
uid: '1002'
})
chatList.value.push({
- headImg: chatGPTHeadImg,
+ headImg: headPortrait,
name: '鍗ч緳',
time: new Date().toLocaleTimeString(),
msg: route.query.keyWord,
@@ -203,36 +203,40 @@
}
chatList.value.push(replyMsg)
scrollBottom()
-
+ loading.value = false
// 濡傛灉鏈夋煡璇㈠叧閿瓧锛屽垯妯℃嫙娴佸紡杈撳嚭
if (route.query.keyWord) {
- simulateStreamingOutput(replyMsg)
+ simulateStreamingOutput(replyMsg, route.query.keyWord)
}
})
// 妯℃嫙娴佸紡杈撳嚭
-const simulateStreamingOutput = (msgObj) => {
- // 鐢熸垚0.8-1.8绉掍箣闂寸殑闅忔満寤惰繜
- const delay = Math.random() * 1000 + 800
+const simulateStreamingOutput = async (msgObj, keyWord) => {
+ loading.value = true
+ // 鐢熸垚0.8-1.3绉掍箣闂寸殑闅忔満寤惰繜
+ const delay = Math.random() * 500 + 800
// 妯℃嫙鍥炲鍐呭锛堝疄闄呭簲鐢ㄤ腑搴斾粠API鑾峰彇锛�
- const responseText = `鍏充簬"${route.query.keyWord}"鐨勯棶棰橈紝鎴戞潵涓烘偍瑙g瓟锛歕n\n杩欐槸涓�涓ず渚嬪洖澶嶅唴瀹癸紝灞曠ず娴佸紡杈撳嚭鏁堟灉銆傚湪瀹為檯搴旂敤涓紝杩欓噷浼氭槸鏉ヨ嚜AI鐨勭湡瀹炲洖澶嶅唴瀹广�俓n\n璇风◢绛夛紝鎴戞鍦ㄦ暣鐞嗙浉鍏充俊鎭�...`
-
+ const responseText = `鍏充簬"${keyWord}"鐨勯棶棰橈紝鎴戞潵涓烘偍瑙g瓟锛歕n` + checking(keyWord)
isSend.value = true
let index = 0
- const interval = setInterval(() => {
- isSend.value = true
- if (index < responseText.length) {
- msgObj.msg += responseText.charAt(index)
- index++
- isSend.value = false
- scrollBottom()
- } else {
- clearInterval(interval)
- isSend.value = false
- }
- }, 50) // 姣�50ms杈撳嚭涓�涓瓧绗︼紝妯℃嫙娴佸紡鏁堟灉
+ setTimeout(() => {
+ const interval = setInterval(() => {
+ isSend.value = true
+ if (index < responseText.length) {
+ msgObj.msg += responseText.charAt(index)
+ index++
+ isSend.value = false
+ scrollBottom()
+ } else {
+ clearInterval(interval)
+ isSend.value = false
+ loading.value = false
+ }
+ }, 50) // 姣�50ms杈撳嚭涓�涓瓧绗︼紝妯℃嫙娴佸紡鏁堟灉
+ }, delay)
+
}
</script>
--
Gitblit v1.9.3