From 59fe23153d24cdc930dfcfd5bece72c0d545f747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E6=B0=91=E5=BA=B7?= Date: Thu, 8 May 2025 11:25:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BF=A1=E4=BB=A3=E7=A0=81=E5=BA=93-?= =?UTF-8?q?=E5=8F=AF=E4=BF=A1=E5=BC=80=E6=BA=90=E4=BB=A3=E7=A0=81=E5=BA=93?= =?UTF-8?q?AI=E5=8A=A9=E6=89=8B=E5=BC=80=E6=BA=90=E8=BD=AF=E4=BB=B6?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=B1=95=E7=A4=BA=E5=BC=80=E5=8F=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.loc | 6 +- package.json | 1 + src/assets/imgs/jyh/ai/icon_generate.png | Bin 0 -> 234 bytes src/assets/imgs/jyh/ai/icon_skgc.png | Bin 0 -> 769 bytes src/views/Jyh/AI/Home/GuessYouWantToAsk.vue | 4 +- src/views/Jyh/AI/Home/SwiperComponent.vue | 5 +- src/views/Jyh/AI/Home/components/OssList.vue | 522 +++++++++++++++++++ src/views/Jyh/AI/Home/index.vue | 204 ++++++-- src/views/Jyh/AI/Home/mock.constants.js | 67 ++- 9 files changed, 758 insertions(+), 51 deletions(-) create mode 100644 src/assets/imgs/jyh/ai/icon_generate.png create mode 100644 src/assets/imgs/jyh/ai/icon_skgc.png create mode 100644 src/views/Jyh/AI/Home/components/OssList.vue diff --git a/.env.loc b/.env.loc index 539cae6..dc60f36 100644 --- a/.env.loc +++ b/.env.loc @@ -2,7 +2,7 @@ VITE_ENV = 'loc' # 主域名 -VITE_HOST = 'https://test.gitcode.net' +VITE_HOST = 'http://124.223.71.235:8080' # 接口地址 VITE_API_HOST = 'https://test.gitcode.net' @@ -26,7 +26,7 @@ VITE_CSDN_URL = 'https://test.gitcode.net/oauth/login/csdn' VITE_ORG_COMMUNITY = 'https://test.gitcode.net' # 静态资源域名 -VITE_STATIC_HOST = 'https://test.gitcode.net' +VITE_STATIC_HOST = 'http://124.223.71.235:8080' # 主页搜索子应用 VITE_CHILD_HOMEWEB_HOST = 'https://local.gitcode.net:8001/child/homeweb-app' @@ -36,3 +36,5 @@ VITE_USER_CENTER_HOST = 'https://local.gitcode.net:8002' # ai-copilot 子应用 VITE_COPILOT_HOST = 'https://local.gitcode.net:8003/child/aichat-app' + +VITE_BASE_URL=/openRepoPortal/ diff --git a/package.json b/package.json index 1727d36..f9bbbc4 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "build:test": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode test", "build:pre": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode pre", "build:prod": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode production", + "build:loc": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode loc", "analysis": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode analysis", "preview": "vite preview", "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false", diff --git a/src/assets/imgs/jyh/ai/icon_generate.png b/src/assets/imgs/jyh/ai/icon_generate.png new file mode 100644 index 0000000000000000000000000000000000000000..0029e9dd8d4ccbfc6c82f50eb1e010041f39d1fd GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFw^VVC!&ld+u(%XU7#M8uVK6%I=yIb4!x0bBgoHu{VeK_-76CpXu0X*p zx}Uddf8Pd1yET6A(D}K+5G5VOQi|0OIke#bI>Hq$c((iv}wO0SmdE0MrjE(K}hYJSJYmR); zIDEt{F{dW!lJK$}=eDdXe3r_V*6MLaalZRGaj{VUs6@_|Q$}3cZVy(kS|8bXaF>Ae zY>gbreR~&Io%$5(k^b%5URk~Xiz{DGa2?;e|HLy9d&9q1K5YK{%Q`0JS*~xaW?ikb z%%^Yf{xu$`pMHFK`XuosQ}kK%we;dSANq2Cx~p4LqZPNPOryRwyvsf
-
@@ -21,6 +21,8 @@ + + diff --git a/src/views/Jyh/AI/Home/index.vue b/src/views/Jyh/AI/Home/index.vue index cc9a5a6..3dc46ba 100644 --- a/src/views/Jyh/AI/Home/index.vue +++ b/src/views/Jyh/AI/Home/index.vue @@ -3,17 +3,51 @@
@@ -31,20 +65,20 @@
- +
- -
+ + + + + + + + +
@@ -98,6 +132,7 @@ import { ref, defineComponent, nextTick, onMounted } from 'vue'; import { introPrompt, simplePrompt, mockAnswer, guessQuestions } from './mock.constants'; import SwiperComponent from './SwiperComponent.vue'; import GuessYouWantToAsk from './GuessYouWantToAsk.vue'; +import OssList from './components/OssList.vue'; const inputValue = ref(''); const startChat = ref(false); @@ -156,31 +191,41 @@ const onSubmit = (e, answer = undefined) => { behavior: 'smooth', }); }); - getAIAnswer(answer ?? e); + // getAIAnswer(answer ?? e); + getAIAnswer(mockAnswer); }; const getAIAnswer = (content) => { messages.value.push({ from: 'ai-model', - content: '', + content: content, avatarPosition: 'side-left', avatarConfig: { ...aiModelAvatar }, - loading: true, + loading: false, }); - /* 模拟流式数据返回 */ - setTimeout(async () => { - messages.value.at(-1).loading = false; - for (let i = 0; i < content.length;) { - await new Promise(r => setTimeout(r, 300 * Math.random())); - messages.value[messages.value.length - 1].content = content.slice(0, i += Math.random() * 10); - nextTick(() => { - conversationRef.value?.scrollTo({ - top: conversationRef.value.scrollHeight - }); - }); - } - }, 1000); + + // messages.value.push({ + // from: 'ai-model', + // content: '', + // avatarPosition: 'side-left', + // avatarConfig: { ...aiModelAvatar }, + // loading: true, + // }); + + // /* 模拟流式数据返回 */ + // setTimeout(async () => { + // messages.value.at(-1).loading = false; + // for (let i = 0; i < content.length;) { + // await new Promise(r => setTimeout(r, 300 * Math.random())); + // messages.value[messages.value.length - 1].content = content.slice(0, i += Math.random() * 10); + // nextTick(() => { + // conversationRef.value?.scrollTo({ + // top: conversationRef.value.scrollHeight + // }); + // }); + // } + // }, 1000); }; const onNewConvo = () => { @@ -201,6 +246,26 @@ const themeChange = () => { } } +const isLoading = ref(false); +let interval = null; +const thinkBtnText = ref('思考过程'); +const btnIcon = ref('icon-chevron-down-2'); + +const toggleThink = (idx) => { + if (isLoading.value) { + return + } + const targetNode = document.querySelectorAll('.mc-bubble-content-container')[idx]; + if (targetNode) { + const thinkBlock = targetNode.querySelector('.mc-think-block'); + if (thinkBlock) { + const currentDisplay = getComputedStyle(thinkBlock).display; + thinkBlock.style.display = currentDisplay === 'none' ? 'block' : 'none'; + btnIcon.value = currentDisplay === 'none' ? 'icon-chevron-up-2' :'icon-chevron-down-2' + } + } +} + onMounted(() => { if(typeof window !== 'undefined'){ themeService = window['devuiThemeService']; @@ -215,7 +280,7 @@ onMounted(() => {