소스 검색

修改内容

yangg 3 주 전
부모
커밋
3ac2bf78c2

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/assets/forget-password-CjQIcdUo.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
dist/assets/index-WWw2HkaV.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/assets/login-o4_VWgLk.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/assets/register-CB7Q8-sK.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/assets/report-B9t_b4bs.css


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/assets/report-Cp30cQO1.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/assets/report-Cs2HFD4o.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/assets/report-bSAPZ7p6.css


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/assets/vendor-CDgCf3zB.js


+ 2 - 2
dist/index.html

@@ -5,8 +5,8 @@
     <link rel="icon" type="image/svg+xml" href="/vite.svg" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title></title>
-    <script type="module" crossorigin src="/assets/index-CvYBo2Zb.js"></script>
-    <link rel="modulepreload" crossorigin href="/assets/vendor-CsNcCXs6.js">
+    <script type="module" crossorigin src="/assets/index-WWw2HkaV.js"></script>
+    <link rel="modulepreload" crossorigin href="/assets/vendor-CDgCf3zB.js">
     <link rel="stylesheet" crossorigin href="/assets/index-CVrWfcbZ.css">
   </head>
   <body>

+ 30 - 0
nginx.conf

@@ -0,0 +1,30 @@
+server {
+    listen 80;
+    server_name localhost;  # 替换为您的域名
+    
+    root /usr/share/nginx/html;  # 替换为您的项目构建后的文件路径
+    index index.html;
+
+    location / {
+        try_files $uri $uri/ /index.html;  # 将所有请求重定向到index.html
+        add_header Cache-Control "no-cache, no-store, must-revalidate";
+        add_header Pragma "no-cache";
+        add_header Expires "0";
+    }
+
+    # 静态资源缓存设置
+    location /assets {
+        expires 1y;
+        add_header Cache-Control "public";
+        access_log off;
+    }
+
+    # 处理API请求
+    location /api {
+        proxy_pass http://your-backend-server;  # 替换为您的后端服务地址
+        proxy_set_header Host $host;
+        proxy_set_header X-Real-IP $remote_addr;
+    }
+
+    error_page 404 /index.html;  # 将404错误重定向到首页
+} 

+ 98 - 31
src/components/KnowledgeResults/index.vue

@@ -2,7 +2,7 @@
   <div class="knowledge-results">
     <!-- 搜索框 -->
     <div class="search-box">
-      <div class="input-wrapper">
+     <!--  <div class="input-wrapper">
         <input
           v-model="searchQuery"
           type="text"
@@ -15,7 +15,7 @@
           class="clear-icon" 
           @click="clearSearch"
         >×</span>
-      </div>
+      </div> -->
       <!-- <button @click="handleSearch" :disabled="isSearching" class="search-button">
         {{ isSearching ? '搜索中...' : '搜索' }}
       </button> -->
@@ -29,8 +29,14 @@
       @scroll="handleScroll"
     >
       <div v-for="result in displayResults" :key="result.id" class="result-item">
-        <div class="result-title">{{ result.title }}</div>
+        <h3 class="result-title">
+          <a :href="result.link" target="_blank" rel="noopener noreferrer">{{ result.title }}</a>
+        </h3>
         <div class="result-content" v-html="formatContent(result.content)"></div>
+        <div v-if="result.translation" class="result-translation">
+          <span class="translation-label">中文释义:</span>
+          <span class="translation-content">{{ result.translation }}</span>
+        </div>
         <div class="result-meta">
           <span class="result-source">来源: {{ result.source || '知识库' }}</span>
           <span class="result-date">{{ formatDate(result.date) }}</span>
@@ -87,10 +93,15 @@ export default defineComponent({
       type: String,
       default: 'remote', // 'remote' 或 'local'
       validator: (value) => ['remote', 'local'].includes(value)
+    },
+    // 添加是否显示中文释义的配置
+    showTranslation: {
+      type: Boolean,
+      default: true
     }
   },
 
