소스 검색

fix: 调整静态文件路径配置项

zhupei 1 년 전
부모
커밋
75117d2c9e
3개의 변경된 파일21개의 추가작업 그리고 9개의 파일을 삭제
  1. 9 0
      public/config.js
  2. 7 6
      src/components/DialogWrap.vue
  3. 5 3
      src/components/dialog-wrap/format-dialog-item.js

+ 9 - 0
public/config.js

@@ -5,6 +5,15 @@ window.__IFRAME_URL_CHUJUAN = 'http://192.168.20.119:8501'
 
 window.WEBSOCKET_BASE_URL = location.host;
 
+/**
+ * 静态资源地址
+ * 图片、文档等类型的地址
+ */
+// window.ASSETS_BASE_URL = location.host;
+window.ASSETS_BASE_URL = '192.168.20.119:9301';
+
+
+
 /**
  * 小数绘图 -> ComfyUI -> iframe弹窗地址
  */

+ 7 - 6
src/components/DialogWrap.vue

@@ -575,6 +575,7 @@ export default defineComponent({
              * 以便下一次 type=stream 的消息来临时继续重新拼接
              */
             let temp_stream_msg = '';
+            const download_server = window.ASSETS_BASE_URL;
 
             /**
              * 处理socket数据
@@ -695,17 +696,17 @@ export default defineComponent({
                         answerData.value = '正在处理中...'
                         // 以下是智能数据对话的变量
                         const { image_url, excel_url, excel_name, code, sql } = JSON.parse(evt_dt);
-                        const port = window.location.port ? `:${window.location.port}` : '';
+                        // const port = window.location.port ? `:${window.location.port}` : '';
 
                         // 如果有图片或excel,则更新图片或excel地址
                         if (image_url) {
-                            imageUrl.value = `http://${window.location.hostname}${port}${image_url}`
+                            imageUrl.value = `http://${download_server}${image_url}`
                         }
 
                         if (excel_url) {
                             const file = {
                                 file_type: 'excel',
-                                file_url: `http://${window.location.hostname}${port}${excel_url}`,
+                                file_url: `http://${download_server}${excel_url}`,
                                 file_name: `${excel_name}.xlsx` || '点击下载',
                             }
 
@@ -748,12 +749,12 @@ export default defineComponent({
                     // 出题
                     if (chat_type == 'question') {
                         const { file_url, file_name } = JSON.parse(evt_dt);
-                        const port = window.location.port ? `:${window.location.port}` : '';
+                        // const port = window.location.port ? `:${window.location.port}` : '';
 
                         if (file_url) {
                             const file = {
                                 file_type: 'word',
-                                file_url: `http://${window.location.hostname}${port}${file_url}`,
+                                file_url: `http://${download_server}${file_url}`,
                                 file_name: `${file_name}.docx` || '点击下载',
                             }
                             answerFile.value = file
@@ -854,7 +855,7 @@ export default defineComponent({
              * 通过websocket进行发送
              */
             helper.$bus.on("send-message", (value) => {
-                console.log(value, '会话的内容');
+                // console.log(value, '会话的内容');
 
                 /**
                  * 当消息发送时,及时清理stream的拼接值

+ 5 - 3
src/components/dialog-wrap/format-dialog-item.js

@@ -4,6 +4,8 @@ import { formatCodePython, formatCodeSql } from './format-code-string';
 
 import formatFieldDownloadUrl from './format-field-download-url';
 
+const download_server = window.ASSETS_BASE_URL;
+
 const replaceCode = (text, index) => {
     const icon = `  <span class="circle" data-list-index="${index || 0}"></span>`
     return text.replace(/##\d\$\$/g, icon);
@@ -45,7 +47,7 @@ export default function formatDialogItem(item, index) {
         // 如果有文件处理完拿第一个,后续有变动再改
         file: (item.files && item.files.length > 0) ? item.files.map(item => {
             const port = window.location.port ? `:${window.location.port}` : '';
-            const base_url = `http://${window.location.hostname}${port}`;
+            const base_url = `http://${download_server}`;
 
             let url = '';
             if (item.file_url[0] === '/') {
@@ -79,8 +81,8 @@ export default function formatDialogItem(item, index) {
     }
 
     if (item.image_url) {
-        const port = window.location.port ? `:${window.location.port}` : '';
-        result.image_url = `http://${window.location.hostname}${port}${item.image_url}`
+        // const port = window.location.port ? `:${window.location.port}` : '';
+        result.image_url = `http://${download_server}${item.image_url}`
     }
 
     return result;