Showing
1 changed file
with
11 additions
and
10 deletions
| @@ -240,6 +240,9 @@ class ReportAgent: | @@ -240,6 +240,9 @@ class ReportAgent: | ||
| 240 | # 状态 | 240 | # 状态 |
| 241 | self.state = ReportState() | 241 | self.state = ReportState() |
| 242 | 242 | ||
| 243 | + # GraphRAG 状态数据(每次 load_input_files 时重置) | ||
| 244 | + self._loaded_states = {} | ||
| 245 | + | ||
| 243 | # 确保输出目录存在 | 246 | # 确保输出目录存在 |
| 244 | os.makedirs(self.config.OUTPUT_DIR, exist_ok=True) | 247 | os.makedirs(self.config.OUTPUT_DIR, exist_ok=True) |
| 245 | os.makedirs(self.config.DOCUMENT_IR_OUTPUT_DIR, exist_ok=True) | 248 | os.makedirs(self.config.DOCUMENT_IR_OUTPUT_DIR, exist_ok=True) |
| @@ -901,16 +904,14 @@ class ReportAgent: | @@ -901,16 +904,14 @@ class ReportAgent: | ||
| 901 | Graph: 构建好的知识图谱;失败返回 None。 | 904 | Graph: 构建好的知识图谱;失败返回 None。 |
| 902 | """ | 905 | """ |
| 903 | try: | 906 | try: |
| 904 | - # 解析 State JSON(如果在 load_input_files 时已加载) | ||
| 905 | - states = {} | ||
| 906 | - state_parser = StateParser() | ||
| 907 | - | ||
| 908 | - # 尝试从 reports 目录查找 State JSON | ||
| 909 | - # 注意:这里假设 reports 字典的键对应引擎目录 | ||
| 910 | - for engine in ['insight', 'media', 'query']: | ||
| 911 | - # 尝试从全局状态获取(如果之前已加载) | ||
| 912 | - if hasattr(self, '_loaded_states') and engine in self._loaded_states: | ||
| 913 | - states[engine] = self._loaded_states[engine] | 907 | + # 直接使用 load_input_files 中加载的 State JSON |
| 908 | + # 注意:_loaded_states 在每次 load_input_files 调用时会被重置, | ||
| 909 | + # 确保不会有跨任务的数据泄漏 | ||
| 910 | + states = { | ||
| 911 | + engine: state | ||
| 912 | + for engine, state in self._loaded_states.items() | ||
| 913 | + if engine in ['insight', 'media', 'query'] | ||
| 914 | + } | ||
| 914 | 915 | ||
| 915 | # 解析论坛日志 | 916 | # 解析论坛日志 |
| 916 | forum_entries = [] | 917 | forum_entries = [] |
-
Please register or login to post a comment