|
@@ -905,15 +905,10 @@ const formatMetaInfo = (row: Snippet) => {
|
|
|
if (row.metadata) {
|
|
if (row.metadata) {
|
|
|
// 如果是 JSON 对象,尝试格式化展示
|
|
// 如果是 JSON 对象,尝试格式化展示
|
|
|
if (typeof row.metadata === 'object') {
|
|
if (typeof row.metadata === 'object') {
|
|
|
- // 排除一些不需要展示的字段,如 doc_name, file_name, title (因为已有单独列)
|
|
|
|
|
const displayParts = []
|
|
const displayParts = []
|
|
|
for (const [key, value] of Object.entries(row.metadata)) {
|
|
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(' | ')
|
|
if (displayParts.length > 0) return displayParts.join(' | ')
|
|
|
} else if (typeof row.metadata === 'string') {
|
|
} else if (typeof row.metadata === 'string') {
|
|
@@ -922,10 +917,8 @@ const formatMetaInfo = (row: Snippet) => {
|
|
|
const metaObj = JSON.parse(row.metadata)
|
|
const metaObj = JSON.parse(row.metadata)
|
|
|
const displayParts = []
|
|
const displayParts = []
|
|
|
for (const [key, value] of Object.entries(metaObj)) {
|
|
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(' | ')
|
|
if (displayParts.length > 0) return displayParts.join(' | ')
|
|
|
} catch (e) {
|
|
} catch (e) {
|