From c4a51e2583826988a5a07ad9b74c3e6caf58540a Mon Sep 17 00:00:00 2001 From: ranxia Date: Fri, 17 Jan 2025 18:07:14 +0800 Subject: [PATCH] fix image_url --- .../integrations/nodeparsers/pai/pai_markdown_parser.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pai_rag/integrations/nodeparsers/pai/pai_markdown_parser.py b/src/pai_rag/integrations/nodeparsers/pai/pai_markdown_parser.py index 5c5793f4..0d202bcf 100644 --- a/src/pai_rag/integrations/nodeparsers/pai/pai_markdown_parser.py +++ b/src/pai_rag/integrations/nodeparsers/pai/pai_markdown_parser.py @@ -1,7 +1,6 @@ """Markdown node parser.""" from llama_index.core.bridge.pydantic import Field, BaseModel from typing import Any, Iterator, List, Optional, Sequence -import json from llama_index.core.node_parser.interface import NodeParser from llama_index.core.node_parser import SentenceSplitter @@ -88,7 +87,7 @@ def _format_tree_nodes( ) nodes_list.append(image_node) image_info = ImageInfo(image_url=node.content) - chunk_images_list.append(json.dumps(image_info.__dict__)) + chunk_images_list.append(image_info.__dict__) return "" if not node.children: return node.content @@ -249,7 +248,7 @@ def traverse_tree( ) nodes_list.append(image_node) image_info = ImageInfo(image_url=child.content) - chunk_images_list.append(json.dumps(image_info.__dict__)) + chunk_images_list.append(image_info.__dict__) else: chunk_text += "\n" + self._format_tree_nodes( child, doc_node, ref_doc, nodes_list, chunk_images_list