fix: 优化markdown解析器
This commit is contained in:
@@ -102,7 +102,8 @@ export const EnhancedMarkdownRenderer: React.FC<EnhancedMarkdownRendererProps> =
|
||||
// 计算节点在原始文本中的字节偏移位置(与grounding数据的字节偏移匹配)
|
||||
const nodeStartOffset = node.range?.start?.byte_offset || 0;
|
||||
const nodeEndOffset = node.range?.end?.byte_offset || 0;
|
||||
|
||||
const nodeStartOffset1 = node.range?.start?.offset || 0;
|
||||
const nodeEndOffset1 = node.range?.end?.offset || 0;
|
||||
// 查找与当前节点位置重叠的grounding支持信息
|
||||
const relatedSupports = groundingMetadata.grounding_supports.filter(support => {
|
||||
// grounding数据使用字节偏移
|
||||
@@ -116,7 +117,9 @@ export const EnhancedMarkdownRenderer: React.FC<EnhancedMarkdownRendererProps> =
|
||||
console.log({
|
||||
relatedSupports,
|
||||
nodeStartOffset,
|
||||
nodeEndOffset
|
||||
nodeEndOffset,
|
||||
nodeStartOffset1,
|
||||
nodeEndOffset1
|
||||
})
|
||||
if (relatedSupports.length > 0) {
|
||||
// 获取相关的来源信息
|
||||
|
||||
Reference in New Issue
Block a user