linyang 2 tygodni temu
rodzic
commit
592cb6465e

+ 4 - 11
src/views/documents/KnowledgeSnippet.vue

@@ -905,15 +905,10 @@ const formatMetaInfo = (row: Snippet) => {
     if (row.metadata) {
         // 如果是 JSON 对象,尝试格式化展示
         if (typeof row.metadata === 'object') {
-             // 排除一些不需要展示的字段,如 doc_name, file_name, title (因为已有单独列)
              const displayParts = []
              for (const [key, value] of Object.entries(row.metadata)) {
-                 if (!['doc_name', 'file_name', 'title'].includes(key)) {
-                     // 简单格式化:Key: Value
-                     // 如果 value 也是对象,转字符串
-                     const valStr = typeof value === 'object' ? JSON.stringify(value) : String(value)
-                     displayParts.push(`${key}: ${valStr}`)
-                 }
+                 const valStr = typeof value === 'object' ? JSON.stringify(value) : String(value)
+                 displayParts.push(`${key}: ${valStr}`)
              }
              if (displayParts.length > 0) return displayParts.join(' | ')
         } else if (typeof row.metadata === 'string') {
@@ -922,10 +917,8 @@ const formatMetaInfo = (row: Snippet) => {
                 const metaObj = JSON.parse(row.metadata)
                 const displayParts = []
                 for (const [key, value] of Object.entries(metaObj)) {
-                    if (!['doc_name', 'file_name', 'title'].includes(key)) {
-                        const valStr = typeof value === 'object' ? JSON.stringify(value) : String(value)
-                        displayParts.push(`${key}: ${valStr}`)
-                    }
+                    const valStr = typeof value === 'object' ? JSON.stringify(value) : String(value)
+                    displayParts.push(`${key}: ${valStr}`)
                 }
                 if (displayParts.length > 0) return displayParts.join(' | ')
             } catch (e) {

+ 4 - 8
src/views/documents/SearchEngine.vue

@@ -397,10 +397,8 @@ const formatMetaInfo = (row: any) => {
         if (typeof row.metadata === 'object') {
              const displayParts = []
              for (const [key, value] of Object.entries(row.metadata)) {
-                 if (!['doc_name', 'file_name', 'title', 'vector'].includes(key)) { // 排除 vector
-                     const valStr = typeof value === 'object' ? JSON.stringify(value) : String(value)
-                     displayParts.push(`${key}: ${valStr}`)
-                 }
+                 const valStr = typeof value === 'object' ? JSON.stringify(value) : String(value)
+                 displayParts.push(`${key}: ${valStr}`)
              }
              if (displayParts.length > 0) return displayParts.join(' | ')
         } else if (typeof row.metadata === 'string') {
@@ -408,10 +406,8 @@ const formatMetaInfo = (row: any) => {
                 const metaObj = JSON.parse(row.metadata)
                 const displayParts = []
                 for (const [key, value] of Object.entries(metaObj)) {
-                    if (!['doc_name', 'file_name', 'title', 'vector'].includes(key)) { // 排除 vector
-                        const valStr = typeof value === 'object' ? JSON.stringify(value) : String(value)
-                        displayParts.push(`${key}: ${valStr}`)
-                    }
+                    const valStr = typeof value === 'object' ? JSON.stringify(value) : String(value)
+                    displayParts.push(`${key}: ${valStr}`)
                 }
                 if (displayParts.length > 0) return displayParts.join(' | ')
             } catch (e) {