From df692cbda4d55d36fa054a00316189f26333aef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E6=B0=91=E5=BA=B7?= Date: Tue, 1 Jul 2025 17:03:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BF=A1=E4=BB=A3=E7=A0=81=E5=BA=93-A?= =?UTF-8?q?I=E5=A4=A7=E6=A8=A1=E5=9E=8B=E5=AF=B9=E8=AF=9D=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E3=80=81=E5=A4=8D=E5=88=B6=E3=80=81=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E3=80=81=E7=82=B9=E8=B8=A9=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.ts | 3 ++- src/views/Jyh/AI/Home/index.vue | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 008b4aa..3c9c6ba 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -40,7 +40,7 @@ const $Decrypt = (text) => { // 尝试解析为JSON对象 return JSON.parse(originalText); } catch (e) { - console.error('解密失败:', e); + // console.error('解密失败:', e); return text; // 解密失败返回原始数据 } }; @@ -199,6 +199,7 @@ const proxyService = (params: any, customConfigs?: CustomConfigs) => { // response 拦截器 service.interceptors.response.use( (response) => { + debugger response.data.data = $Decrypt(response.data.data) return response; }, diff --git a/src/views/Jyh/AI/Home/index.vue b/src/views/Jyh/AI/Home/index.vue index 271ec36..f8f7053 100644 --- a/src/views/Jyh/AI/Home/index.vue +++ b/src/views/Jyh/AI/Home/index.vue @@ -53,10 +53,10 @@
- - + + - +
@@ -276,16 +276,16 @@ const onSubmit = async (e, answer = undefined) => { // 刷新回答(重新发送上一个用户问题) const handleRefresh = (index: number) => { - const currentMsg = messages.value[index]; - if (currentMsg.role === 'ai-model' && currentMsg.question) { // 假设AI回答的question字段存储了用户原始问题 - onSubmit(currentMsg.question); // 调用原有发送方法 + const currentMsg = messages.value[index-1]; + if (currentMsg.role === 'user' && currentMsg.content) { // 假设AI回答的question字段存储了用户原始问题 + onSubmit(currentMsg.content); // 调用原有发送方法 } }; // 复制回答内容 const handleFile = (index: number) => { const currentMsg = messages.value[index]; - if (currentMsg.role === 'ai-model') { + if (currentMsg.role === 'ai-model' || currentMsg.role === 'system') { const content = currentMsg.content || ''; // 处理富文本或特殊格式(示例中直接提取文本) const textContent = typeof content === 'string' ? content : JSON.stringify(content); @@ -305,8 +305,8 @@ const handleFile = (index: number) => { // 点赞/点踩处理 const handleLike = (index: number, type: 'like' | 'dislike') => { const currentMsg = messages.value[index]; - if (currentMsg.role === 'ai-model' && currentMsg.id) { // 假设消息有唯一ID - messages.value[currentMsg.id].islike = type; + if (currentMsg.role === 'ai-model' || currentMsg.role === 'system') { + messages.value[index].islike = type; // // 调用接口(示例中需替换为实际API) // axios.post('/api/rateConversation', { @@ -1077,4 +1077,8 @@ onMounted(() => { } } } + +.icon-dislike-solid { + transform: scaleX(-1) rotate(180deg); +}