From 0c736342c738ee81edb7391fc43d8f91e7f7e2e4 Mon Sep 17 00:00:00 2001 From: guoyichen Date: Mon, 11 Aug 2025 16:36:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=80=82=E9=85=8D=E6=B7=B1?= =?UTF-8?q?=E5=BA=A6=E7=A0=94=E7=A9=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- deploy/nginx.conf.tmpl | 14 +++++++++- deploy/start.sh | 4 +-- src/assets/svgs/deepinsight.svg | 13 ++++++++++ src/assets/svgs/deepinsightSelected.svg | 21 +++++++++++++++ src/i18n/lang/en.ts | 1 + src/i18n/lang/zh-cn.ts | 1 + src/router/index.ts | 5 ++++ src/views/dialogue/components/TitleBar.vue | 14 +++++++--- src/views/dialogue/dialogueView.vue | 30 ++++++++++++++++------ src/views/tools/index.vue | 14 +++++++--- vite.config.ts | 2 +- 12 files changed, 101 insertions(+), 20 deletions(-) create mode 100644 src/assets/svgs/deepinsight.svg create mode 100644 src/assets/svgs/deepinsightSelected.svg diff --git a/Dockerfile b/Dockerfile index e477cfd..b734d67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN apk add --no-cache git openssh-client ca-certificates \ # 第二阶段:部署到nginx FROM hub.oepkgs.net/openeuler/openeuler:24.03-lts-sp2 -ENV TZ Asia/Shanghai +ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ echo $TZ > /etc/timezone diff --git a/deploy/nginx.conf.tmpl b/deploy/nginx.conf.tmpl index 7aefa26..7892f7e 100644 --- a/deploy/nginx.conf.tmpl +++ b/deploy/nginx.conf.tmpl @@ -69,7 +69,6 @@ http { add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; always"; add_header Cache-Control "no-cache"; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: base64;"; - limit_conn limitperip 50; resolver 8.8.8.8 8.8.4.4 valid=60s; resolver_timeout 5s; @@ -147,6 +146,19 @@ http { proxy_pass ${RAG_WEB_URL}/witchaind/; } + location /deepinsight/ { + proxy_set_header X-Forwarded-For $http_x_real_ip; + add_header X-Accel-Buffering no; + proxy_buffering off; + proxy_intercept_errors on; + + error_page 404 /404.html; + proxy_read_timeout 500s; + proxy_connect_timeout 500s; + + proxy_pass ${DEEPINSIGHT_WEB_URL}/deepinsight/; + } + error_page 401 402 403 405 406 407 413 414 /error.html; error_page 404 /404.html; error_page 500 501 502 503 504 505 /error.html; diff --git a/deploy/start.sh b/deploy/start.sh index 3a91558..3b4def2 100644 --- a/deploy/start.sh +++ b/deploy/start.sh @@ -1,5 +1,5 @@ #!/bin/bash export $(cat .env | xargs) -bash -c "envsubst '\${RAG_WEB_URL} \${FRAMEWORK_URL}' < nginx.conf.tmpl > /config/nginx.conf" -nginx -c /config/nginx.conf -g "daemon off;" \ No newline at end of file +bash -c "envsubst '\${RAG_WEB_URL} \${FRAMEWORK_URL} \${DEEPINSIGHT_WEB_URL}' < nginx.conf.tmpl > /config/nginx.conf" +nginx -c /config/nginx.conf -g "daemon off;" diff --git a/src/assets/svgs/deepinsight.svg b/src/assets/svgs/deepinsight.svg new file mode 100644 index 0000000..9703b1e --- /dev/null +++ b/src/assets/svgs/deepinsight.svg @@ -0,0 +1,13 @@ + + + Created with Pixso. + + + + + + + + + + diff --git a/src/assets/svgs/deepinsightSelected.svg b/src/assets/svgs/deepinsightSelected.svg new file mode 100644 index 0000000..00de264 --- /dev/null +++ b/src/assets/svgs/deepinsightSelected.svg @@ -0,0 +1,21 @@ + + + Created with Pixso. + + + + + + + + + + + + + + + + + + diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index a27641f..1f8108f 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -48,6 +48,7 @@ export default { plugin_center: 'Plugin Center', app_center: 'App Center', sql: 'witchainD', + deepinsight: 'deepinsight', settings: 'Settings', }, semantic: { diff --git a/src/i18n/lang/zh-cn.ts b/src/i18n/lang/zh-cn.ts index 60e7199..f9f6ee4 100644 --- a/src/i18n/lang/zh-cn.ts +++ b/src/i18n/lang/zh-cn.ts @@ -48,6 +48,7 @@ export default { plugin_center: '插件中心', app_center: '应用中心', sql: '知识库', + deepinsight:'深度研究', settings: '设置', }, semantic: { diff --git a/src/router/index.ts b/src/router/index.ts index 4d77594..80e4f5b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -47,6 +47,11 @@ const staticRoutes: Array = [ name: 'witchainD', children: [], // 这里不要添加component内容,否则会导致iframe重复渲染 }, + { + path: '/deepinsight', + name: 'deepinsight', + children: [], // 这里不要添加component内容,否则会导致iframe重复渲染 + }, { path: '/settings', name: 'settings', diff --git a/src/views/dialogue/components/TitleBar.vue b/src/views/dialogue/components/TitleBar.vue index 77b7cd7..5e20f89 100644 --- a/src/views/dialogue/components/TitleBar.vue +++ b/src/views/dialogue/components/TitleBar.vue @@ -11,7 +11,9 @@ import { import { computed, CSSProperties, ref, onMounted } from 'vue'; import { electronProcess, ipcRenderer } from '@/utils/electron'; import { getBaseUrl } from 'src/utils/tools'; +import { useRouter } from 'vue-router'; +const router = useRouter(); const { language } = storeToRefs(useLangStore()); const { changeLanguage } = useLangStore(); const themeStore = useChangeThemeStore(); @@ -22,10 +24,14 @@ const iframeTarget = ref(''); onMounted(async () => { const baseUrl = await getBaseUrl(); const origin = window.location.origin; - const isElectron = window.navigator.userAgent.includes('Electron'); - iframeTarget.value = isElectron - ? `${baseUrl}/witchaind` - : `${origin}/witchaind`; + const isElectron = window.navigator.userAgent.includes('Electron'); + let pathname = router.currentRoute.value.name?.toLowerCase(); + let target = ''; + if (pathname === 'witchaind') { + iframeTarget.value = isElectron ? `${baseUrl}/witchaind` : `${origin}/witchaind`; + } else if (pathname === 'deepinsight') { + iframeTarget.value = isElectron ? `${baseUrl}/deepinsight` : `${origin}/deepinsight`; + } }); const changeLanguagefun = (lang: 'zh_cn' | 'en') => { diff --git a/src/views/dialogue/dialogueView.vue b/src/views/dialogue/dialogueView.vue index 9190353..4d189c0 100644 --- a/src/views/dialogue/dialogueView.vue +++ b/src/views/dialogue/dialogueView.vue @@ -23,6 +23,8 @@ import AppIcon from '@/assets/svgs/routerApp.svg'; import AppIconSelected from '@/assets/svgs/routerAppSelected.svg'; import WitChainDIcon from '@/assets/svgs/witChainD.svg'; import WitChainDIconSelected from '@/assets/svgs/witChainDSelected.svg'; +import DeepinsightSelected from '@/assets/svgs/deepinsightSelected.svg'; +import DeepinsightIcon from '@/assets/svgs/deepinsight.svg'; import Setting from '@/assets/svgs/setting.svg'; import SettingSelected from '@/assets/svgs/setting_active.svg'; import tools from '../tools/index.vue'; @@ -87,6 +89,13 @@ let routerList: ComputedRef< selectedSrc: WitChainDIconSelected, routerName: 'witchainD', }, + { + name: i18n.global.t('menu.deepinsight'), + path: '/deepinsight', + src: DeepinsightIcon, + selectedSrc: DeepinsightSelected, + routerName: 'deepinsight', + }, ]; }); @@ -170,9 +179,14 @@ onMounted(async () => { const baseUrl = await getBaseUrl(); const origin = window.location.origin; const isElectron = window.navigator.userAgent.includes('Electron'); - const iframeTarget = isElectron - ? `${baseUrl}/witchaind` - : `${origin}/witchaind`; + let pathname = router.currentRoute.value.name?.toLowerCase(); + console.log(pathname) + let iframeTarget = ''; + if (pathname === 'witchaind') { + iframeTarget = isElectron ? `${baseUrl}/witchaind` : `${origin}/witchaind`; + } else if (pathname === 'deepinsight') { + iframeTarget = isElectron ? `${baseUrl}/deepinsight` : `${origin}/deepinsight`; + } if (localStorage.getItem('theme')) { // document.body.setAttribute( @@ -306,11 +320,11 @@ watch( -
- - - - +
+ + + +
{ watch( () => router.currentRoute.value.path, async (newPath) => { - const isWitchaindRoute = newPath === '/witchainD'; + const isWitchaindRoute = newPath === '/witchainD' || newPath === '/deepinsight'; isActive.value = isWitchaindRoute; // 等待DOM更新完成 diff --git a/vite.config.ts b/vite.config.ts index 7c815ed..241e0fe 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -80,7 +80,7 @@ export default ({ mode }): UserConfigExport => { }, proxy: { '/api': { - target: env.VITE_BASE_PROXY_URL, + target: "http://deepinsight-web-service.{{ .Release.Namespace }}.svc.cluster.local:9222", changeOrigin: true, secure: false, ws: false, -- Gitee