-  emits: ['update:enableSearch', 'search'],
+  emits: ['update:enableSearch', 'search', 'translate'],
 
   setup(props, { emit }) {
     const searchQuery = ref('');
@@ -107,8 +118,11 @@ export default defineComponent({
 
     // 监听搜索结果变化
     watch(() => props.searchResults, (newResults) => {
-      console.log(newResults);
-      displayResults.value = newResults;
+      console.log('New search results:', newResults);
+      displayResults.value = newResults.map(result => ({
+        ...result,
+        translation: result.translation || '' // 确保translation字段存在
+      }));
     });
 
     // 监听 message prop 的变化
@@ -130,7 +144,8 @@ export default defineComponent({
           query: searchQuery.value,
           page: page.value,
           pageSize: pageSize.value,
-          type: props.searchType
+          type: props.searchType,
+          needTranslation: props.showTranslation // 添加是否需要翻译的标志
         });
       } finally {
         isSearching.value = false;
@@ -176,12 +191,13 @@ export default defineComponent({
       }
     };
 
-    // 添加格式化内容的方法
+    // 格式化内容的方法
     const formatContent = (content) => {
       if (!content) return '';
-      // 将内容中的关键词高亮显示
-      return content.replace(new RegExp(searchQuery.value, 'gi'), 
-        match => `<span style="color: #1677ff; font-weight: 500;">${match}</span>`
+      // 将内容中的关键词高亮显示,同时处理HTML标签
+      const escapedQuery = searchQuery.value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+      return content.replace(new RegExp(escapedQuery, 'gi'), 
+        match => `<span class="highlight">${match}</span>`
       );
     };
 
@@ -386,41 +402,68 @@ export default defineComponent({
     }
 
     .result-item {
-      padding: var(--base-spacing);
-      margin-bottom: var(--base-spacing);
-      border-radius: var(--border-radius);
-      background: #fff;
-      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+      padding: 20px 0;
+      border-bottom: 1px solid #f0f0f0;
       transition: all 0.3s ease;
 
-      @media (max-width: 480px) {
-        padding: calc(var(--base-spacing) / 2);
-        margin-bottom: calc(var(--base-spacing) / 2);
+      &:last-child {
+        border-bottom: none;
       }
 
       &:hover {
-        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
-        transform: translateY(-2px);
+        background: rgba(0, 0, 0, 0.02);
       }
 
       .result-title {
-        font-size: calc(var(--base-font-size) + 2px);
-        margin-bottom: 8px;
-        color: #1677ff;
+        margin: 0 0 8px;
+        font-size: 16px;
+        
+        a {
+          color: #1677ff;
+          text-decoration: none;
 
-        @media (max-width: 480px) {
-          font-size: var(--base-font-size);
+          &:hover {
+            text-decoration: underline;
+          }
         }
       }
 
       .result-content {
-        font-size: var(--small-font-size);
         color: rgba(0, 0, 0, 0.65);
-        margin-bottom: 12px;
-        line-height: 1.6;
+        font-size: 14px;
+        margin-bottom: 8px;
+        line-height: 1.5;
+      }
 
-        @media (max-width: 480px) {
-          font-size: var(--smaller-font-size);
+      .result-translation {
+        font-size: 14px;
+        color: rgba(0, 0, 0, 0.65);
+        margin-bottom: 8px;
+        padding: 8px;
+        background: #f5f5f5;
+        border-radius: 4px;
+
+        .translation-label {
+          color: rgba(0, 0, 0, 0.85);
+          font-weight: 500;
+          margin-right: 8px;
+        }
+
+        .translation-content {
+          color: rgba(0, 0, 0, 0.65);
+        }
+      }
+
+      .result-meta {
+        font-size: 12px;
+        color: rgba(0, 0, 0, 0.45);
+        display: flex;
+        gap: 16px;
+
+        .result-date,
+        .result-source {
+          display: inline-flex;
+          align-items: center;
         }
       }
     }
@@ -488,6 +531,22 @@ export default defineComponent({
       .result-content {
         color: rgba(255, 255, 255, 0.65);
       }
+
+      .result-translation {
+        background: #1f1f1f;
+
+        .translation-label {
+          color: rgba(255, 255, 255, 0.85);
+        }
+
+        .translation-content {
+          color: rgba(255, 255, 255, 0.65);
+        }
+      }
+
+      .result-meta {
+        color: rgba(255, 255, 255, 0.45);
+      }
     }
   }
 }
@@ -559,4 +618,12 @@ export default defineComponent({
     transition: none;
   }
 }
+
+.highlight {
+  color: #1677ff;
+  font-weight: 500;
+  padding: 0 2px;
+  border-radius: 2px;
+  background: rgba(24, 144, 255, 0.1);
+}
 </style> 

+ 7 - 7
src/components/SearchResults/index.vue

@@ -1,13 +1,13 @@
 <template>
-  <div class="search-results">
-    <div class="search-box">
+  <div class="search-results"><!--   @keyup.enter="handleSearch" -->
+    <!-- <div class="search-box">
       <div class="input-wrapper">
         <input
           v-model="searchQuery"
           type="text"
           placeholder="Enter your search query"
         
-        /><!--   @keyup.enter="handleSearch" -->
+        />
         <span 
           v-if="searchQuery" 
           class="clear-icon" 
@@ -17,14 +17,14 @@
       <button @click="handleSearch" :disabled="isSearching">
         搜索一下
       </button>
-    </div>
+    </div> -->
 
-    <div class="results-header">
+    <!-- <div class="results-header">
       <h2>Related Search Results</h2>
       <div class="result-stats">
         Found {{ total }} results
       </div>
-    </div>
+    </div> -->
 
     <div class="results-container" ref="resultsContainer" @scroll="handleScroll">
       <!-- 搜索结果列表 -->
@@ -114,7 +114,7 @@ export default defineComponent({
     watch(() => props.message, (newMessage) => {
       if (newMessage && props.enableWebSearch) {
         searchQuery.value = newMessage;
-        handleSearch(); // 自动触发搜索
+       // handleSearch(); // 自动触发搜索
       }
     });
 

+ 2 - 2
src/router/index.js

@@ -1,11 +1,11 @@
-import { createRouter, createWebHistory } from 'vue-router'
+import { createRouter, createWebHashHistory } from 'vue-router'
 import { ROUTE } from './menu.js'
 
 // 白名单路由,不需要登录就可以访问
 const whiteList = ['/login', '/register', '/forget-password', '/404', '/register/invitation']
 
 const route = createRouter({
-    history: createWebHistory(import.meta.env.BASE_URL),
+    history: createWebHashHistory(import.meta.env.BASE_URL),
     scrollBehavior: () => ({ y: 0 }),
     routes: ROUTE
 })

+ 3 - 4
src/views/report.vue

@@ -484,7 +484,6 @@
             class="message-input"
             v-model="inputContent"
             @keyup.enter="sendMessage"
-           
             placeholder="Type a message..."
           /><!--  @input="handleInputChange" -->
           <button
@@ -704,9 +703,9 @@
 
         <!-- 添加知识库结果面板 -->
         <div v-show="activeTab === 'knowledge'" class="panel-container">
-          <div class="search-header">
+          <!-- <div class="search-header">
             <span>知识库搜索结果</span>
-          </div>
+          </div> -->
           <!-- v-if="enableKnowledgeSearch" -->
           <KnowledgeResults
             :searchResults="knowledgeResults"
@@ -833,7 +832,7 @@ const isSearchLoading = ref(false);
 const searchTotal = ref(0);
 
 // 添加互联网搜索开关状态
-const enableWebSearch = ref(true);
+const enableWebSearch = ref(false);
 
 // 添加新的响应式变量
 const isMenuCollapsed = ref(false);

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.