From 0601a3a1660d5b45838be1e6fbee0ad055ec6ff0 Mon Sep 17 00:00:00 2001 From: Lexcubia Date: Sun, 20 Apr 2025 19:46:51 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E4=B8=BB=E9=A2=98=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=AE=BE=E7=BD=AE=E7=AE=A1=E7=90=86=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=81=8A=E5=A4=A9=E7=95=8C=E9=9D=A2=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8E=86=E5=8F=B2=E4=BC=9A=E8=AF=9D=E5=92=8C=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmrc | 1 + package.json | 1 + src/components/chat/CustomerBackground.vue | 128 ++++++++ src/components/chat/HistoryButton.vue | 177 +++++++++++ src/components/chat/ModeSetting.vue | 90 ++++++ src/main.js | 3 +- src/router/index.js | 1 + src/store/chat.js | 40 ++- src/store/route.js | 2 +- src/store/settings.js | 56 ++++ src/style.css | 2 +- src/styles/element-variables.scss | 5 + src/views/chat/ChatHeader.vue | 249 ++++++++++++++++ src/views/chat/ChatInterface.vue | 330 ++++++++++++++++----- src/views/chat/ChatModeSelector.vue | 234 ++++++++++----- vite.config.js | 7 + yarn.lock | 199 ++++++++++--- 17 files changed, 1327 insertions(+), 198 deletions(-) create mode 100644 .npmrc create mode 100644 src/components/chat/CustomerBackground.vue create mode 100644 src/components/chat/HistoryButton.vue create mode 100644 src/components/chat/ModeSetting.vue create mode 100644 src/store/settings.js create mode 100644 src/styles/element-variables.scss create mode 100644 src/views/chat/ChatHeader.vue diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..918fa4a --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +registry=https://registry.npmmirror.com/ \ No newline at end of file diff --git a/package.json b/package.json index 5491463..ca8dc0e 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ }, "devDependencies": { "@vitejs/plugin-vue": "^5.2.1", + "sass": "^1.86.3", "sass-embedded": "^1.86.3", "vite": "^6.2.0" } diff --git a/src/components/chat/CustomerBackground.vue b/src/components/chat/CustomerBackground.vue new file mode 100644 index 0000000..1e5d4d6 --- /dev/null +++ b/src/components/chat/CustomerBackground.vue @@ -0,0 +1,128 @@ + + + + + \ No newline at end of file diff --git a/src/components/chat/HistoryButton.vue b/src/components/chat/HistoryButton.vue new file mode 100644 index 0000000..a398a27 --- /dev/null +++ b/src/components/chat/HistoryButton.vue @@ -0,0 +1,177 @@ + + + + + \ No newline at end of file diff --git a/src/components/chat/ModeSetting.vue b/src/components/chat/ModeSetting.vue new file mode 100644 index 0000000..4a9a614 --- /dev/null +++ b/src/components/chat/ModeSetting.vue @@ -0,0 +1,90 @@ + + + + + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 35b3166..66d3ead 100644 --- a/src/main.js +++ b/src/main.js @@ -7,7 +7,8 @@ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' // 引入 Element Plus import ElementPlus from 'element-plus' -import 'element-plus/dist/index.css' +// 使用自定义主题 +import './styles/element-variables.scss' import zhCn from 'element-plus/dist/locale/zh-cn.mjs' const pinia = createPinia(); diff --git a/src/router/index.js b/src/router/index.js index 2f9e1db..e9699c8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -15,6 +15,7 @@ const routes = [ component: () => import("@/layouts/blank.vue"), }, ], + redirect: "/chat" }, { path: "/chat", diff --git a/src/store/chat.js b/src/store/chat.js index 1715e5c..7c2dade 100644 --- a/src/store/chat.js +++ b/src/store/chat.js @@ -4,18 +4,43 @@ import { sendMessage } from '@/api/chat' const chatModes = { training: { name: '寿险代理人AI陪练', - icon: 'fas fa-user-tie', - token: 'app-88ae2GN49aUyNO6qGg7tbTfX' + icon: '👨‍💼', + token: 'app-88ae2GN49aUyNO6qGg7tbTfX', + background: `# 客户信息 +### **基础背景与性格设定** + +**姓名**:张伟 + +**年龄**:34 岁 + +**职业**:腾讯员工 + +**家庭**:妻子为全职太太,女儿 9 岁,双方父母健在 + +**性格**:冷静、理性、务实,偏好客观数据和逻辑分析,对保险持观望态度,防备心较强 + +**近期状态**: + +- 体检显示中度脂肪肝,担心投保问题 + +- 已为全家配置百万医疗险,妻子有重疾险,但认为保障不足 (保费 50W) + +- 对理财型保险收益不认可,但对补充重疾险有潜在需求 `, + chatBackground: '你通过你的老同学顾先生介绍,和一位中国人寿的保险代理人约在你家中首次面谈。你的家中布置简洁,茶几上摆放着一套茶具。', }, quote_objection: { name: '报价中异议', - icon: 'fas fa-comments', - token: 'app-88ae2GN49aUyNO6qGg7tbTfX' + icon: '💬', + token: 'app-88ae2GN49aUyNO6qGg7tbTfX', + background: '', + chatBackground: '', }, post_quote_objection: { name: '报价后异议', - icon: 'fas fa-comment-dollar', - token: 'app-88ae2GN49aUyNO6qGg7tbTfX' + icon: '💰', + token: 'app-88ae2GN49aUyNO6qGg7tbTfX', + background: '', + chatBackground: '', } } // 返回示例 @@ -180,9 +205,10 @@ export const useChatStore = defineStore('chat', { conversationId: message.conversation_id, messageId: message.message_id, createdAt: message.created_at, + createdAtTimestamp: '', question: question, answerBuffer: '', - showEvaluation: true, + showEvaluation: false, respondingType: '', kehu: '', pingfen: '', diff --git a/src/store/route.js b/src/store/route.js index d8550c5..01133a5 100644 --- a/src/store/route.js +++ b/src/store/route.js @@ -2,7 +2,7 @@ import { defineStore } from 'pinia' export const useRouteStore = defineStore('route', { state: () => ({ - currentRoute: '/' + currentRoute: '/chat' }), actions: { updateCurrentRoute(path) { diff --git a/src/store/settings.js b/src/store/settings.js new file mode 100644 index 0000000..163c792 --- /dev/null +++ b/src/store/settings.js @@ -0,0 +1,56 @@ +import { defineStore } from 'pinia' + +export const useSettingsStore = defineStore('settings', { + state: () => ({ + // 侧边栏状态 + sidebarCollapsed: false, + + // 界面配置 + interface: { + // 是否显示时间戳 + showTimestamp: true, + // 消息气泡最大宽度(px) + messageMaxWidth: 800, + // 字体大小(px) + fontSize: 14 + }, + + // 主题配置 + theme: { + // 主色调 + primary: '#07c160', + // 背景色 + background: '#f5f5f5', + // 文字颜色 + textColor: '#333333' + } + }), + + actions: { + // 切换侧边栏状态 + toggleSidebar() { + this.sidebarCollapsed = !this.sidebarCollapsed + }, + + // 更新界面配置 + updateInterface(config) { + this.interface = { + ...this.interface, + ...config + } + }, + + // 更新主题配置 + updateTheme(config) { + this.theme = { + ...this.theme, + ...config + } + }, + + // 重置所有设置 + resetSettings() { + this.$reset() + } + } +}) \ No newline at end of file diff --git a/src/style.css b/src/style.css index 2fec00c..265ef4a 100644 --- a/src/style.css +++ b/src/style.css @@ -3,7 +3,7 @@ line-height: 1.5; font-weight: 400; - color-scheme: light dark; + color-scheme: light only; color: rgba(255, 255, 255, 0.87); background-color: #242424; diff --git a/src/styles/element-variables.scss b/src/styles/element-variables.scss new file mode 100644 index 0000000..cf7860a --- /dev/null +++ b/src/styles/element-variables.scss @@ -0,0 +1,5 @@ +/* 自定义主题变量 */ +$--color-primary: #07c160; + +/* 导入 Element Plus 样式 */ +@use "element-plus/theme-chalk/src/index.scss" as *; \ No newline at end of file diff --git a/src/views/chat/ChatHeader.vue b/src/views/chat/ChatHeader.vue new file mode 100644 index 0000000..84cd7f5 --- /dev/null +++ b/src/views/chat/ChatHeader.vue @@ -0,0 +1,249 @@ + + + + + \ No newline at end of file diff --git a/src/views/chat/ChatInterface.vue b/src/views/chat/ChatInterface.vue index 2795c35..01f06fd 100644 --- a/src/views/chat/ChatInterface.vue +++ b/src/views/chat/ChatInterface.vue @@ -1,6 +1,18 @@