|
|
@@ -96,15 +96,23 @@ class PromptRetrievalNode(BaseNode):
|
|
|
# 从temp目录下读取preceding_node中包含的markdown文件获取content列表
|
|
|
content = []
|
|
|
for node in preceding_node:
|
|
|
- current_content = ""
|
|
|
- with open(f"temp/{original_filename}_{node}.md", "r", encoding="utf-8") as f:
|
|
|
- current_content = f.read()
|
|
|
- content.append(current_content)
|
|
|
+ try:
|
|
|
+ current_content = ""
|
|
|
+ with open(f"temp/{original_filename}_{node}.md", "r", encoding="utf-8") as f:
|
|
|
+ current_content = f.read()
|
|
|
+ if current_content:
|
|
|
+ content.append(current_content)
|
|
|
+ except FileNotFoundError:
|
|
|
+ logger.warning(f"[Prompt-{self.dimension_id}] 未找到文件: temp/{original_filename}_{node}.md,跳过")
|
|
|
+ continue
|
|
|
+ except Exception as e:
|
|
|
+ logger.error(f"[Prompt-{self.dimension_id}] 读取文件时出错: {str(e)},跳过")
|
|
|
+ continue
|
|
|
|
|
|
# 判断content是否为空
|
|
|
if not content:
|
|
|
logger.info(f"[Prompt-{self.dimension_id}] preceding_node中没有内容")
|
|
|
- return dimension_prompt
|
|
|
+ return prompt_template.format(content="")
|
|
|
|
|
|
chat_model = QWenVLParser()
|
|
|
# 使用大语言模型对content列表中的content进行整合、压缩
|