From 70e41ae03b0f50c0f2891ef059ad89a601f46c2c Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Mon, 10 Feb 2025 11:47:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=80=9D=E8=80=83=E6=A1=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialoguePanel/DialoguePanel.vue | 30 ++--- .../dialoguePanel/DialogueThought.vue | 110 ++++++++++++++++++ 2 files changed, 125 insertions(+), 15 deletions(-) create mode 100644 src/components/dialoguePanel/DialogueThought.vue diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 5d955b6a..66e5a09e 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -13,14 +13,16 @@ import ReportPopover from "src/views/dialogue/components/ReportPopover.vue"; import { onMounted, watch, onBeforeUnmount,reactive } from "vue"; import * as echarts from 'echarts'; import color from 'src/assets/color'; -import { Linetooltip , Circlelegend } from './chartsCss' import i18n from 'src/i18n'; import { storeToRefs } from 'pinia'; import { useLangStore } from 'src/store' +import JsonFormComponent from './JsonFormComponent.vue' +import { Metadata } from "srcapis/paths/type"; +import DialogueFlow from "./DialogueFlow.vue"; +import DialogueThought from "./DialogueThought.vue"; const { user_selected_plugins } = storeToRefs(useHistorySessionStore()); import { Suggest } from 'src/apis/paths/type'; const { params } = storeToRefs(useHistorySessionStore()); - const { language } = storeToRefs(useLangStore()); const { changeLanguage } = useLangStore(); const echartsDraw = ref(); @@ -68,11 +70,8 @@ export interface DialoguePanelProps { // modeOptions:any; } -import JsonFormComponent from './JsonFormComponent.vue' -import { Metadata } from "srcapis/paths/type"; -import DialogueFlow from "./DialogueFlow.vue"; -import { emit, title } from "process"; +const thoughtContent = ref(''); var option = ref(); var show = ref(false); const size = reactive({ @@ -238,18 +237,24 @@ const contentAfterMark = computed(() => { if (!props.content) { return ""; } + //xxs将大于号转为html实体以防歧义;将< >替换为正常字符; let str = marked.parse( xss(props.content[props.currentSelected]) .replace(/>/g, ">") .replace(/</g, "<") ) + //将table提取出来中加一个
父节点控制溢出 let tableStart = str.indexOf(''); if(tableStart!== -1){ str = str.slice(0, tableStart) + '
' + str.slice(tableStart, str.indexOf('
') + ''.length).replace('', '
') + str.slice(str.indexOf('') + ''.length); } - //将table提取出来中加一个
父节点控制溢出 - return str; - //xxs将大于号转为html实体以防歧义;将< >替换为正常字符; + str = str+`dsadadsadada + 12121212 + ` + //仅获取第一个遇到的 think 标签 + thoughtContent.value = str.match(/([\s\S]*?)<\/think>/)[1]; + //将标签替换为空 + return str.replace(/([\s\S]*?)<\/think>/g,''); }); @@ -380,12 +385,6 @@ const selectQuestion = (item:Suggest) => { }; -// const selectQuestion = (item:object) => { -// let question = item.question; -// let user_selected_flow = item.flow; -// emits('handleSendMessage',question,user_selected_flow); -// }; - const popperSize = () => { if(language.value == "EN"){ size.width = 418; @@ -449,6 +448,7 @@ const handleSendMessage = async (question, user_selected_flow, user_selected_plu
+
diff --git a/src/components/dialoguePanel/DialogueThought.vue b/src/components/dialoguePanel/DialogueThought.vue new file mode 100644 index 00000000..3174f2b8 --- /dev/null +++ b/src/components/dialoguePanel/DialogueThought.vue @@ -0,0 +1,110 @@ + + + + + \ No newline at end of file -- Gitee From 334c3e5d6bdcc19bb2b3c3b8c100db6be8e978d0 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Mon, 10 Feb 2025 16:07:36 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=80=9D=E8=80=83?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E6=8A=98=E5=8F=A0=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dialoguePanel/DialoguePanel.vue | 5 ++--- src/components/dialoguePanel/DialogueThought.vue | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 66e5a09e..0bd437e0 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -248,11 +248,10 @@ const contentAfterMark = computed(() => { if(tableStart!== -1){ str = str.slice(0, tableStart) + '
' + str.slice(tableStart, str.indexOf('') + ''.length).replace('', '
') + str.slice(str.indexOf('') + ''.length); } - str = str+`dsadadsadada - 12121212 - ` //仅获取第一个遇到的 think 标签 + if(str.match(/([\s\S]*?)<\/think>/)){ thoughtContent.value = str.match(/([\s\S]*?)<\/think>/)[1]; + } //将标签替换为空 return str.replace(/([\s\S]*?)<\/think>/g,''); }); diff --git a/src/components/dialoguePanel/DialogueThought.vue b/src/components/dialoguePanel/DialogueThought.vue index 3174f2b8..1a5af0ee 100644 --- a/src/components/dialoguePanel/DialogueThought.vue +++ b/src/components/dialoguePanel/DialogueThought.vue @@ -6,7 +6,9 @@
>
+ > + +
思考
@@ -49,7 +51,6 @@ padding: 0.5rem 1rem; cursor: pointer; background-color: #f8f8f8; - border-bottom: 1px dashed #ccc; .think-label { font-size: 0.9rem; -- Gitee From 4bd4d9283267c4f32cebb428f6a65c1c84e64b6a Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Tue, 11 Feb 2025 15:19:50 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/App.vue | 4 +- src/assets/images/routerCopilot.png | Bin 0 -> 930 bytes src/assets/images/routerCopilotSelected.png | Bin 0 -> 1596 bytes src/assets/images/witchainD.png | Bin 0 -> 727 bytes src/assets/svgs/WitchainDSelected.svg | 19 ++ src/i18n/lang/en.ts | 1 + src/i18n/lang/zh-cn.ts | 1 + src/router/index.ts | 28 +- src/views/dialogue/Copilot.vue | 45 ++- .../dialogue/components/DialogueAside.vue | 6 - src/views/dialogue/components/InitalPanel.vue | 295 +++++++++--------- src/views/dialogue/dialogueView.vue | 246 +++++++++------ src/views/tools/index.vue | 23 ++ 14 files changed, 393 insertions(+), 277 deletions(-) create mode 100644 src/assets/images/routerCopilot.png create mode 100644 src/assets/images/routerCopilotSelected.png create mode 100644 src/assets/images/witchainD.png create mode 100644 src/assets/svgs/WitchainDSelected.svg create mode 100644 src/views/tools/index.vue diff --git a/package.json b/package.json index ab59e9f7..b9e99383 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "codemirror": "^6.0.1", "dayjs": "1.11.9", "echarts": "^5.5.1", - "element-plus": "2.3.12", + "element-plus": "2.2.34", "highlight.js": "11.10.0", "marked": "4.3", "pinia": "2.1.6", diff --git a/src/App.vue b/src/App.vue index 592032d8..b832b239 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,11 +1,11 @@ diff --git a/src/assets/images/routerCopilot.png b/src/assets/images/routerCopilot.png new file mode 100644 index 0000000000000000000000000000000000000000..7e3205580ec0c6710dcf2de0bbee510ec55950f8 GIT binary patch literal 930 zcmV;T16}-yP){7vph;tJT zGEvXMxW;&ppDo!?{jH$NlI`E>hguB?f*=TjAP9mW2!bF8f*=S&2-MIIkh6&slmC8= z9@62Sq#c6^xQP=pQM4q$R9;B527pC0Uv<6LE=~;a=lC4`K6ahM#V_s&t2h^pKurcI zwFH3e{;&kmx{Ht&GzBJ80Pk(b)}gs4bn&)7d}&2rwJWX)rIy?MfwuAIs_Bqy_0hER zJ?kFH*TgxEO|>mGt8o{9Of4p+ES`o=0pOX*&w3Sb6DLM1`tmiu0@5E+Ygf?O#fh=7 zrZD2D@so1;LT>_YX7cK|h-UBH_x9%l1BnM@{tQui9x^cf#I3FlvdT}_v0{Te-_i)g-5K-y)BiK1X` zBZpPMHu;$k2r$JhVF-9vV8FoPBJ?U`6EO6bcfp>p*T5#AK1*1KCFI9s6HqC2$2C`9 zLVnC(#e`dht(;Zod-8p2?^F^;4-ecK=ILI(>M!AzKI zRczwK)QLw#-}&!doS2=*pu)BS6_8fF7y)LxKe&s~rTU)x`bKr^Gc2sx#R*#tu*l5^ z5qm1AW+Hw}x#z!m0gDxB3;oDFJDY&j5jHH!3pulCZEOV00YQkO1 zP`P9F$SUB_W~_kp+sd7|5Mcyv@@ZK+B~s#g7Z9* z+t;}m%?j*8*>vkyA77`!O$b=@z5gGk`{n8dES|(=?Ho5 z_R$29HYgx{d79nl|6PqlAz&Ai_@% literal 0 HcmV?d00001 diff --git a/src/assets/images/routerCopilotSelected.png b/src/assets/images/routerCopilotSelected.png new file mode 100644 index 0000000000000000000000000000000000000000..fb3dd0a7659ded22a612c5cace3fbdc7281477fd GIT binary patch literal 1596 zcmV-C2E+M@P)x){ICBm)x=q^^E-m0&R5696JGVFCi4zFSWK zo_%<64IyJn^1VC(u>39uEC}BNw(;!u?1F&{P#JNxC~I7!ovh`PqXu1qiNgcrc+KZ$|Pb+bS$9v038E5777o5 zJdJj^^0@wp|#4A0D)bf$P zS~!@1c6M)(zl-j*1!(&N|zbvC!WLp z@qB&Znu#9qN{^zIcNZ~`fa8Q1U_I0sI{`^mSV=2>C`S)~y6ds>uQwC2O z;t%(_R+2UMdthi?1yU7sCqfab-`qYJ20hx@{ZF6*EzrDXR z6RUkklOX^%9EIKl9KX(F6=uB`%XRxYZFR52J?8z5Kca1NptC#Ta&glCq?rl$ zIJVlWN9TGU#ImhU-X#8l-C6ShCiIUAM;ade%M!%0IX)Sm#g~Fw8UkVcx zs7zy6H~sRLKiAyne6L7Fl8@)P#a(S|U%!XbfW ztnNbvvX3veZsnjv3jkWnbk2!4e`{0qht<(SolY^#bs#$I9lxkL3`&4v{I%9c9=)xG z^#c=Tor`5Sn@kg`{cC;E?!A)Fhcw;15zW`}+;2VfCg9@DNOd~sYBa+Bf6X=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PPUe>~{c+h7hrpoo=eQ0{U)tF + + Created with Pixso. + + + + + + + + + + + + + + + + diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index 60af04e8..02c108dc 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -9,6 +9,7 @@ export default { like: 'Like', }, main: { + question:"Recommended Questions", describe1:"Hi! I'm", describe2:", and I'm happy to be of service.", left_describe:"Feel free to ask me, your AI assistant, about any of these topics, or anything else that's on your mind!~", diff --git a/src/i18n/lang/zh-cn.ts b/src/i18n/lang/zh-cn.ts index 522e13b7..f77ed798 100644 --- a/src/i18n/lang/zh-cn.ts +++ b/src/i18n/lang/zh-cn.ts @@ -9,6 +9,7 @@ export default { like: '喜欢', }, main: { + question:"推荐问题", describe1: '你好,我是', describe2: ',很高兴为你服务', left_describe: '作为你的智能助手,你可以试着问我关于以下方面的内容哦~', diff --git a/src/router/index.ts b/src/router/index.ts index a43c6a9b..b30db40a 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -7,24 +7,40 @@ // IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR // PURPOSE. // See the Mulan PSL v2 for more details. -import { createRouter, createWebHistory } from 'vue-router'; +import { createRouter, createWebHashHistory } from 'vue-router'; import NotFoundComponent from 'src/views/404.vue'; import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper'; const router = createRouter({ - history: createWebHistory(qiankunWindow.__POWERED_BY_QIANKUN__ ? '/eulercopilot/' : '/'), + history: createWebHashHistory(qiankunWindow.__POWERED_BY_QIANKUN__ ? '/eulercopilot/' : '/'), routes: [ { path: '/', name: 'dialogue', - component: (): Promise => - import('src/views/dialogue/dialogueView.vue'), + component: (): Promise => + import('src/views/dialogue/Copilot.vue'), }, { path: '/login', name: 'dialogue-login', - component: (): Promise => - import('src/views/dialogue/dialogueView.vue'), + component: (): Promise => + import('src/views/dialogue/Copilot.vue'), + }, + { + path: '/copilot', + name: 'copilot', + component: (): Promise => + import('src/views/dialogue/Copilot.vue'), + }, + { + path: '/tools', + name: 'tools', + component: (): Promise => + import('src/views/tools/index.vue'), + beforeEnter: (to, from, next) => { + window.location.href = 'https://www.baidu.com' + //之后改成 witchain——D + } }, { path: '/404', diff --git a/src/views/dialogue/Copilot.vue b/src/views/dialogue/Copilot.vue index e9d50896..11c69e77 100644 --- a/src/views/dialogue/Copilot.vue +++ b/src/views/dialogue/Copilot.vue @@ -51,16 +51,16 @@ const initCopilot = async (): Promise => { } userinfo.value.organization = type; const currRoute = router.currentRoute; - if (currRoute.value.path === '/') { + if ( ['/copilot','/'].includes(currRoute.value?.path)) { const isLogin = await getUserInfo(); if (isLogin) { await api.getRecognitionMode() await api.stopGeneration(); await getHistorySession(); setPlugins(); - } - return; } + return; + } }; const dialogVisible = ref(false); @@ -117,9 +117,7 @@ watch(
- + + :visible="agreeDialogVisiable" + :content="tip" + :need-check="false" + height="300px" + agreement-name="内测声明" + @submit="agreeDialogVisiable = false" + > diff --git a/src/views/dialogue/components/DialogueAside.vue b/src/views/dialogue/components/DialogueAside.vue index ca910a6b..2c34518f 100644 --- a/src/views/dialogue/components/DialogueAside.vue +++ b/src/views/dialogue/components/DialogueAside.vue @@ -207,11 +207,6 @@ function hanleAsideVisible(): void {
- - - {{ $t('history.new_chat') }} - -
@@ -441,7 +436,6 @@ function hanleAsideVisible(): void { } .history-record { - margin-top: 15px; flex: 1; display: flex; height: calc(100% - 55px - 80px); diff --git a/src/views/dialogue/components/InitalPanel.vue b/src/views/dialogue/components/InitalPanel.vue index f665d12d..bfb24cd7 100644 --- a/src/views/dialogue/components/InitalPanel.vue +++ b/src/views/dialogue/components/InitalPanel.vue @@ -1,135 +1,100 @@ -- Gitee From 64424e1d9ad1688e36544ca28e0df169fd2621ef Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Tue, 11 Feb 2025 15:20:56 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=20tools=20=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=87=AA=E5=8A=A8=E8=B7=B3=E8=BD=AC=E5=88=B0=20baidu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index b30db40a..a22ae84d 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -37,10 +37,6 @@ const router = createRouter({ name: 'tools', component: (): Promise => import('src/views/tools/index.vue'), - beforeEnter: (to, from, next) => { - window.location.href = 'https://www.baidu.com' - //之后改成 witchain——D - } }, { path: '/404', -- Gitee From 61d5c7b75a64cc86330b528a0fe345b5640cd88d Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Tue, 11 Feb 2025 15:44:19 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dialogue/dialogueView.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/dialogue/dialogueView.vue b/src/views/dialogue/dialogueView.vue index 60b23efe..77a4eedd 100644 --- a/src/views/dialogue/dialogueView.vue +++ b/src/views/dialogue/dialogueView.vue @@ -18,6 +18,8 @@ import CopilotIcon from '@/assets/images/routerCopilot.png'; import CopilotIconSelected from '@/assets/images/routerCopilotSelected.png'; import WitchainDIcon from '@/assets/images/witchainD.png'; import WitchainDIconSelected from '@/assets/svgs/WitchainDSelected.svg'; +const { createNewSession } = useHistorySessionStore(); + // 挂载全局事件 window.onHtmlEventDispatch = onHtmlEventDispatch as any; const { logout } = useAccountStore(); @@ -140,7 +142,6 @@ const copy = () => { navigator.clipboard.writeText(apikey.value); } - const lang = computed(() => (language.value === 'EN' ? 'English' : '简体中文')); const handleConfirmCreateModel = async (formData: any | undefined) => { @@ -195,6 +196,13 @@ watch( { deep: true } ); +const addNewSession = async(routerName: string) => { + console.log(router.currentRoute.value.name, routerName) + if(router.currentRoute.value.name === routerName){ + await createNewSession(); + } +} +