352 KiB
352 KiB
| 1 | file | line | match | class | category | pipeline_step |
|---|---|---|---|---|---|---|
| 2 | backend/app/__init__.py | 2 | MiroFish Backend - Flask应用工厂 | deliberate | backend-docstring | n/a |
| 3 | backend/app/__init__.py | 8 | # 抑制 multiprocessing resource_tracker 的警告(来自第三方库如 transformers) | deliberate | backend-comment | n/a |
| 4 | backend/app/__init__.py | 9 | # 需要在所有其他导入之前设置 | deliberate | backend-comment | n/a |
| 5 | backend/app/__init__.py | 21 | """Flask应用工厂函数""" | deliberate | backend-docstring | n/a |
| 6 | backend/app/__init__.py | 25 | # 设置JSON编码:确保中文直接显示(而不是 \uXXXX 格式) | deliberate | backend-comment | n/a |
| 7 | backend/app/__init__.py | 26 | # Flask >= 2.3 使用 app.json.ensure_ascii,旧版本使用 JSON_AS_ASCII 配置 | deliberate | backend-comment | n/a |
| 8 | backend/app/__init__.py | 30 | # 设置日志 | deliberate | backend-comment | n/a |
| 9 | backend/app/__init__.py | 33 | # 只在 reloader 子进程中打印启动信息(避免 debug 模式下打印两次) | deliberate | backend-comment | n/a |
| 10 | backend/app/__init__.py | 43 | # 启用CORS | deliberate | backend-comment | n/a |
| 11 | backend/app/__init__.py | 46 | # 注册模拟进程清理函数(确保服务器关闭时终止所有模拟进程) | deliberate | backend-comment | n/a |
| 12 | backend/app/__init__.py | 52 | # 请求日志中间件 | deliberate | backend-comment | n/a |
| 13 | backend/app/__init__.py | 66 | # 注册蓝图 | deliberate | backend-comment | n/a |
| 14 | backend/app/__init__.py | 72 | # 健康检查 | deliberate | backend-comment | n/a |
| 15 | backend/app/api/__init__.py | 2 | API路由模块 | deliberate | backend-docstring | n/a |
| 16 | backend/app/api/graph.py | 2 | 图谱相关API路由 | deliberate | backend-docstring | Graph Build |
| 17 | backend/app/api/graph.py | 3 | 采用项目上下文机制,服务端持久化状态 | deliberate | backend-docstring | Graph Build |
| 18 | backend/app/api/graph.py | 29 | # 获取日志器 | deliberate | backend-comment | Graph Build |
| 19 | backend/app/api/graph.py | 34 | """检查文件扩展名是否允许""" | deliberate | backend-docstring | Graph Build |
| 20 | backend/app/api/graph.py | 41 | # ============== 项目管理接口 ============== | deliberate | backend-comment | Graph Build |
| 21 | backend/app/api/graph.py | 46 | 获取项目详情 | deliberate | backend-docstring | Graph Build |
| 22 | backend/app/api/graph.py | 65 | 列出所有项目 | deliberate | backend-docstring | Graph Build |
| 23 | backend/app/api/graph.py | 80 | 删除项目 | deliberate | backend-docstring | Graph Build |
| 24 | backend/app/api/graph.py | 99 | 重置项目状态(用于重新构建图谱) | deliberate | backend-docstring | Graph Build |
| 25 | backend/app/api/graph.py | 109 | # 重置到本体已生成状态 | deliberate | backend-comment | Graph Build |
| 26 | backend/app/api/graph.py | 127 | # ============== 接口1:上传文件并生成本体 ============== | deliberate | backend-comment | Graph Build |
| 27 | backend/app/api/graph.py | 132 | 接口1:上传文件,分析生成本体定义 | deliberate | backend-docstring | Graph Build |
| 28 | backend/app/api/graph.py | 134 | 请求方式:multipart/form-data | deliberate | backend-docstring | Graph Build |
| 29 | backend/app/api/graph.py | 136 | 参数: | deliberate | backend-docstring | Graph Build |
| 30 | backend/app/api/graph.py | 137 | files: 上传的文件(PDF/MD/TXT),可多个 | deliberate | backend-docstring | Graph Build |
| 31 | backend/app/api/graph.py | 138 | simulation_requirement: 模拟需求描述(必填) | deliberate | backend-docstring | Graph Build |
| 32 | backend/app/api/graph.py | 139 | project_name: 项目名称(可选) | deliberate | backend-docstring | Graph Build |
| 33 | backend/app/api/graph.py | 140 | additional_context: 额外说明(可选) | deliberate | backend-docstring | Graph Build |
| 34 | backend/app/api/graph.py | 142 | 返回: | deliberate | backend-docstring | Graph Build |
| 35 | backend/app/api/graph.py | 160 | # 获取参数 | deliberate | backend-comment | Graph Build |
| 36 | backend/app/api/graph.py | 174 | # 获取上传的文件 | deliberate | backend-comment | Graph Build |
| 37 | backend/app/api/graph.py | 182 | # 创建项目 | deliberate | backend-comment | Graph Build |
| 38 | backend/app/api/graph.py | 187 | # 保存文件并提取文本 | deliberate | backend-comment | Graph Build |
| 39 | backend/app/api/graph.py | 193 | # 保存文件到项目目录 | deliberate | backend-comment | Graph Build |
| 40 | backend/app/api/graph.py | 204 | # 提取文本 | deliberate | backend-comment | Graph Build |
| 41 | backend/app/api/graph.py | 217 | # 保存提取的文本 | deliberate | backend-comment | Graph Build |
| 42 | backend/app/api/graph.py | 222 | # 生成本体 | deliberate | backend-comment | Graph Build |
| 43 | backend/app/api/graph.py | 231 | # 保存本体到项目 | deliberate | backend-comment | Graph Build |
| 44 | backend/app/api/graph.py | 265 | # ============== 接口2:构建图谱 ============== | deliberate | backend-comment | Graph Build |
| 45 | backend/app/api/graph.py | 270 | 接口2:根据project_id构建图谱 | deliberate | backend-docstring | Graph Build |
| 46 | backend/app/api/graph.py | 272 | 请求(JSON): | deliberate | backend-docstring | Graph Build |
| 47 | backend/app/api/graph.py | 274 | "project_id": "proj_xxxx", // 必填,来自接口1 | review-needed | backend-string | Graph Build |
| 48 | backend/app/api/graph.py | 275 | "graph_name": "图谱名称", // 可选 | review-needed | backend-string | Graph Build |
| 49 | backend/app/api/graph.py | 276 | "chunk_size": 500, // 可选,默认500 | review-needed | backend-string | Graph Build |
| 50 | backend/app/api/graph.py | 277 | "chunk_overlap": 50 // 可选,默认50 | review-needed | backend-string | Graph Build |
| 51 | backend/app/api/graph.py | 280 | 返回: | deliberate | backend-docstring | Graph Build |
| 52 | backend/app/api/graph.py | 286 | "message": "图谱构建任务已启动" | review-needed | backend-string | Graph Build |
| 53 | backend/app/api/graph.py | 293 | # 检查配置 | deliberate | backend-comment | Graph Build |
| 54 | backend/app/api/graph.py | 296 | errors.append("NEO4J未配置") | review-needed | backend-string | Graph Build |
| 55 | backend/app/api/graph.py | 301 | "error": "配置错误: " + "; ".join(errors) | review-needed | backend-string | Graph Build |
| 56 | backend/app/api/graph.py | 304 | # 解析请求 | deliberate | backend-comment | Graph Build |
| 57 | backend/app/api/graph.py | 315 | # 获取项目 | deliberate | backend-comment | Graph Build |
| 58 | backend/app/api/graph.py | 323 | # 检查项目状态 | deliberate | backend-comment | Graph Build |
| 59 | backend/app/api/graph.py | 324 | force = data.get('force', False) # 强制重新构建 | review-needed | backend-string | Graph Build |
| 60 | backend/app/api/graph.py | 339 | # 如果强制重建,重置状态 | deliberate | backend-comment | Graph Build |
| 61 | backend/app/api/graph.py | 346 | # 获取配置 | deliberate | backend-comment | Graph Build |
| 62 | backend/app/api/graph.py | 351 | # 更新项目配置 | deliberate | backend-comment | Graph Build |
| 63 | backend/app/api/graph.py | 355 | # 获取提取的文本 | deliberate | backend-comment | Graph Build |
| 64 | backend/app/api/graph.py | 363 | # 获取本体 | deliberate | backend-comment | Graph Build |
| 65 | backend/app/api/graph.py | 371 | # 创建异步任务 | deliberate | backend-comment | Graph Build |
| 66 | backend/app/api/graph.py | 373 | task_id = task_manager.create_task(f"构建图谱: {graph_name}") | review-needed | backend-string | Graph Build |
| 67 | backend/app/api/graph.py | 376 | # 更新项目状态 | deliberate | backend-comment | Graph Build |
| 68 | backend/app/api/graph.py | 381 | # 启动后台任务 | deliberate | backend-comment | Graph Build |
| 69 | backend/app/api/graph.py | 385 | build_logger.info(f"[{task_id}] 开始构建图谱...") | gap | backend-log | Logs |
| 70 | backend/app/api/graph.py | 389 | message="初始化图谱构建服务..." | review-needed | backend-string | Graph Build |
| 71 | backend/app/api/graph.py | 392 | # 创建图谱构建服务 | deliberate | backend-comment | Graph Build |
| 72 | backend/app/api/graph.py | 395 | # 分块 | deliberate | backend-comment | Graph Build |
| 73 | backend/app/api/graph.py | 398 | message="文本分块中...", | review-needed | backend-string | Graph Build |
| 74 | backend/app/api/graph.py | 408 | # 创建图谱 | deliberate | backend-comment | Graph Build |
| 75 | backend/app/api/graph.py | 411 | message="创建Zep图谱...", | review-needed | backend-string | Graph Build |
| 76 | backend/app/api/graph.py | 416 | # 更新项目的graph_id | deliberate | backend-comment | Graph Build |
| 77 | backend/app/api/graph.py | 420 | # 设置本体 | deliberate | backend-comment | Graph Build |
| 78 | backend/app/api/graph.py | 423 | message="设置本体定义...", | review-needed | backend-string | Graph Build |
| 79 | backend/app/api/graph.py | 428 | # 添加文本(progress_callback 签名是 (msg, progress_ratio)) | deliberate | backend-comment | Graph Build |
| 80 | backend/app/api/graph.py | 451 | msg_start = (f"断点续传:跳过 {skip_chunks} 个已处理块,继续处理 {remaining} 块..." | review-needed | backend-string | Graph Build |
| 81 | backend/app/api/graph.py | 452 | if skip_chunks > 0 else f"开始添加 {total_chunks} 个文本块...") | review-needed | backend-string | Graph Build |
| 82 | backend/app/api/graph.py | 463 | # 等待Zep处理完成(查询每个episode的processed状态) | deliberate | backend-comment | Graph Build |
| 83 | backend/app/api/graph.py | 466 | message="等待Zep处理数据...", | review-needed | backend-string | Graph Build |
| 84 | backend/app/api/graph.py | 480 | # 获取图谱数据 | deliberate | backend-comment | Graph Build |
| 85 | backend/app/api/graph.py | 483 | message="获取图谱数据...", | review-needed | backend-string | Graph Build |
| 86 | backend/app/api/graph.py | 488 | # 更新项目状态 | deliberate | backend-comment | Graph Build |
| 87 | backend/app/api/graph.py | 494 | build_logger.info(f"[{task_id}] 图谱构建完成: graph_id={graph_id}, 节点={node_count}, 边={edge_count}") | gap | backend-log | Logs |
| 88 | backend/app/api/graph.py | 496 | # 完成 | deliberate | backend-comment | Graph Build |
| 89 | backend/app/api/graph.py | 500 | message="图谱构建完成", | review-needed | backend-string | Graph Build |
| 90 | backend/app/api/graph.py | 512 | # 更新项目状态为失败 | deliberate | backend-comment | Graph Build |
| 91 | backend/app/api/graph.py | 513 | build_logger.error(f"[{task_id}] 图谱构建失败: {str(e)}") | gap | backend-log | Logs |
| 92 | backend/app/api/graph.py | 523 | message=f"构建失败: {str(e)}", | review-needed | backend-string | Graph Build |
| 93 | backend/app/api/graph.py | 527 | # 启动后台线程 | deliberate | backend-comment | Graph Build |
| 94 | backend/app/api/graph.py | 536 | "message": "图谱构建任务已启动,请通过 /task/{task_id} 查询进度" | review-needed | backend-string | Graph Build |
| 95 | backend/app/api/graph.py | 548 | # ============== 任务查询接口 ============== | deliberate | backend-comment | Graph Build |
| 96 | backend/app/api/graph.py | 553 | 查询任务状态 | deliberate | backend-docstring | Graph Build |
| 97 | backend/app/api/graph.py | 572 | 列出所有任务 | deliberate | backend-docstring | Graph Build |
| 98 | backend/app/api/graph.py | 583 | # ============== 图谱数据接口 ============== | deliberate | backend-comment | Graph Build |
| 99 | backend/app/api/graph.py | 611 | 获取图谱数据(节点和边)。 | deliberate | backend-docstring | Graph Build |
| 100 | backend/app/api/graph.py | 612 | - 有缓存且未过期:直接返回缓存,不调用 Zep | deliberate | backend-docstring | Graph Build |
| 101 | backend/app/api/graph.py | 613 | - 有缓存但已过期:立即返回旧缓存,后台异步刷新 | deliberate | backend-docstring | Graph Build |
| 102 | backend/app/api/graph.py | 614 | - 无缓存:后台线程拉取,返回 202 让前端稍后重试 | deliberate | backend-docstring | Graph Build |
| 103 | backend/app/api/graph.py | 643 | 删除Zep图谱 | deliberate | backend-docstring | Graph Build |
| 104 | backend/app/api/report.py | 2 | Report API路由 | deliberate | backend-docstring | n/a |
| 105 | backend/app/api/report.py | 3 | 提供模拟报告生成、获取、对话等接口 | deliberate | backend-docstring | n/a |
| 106 | backend/app/api/report.py | 23 | # ============== 报告生成接口 ============== | deliberate | backend-comment | n/a |
| 107 | backend/app/api/report.py | 28 | 生成模拟分析报告(异步任务) | deliberate | backend-docstring | n/a |
| 108 | backend/app/api/report.py | 30 | 这是一个耗时操作,接口会立即返回task_id, | deliberate | backend-docstring | n/a |
| 109 | backend/app/api/report.py | 31 | 使用 GET /api/report/generate/status 查询进度 | deliberate | backend-docstring | n/a |
| 110 | backend/app/api/report.py | 33 | 请求(JSON): | deliberate | backend-docstring | n/a |
| 111 | backend/app/api/report.py | 35 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | n/a |
| 112 | backend/app/api/report.py | 36 | "force_regenerate": false // 可选,强制重新生成 | review-needed | backend-string | n/a |
| 113 | backend/app/api/report.py | 39 | 返回: | deliberate | backend-docstring | n/a |
| 114 | backend/app/api/report.py | 46 | "message": "报告生成任务已启动" | review-needed | backend-string | n/a |
| 115 | backend/app/api/report.py | 62 | # 获取模拟信息 | deliberate | backend-comment | n/a |
| 116 | backend/app/api/report.py | 72 | # 检查是否已有报告 | deliberate | backend-comment | n/a |
| 117 | backend/app/api/report.py | 87 | # 获取项目信息 | deliberate | backend-comment | n/a |
| 118 | backend/app/api/report.py | 109 | # 提前生成 report_id,以便立即返回给前端 | deliberate | backend-comment | n/a |
| 119 | backend/app/api/report.py | 113 | # 创建异步任务 | deliberate | backend-comment | n/a |
| 120 | backend/app/api/report.py | 127 | # 定义后台任务 | deliberate | backend-comment | n/a |
| 121 | backend/app/api/report.py | 138 | # 创建Report Agent | deliberate | backend-comment | n/a |
| 122 | backend/app/api/report.py | 145 | # 进度回调 | deliberate | backend-comment | n/a |
| 123 | backend/app/api/report.py | 153 | # 生成报告(传入预先生成的 report_id) | deliberate | backend-comment | n/a |
| 124 | backend/app/api/report.py | 159 | # 保存报告 | deliberate | backend-comment | n/a |
| 125 | backend/app/api/report.py | 178 | # 启动后台线程 | deliberate | backend-comment | n/a |
| 126 | backend/app/api/report.py | 206 | 查询报告生成任务进度 | deliberate | backend-docstring | n/a |
| 127 | backend/app/api/report.py | 208 | 请求(JSON): | deliberate | backend-docstring | n/a |
| 128 | backend/app/api/report.py | 210 | "task_id": "task_xxxx", // 可选,generate返回的task_id | review-needed | backend-string | n/a |
| 129 | backend/app/api/report.py | 211 | "simulation_id": "sim_xxxx" // 可选,模拟ID | review-needed | backend-string | n/a |
| 130 | backend/app/api/report.py | 214 | 返回: | deliberate | backend-docstring | n/a |
| 131 | backend/app/api/report.py | 231 | # 如果提供了simulation_id,先检查是否已有完成的报告 | deliberate | backend-comment | n/a |
| 132 | backend/app/api/report.py | 275 | # ============== 报告获取接口 ============== | deliberate | backend-comment | n/a |
| 133 | backend/app/api/report.py | 280 | 获取报告详情 | deliberate | backend-docstring | n/a |
| 134 | backend/app/api/report.py | 282 | 返回: | deliberate | backend-docstring | n/a |
| 135 | backend/app/api/report.py | 322 | 根据模拟ID获取报告 | deliberate | backend-docstring | n/a |
| 136 | backend/app/api/report.py | 324 | 返回: | deliberate | backend-docstring | n/a |
| 137 | backend/app/api/report.py | 361 | 列出所有报告 | deliberate | backend-docstring | n/a |
| 138 | backend/app/api/report.py | 363 | Query参数: | deliberate | backend-docstring | n/a |
| 139 | backend/app/api/report.py | 364 | simulation_id: 按模拟ID过滤(可选) | deliberate | backend-docstring | n/a |
| 140 | backend/app/api/report.py | 365 | limit: 返回数量限制(默认50) | deliberate | backend-docstring | n/a |
| 141 | backend/app/api/report.py | 367 | 返回: | deliberate | backend-docstring | n/a |
| 142 | backend/app/api/report.py | 401 | 下载报告(Markdown格式) | deliberate | backend-docstring | n/a |
| 143 | backend/app/api/report.py | 403 | 返回Markdown文件 | deliberate | backend-docstring | n/a |
| 144 | backend/app/api/report.py | 417 | # 如果MD文件不存在,生成一个临时文件 | deliberate | backend-comment | n/a |
| 145 | backend/app/api/report.py | 446 | """删除报告""" | deliberate | backend-docstring | n/a |
| 146 | backend/app/api/report.py | 470 | # ============== Report Agent对话接口 ============== | deliberate | backend-comment | n/a |
| 147 | backend/app/api/report.py | 475 | 与Report Agent对话 | deliberate | backend-docstring | n/a |
| 148 | backend/app/api/report.py | 477 | Report Agent可以在对话中自主调用检索工具来回答问题 | deliberate | backend-docstring | n/a |
| 149 | backend/app/api/report.py | 479 | 请求(JSON): | deliberate | backend-docstring | n/a |
| 150 | backend/app/api/report.py | 481 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | n/a |
| 151 | backend/app/api/report.py | 482 | "message": "请解释一下舆情走向", // 必填,用户消息 | review-needed | backend-string | n/a |
| 152 | backend/app/api/report.py | 483 | "chat_history": [ // 可选,对话历史 | review-needed | backend-string | n/a |
| 153 | backend/app/api/report.py | 489 | 返回: | deliberate | backend-docstring | n/a |
| 154 | backend/app/api/report.py | 493 | "response": "Agent回复...", | review-needed | backend-string | n/a |
| 155 | backend/app/api/report.py | 494 | "tool_calls": [调用的工具列表], | review-needed | backend-string | n/a |
| 156 | backend/app/api/report.py | 495 | "sources": [信息来源] | review-needed | backend-string | n/a |
| 157 | backend/app/api/report.py | 518 | # 获取模拟和项目信息 | deliberate | backend-comment | n/a |
| 158 | backend/app/api/report.py | 544 | # 创建Agent并进行对话 | deliberate | backend-comment | n/a |
| 159 | backend/app/api/report.py | 567 | # ============== 报告进度与分章节接口 ============== | deliberate | backend-comment | n/a |
| 160 | backend/app/api/report.py | 572 | 获取报告生成进度(实时) | deliberate | backend-docstring | n/a |
| 161 | backend/app/api/report.py | 574 | 返回: | deliberate | backend-docstring | n/a |
| 162 | backend/app/api/report.py | 580 | "message": "正在生成章节: 关键发现", | review-needed | backend-string | n/a |
| 163 | backend/app/api/report.py | 581 | "current_section": "关键发现", | review-needed | backend-string | n/a |
| 164 | backend/app/api/report.py | 582 | "completed_sections": ["执行摘要", "模拟背景"], | review-needed | backend-string | n/a |
| 165 | backend/app/api/report.py | 613 | 获取已生成的章节列表(分章节输出) | deliberate | backend-docstring | n/a |
| 166 | backend/app/api/report.py | 615 | 前端可以轮询此接口获取已生成的章节内容,无需等待整个报告完成 | deliberate | backend-docstring | n/a |
| 167 | backend/app/api/report.py | 617 | 返回: | deliberate | backend-docstring | n/a |
| 168 | backend/app/api/report.py | 626 | "content": "## 执行摘要\\n\\n..." | review-needed | backend-string | n/a |
| 169 | backend/app/api/report.py | 638 | # 获取报告状态 | deliberate | backend-comment | n/a |
| 170 | backend/app/api/report.py | 664 | 获取单个章节内容 | deliberate | backend-docstring | n/a |
| 171 | backend/app/api/report.py | 666 | 返回: | deliberate | backend-docstring | n/a |
| 172 | backend/app/api/report.py | 671 | "content": "## 执行摘要\\n\\n..." | review-needed | backend-string | n/a |
| 173 | backend/app/api/report.py | 705 | # ============== 报告状态检查接口 ============== | deliberate | backend-comment | n/a |
| 174 | backend/app/api/report.py | 710 | 检查模拟是否有报告,以及报告状态 | deliberate | backend-docstring | n/a |
| 175 | backend/app/api/report.py | 712 | 用于前端判断是否解锁Interview功能 | deliberate | backend-docstring | n/a |
| 176 | backend/app/api/report.py | 714 | 返回: | deliberate | backend-docstring | n/a |
| 177 | backend/app/api/report.py | 733 | # 只有报告完成后才解锁interview | deliberate | backend-comment | n/a |
| 178 | backend/app/api/report.py | 756 | # ============== Agent 日志接口 ============== | deliberate | backend-comment | n/a |
| 179 | backend/app/api/report.py | 761 | 获取 Report Agent 的详细执行日志 | deliberate | backend-docstring | n/a |
| 180 | backend/app/api/report.py | 763 | 实时获取报告生成过程中的每一步动作,包括: | deliberate | backend-docstring | n/a |
| 181 | backend/app/api/report.py | 764 | - 报告开始、规划开始/完成 | deliberate | backend-docstring | n/a |
| 182 | backend/app/api/report.py | 765 | - 每个章节的开始、工具调用、LLM响应、完成 | deliberate | backend-docstring | n/a |
| 183 | backend/app/api/report.py | 766 | - 报告完成或失败 | deliberate | backend-docstring | n/a |
| 184 | backend/app/api/report.py | 768 | Query参数: | deliberate | backend-docstring | n/a |
| 185 | backend/app/api/report.py | 769 | from_line: 从第几行开始读取(可选,默认0,用于增量获取) | deliberate | backend-docstring | n/a |
| 186 | backend/app/api/report.py | 771 | 返回: | deliberate | backend-docstring | n/a |
| 187 | backend/app/api/report.py | 782 | "section_title": "执行摘要", | review-needed | backend-string | n/a |
| 188 | backend/app/api/report.py | 820 | 获取完整的 Agent 日志(一次性获取全部) | deliberate | backend-docstring | n/a |
| 189 | backend/app/api/report.py | 822 | 返回: | deliberate | backend-docstring | n/a |
| 190 | backend/app/api/report.py | 851 | # ============== 控制台日志接口 ============== | deliberate | backend-comment | n/a |
| 191 | backend/app/api/report.py | 856 | 获取 Report Agent 的控制台输出日志 | deliberate | backend-docstring | n/a |
| 192 | backend/app/api/report.py | 858 | 实时获取报告生成过程中的控制台输出(INFO、WARNING等), | deliberate | backend-docstring | n/a |
| 193 | backend/app/api/report.py | 859 | 这与 agent-log 接口返回的结构化 JSON 日志不同, | deliberate | backend-docstring | n/a |
| 194 | backend/app/api/report.py | 860 | 是纯文本格式的控制台风格日志。 | deliberate | backend-docstring | n/a |
| 195 | backend/app/api/report.py | 862 | Query参数: | deliberate | backend-docstring | n/a |
| 196 | backend/app/api/report.py | 863 | from_line: 从第几行开始读取(可选,默认0,用于增量获取) | deliberate | backend-docstring | n/a |
| 197 | backend/app/api/report.py | 865 | 返回: | deliberate | backend-docstring | n/a |
| 198 | backend/app/api/report.py | 870 | "[19:46:14] INFO: 搜索完成: 找到 15 条相关事实", | review-needed | backend-string | n/a |
| 199 | backend/app/api/report.py | 871 | "[19:46:14] INFO: 图谱搜索: graph_id=xxx, query=...", | review-needed | backend-string | n/a |
| 200 | backend/app/api/report.py | 902 | 获取完整的控制台日志(一次性获取全部) | deliberate | backend-docstring | n/a |
| 201 | backend/app/api/report.py | 904 | 返回: | deliberate | backend-docstring | n/a |
| 202 | backend/app/api/report.py | 933 | # ============== 工具调用接口(供调试使用)============== | deliberate | backend-comment | n/a |
| 203 | backend/app/api/report.py | 938 | 图谱搜索工具接口(供调试使用) | deliberate | backend-docstring | n/a |
| 204 | backend/app/api/report.py | 940 | 请求(JSON): | deliberate | backend-docstring | n/a |
| 205 | backend/app/api/report.py | 943 | "query": "搜索查询", | review-needed | backend-string | n/a |
| 206 | backend/app/api/report.py | 986 | 图谱统计工具接口(供调试使用) | deliberate | backend-docstring | n/a |
| 207 | backend/app/api/report.py | 988 | 请求(JSON): | deliberate | backend-docstring | n/a |
| 208 | backend/app/api/simulation.py | 2 | 模拟相关API路由 | deliberate | backend-docstring | Simulation |
| 209 | backend/app/api/simulation.py | 3 | Step2: Zep实体读取与过滤、OASIS模拟准备与运行(全程自动化) | deliberate | backend-docstring | Simulation |
| 210 | backend/app/api/simulation.py | 23 | # Interview prompt 优化前缀 | deliberate | backend-comment | Simulation |
| 211 | backend/app/api/simulation.py | 24 | # 添加此前缀可以避免Agent调用工具,直接用文本回复 | deliberate | backend-comment | Simulation |
| 212 | backend/app/api/simulation.py | 25 | INTERVIEW_PROMPT_PREFIX = "结合你的人设、所有的过往记忆与行动,不调用任何工具直接用文本回复我:" | review-needed | backend-string | Simulation |
| 213 | backend/app/api/simulation.py | 30 | 优化Interview提问,添加前缀避免Agent调用工具 | deliberate | backend-docstring | Simulation |
| 214 | backend/app/api/simulation.py | 33 | prompt: 原始提问 | deliberate | backend-docstring | Simulation |
| 215 | backend/app/api/simulation.py | 36 | 优化后的提问 | deliberate | backend-docstring | Simulation |
| 216 | backend/app/api/simulation.py | 40 | # 避免重复添加前缀 | deliberate | backend-comment | Simulation |
| 217 | backend/app/api/simulation.py | 46 | # ============== 实体读取接口 ============== | deliberate | backend-comment | Simulation |
| 218 | backend/app/api/simulation.py | 51 | 获取图谱中的所有实体(已过滤) | deliberate | backend-docstring | Simulation |
| 219 | backend/app/api/simulation.py | 53 | 只返回符合预定义实体类型的节点(Labels不只是Entity的节点) | deliberate | backend-docstring | Simulation |
| 220 | backend/app/api/simulation.py | 55 | Query参数: | deliberate | backend-docstring | Simulation |
| 221 | backend/app/api/simulation.py | 56 | entity_types: 逗号分隔的实体类型列表(可选,用于进一步过滤) | deliberate | backend-docstring | Simulation |
| 222 | backend/app/api/simulation.py | 57 | enrich: 是否获取相关边信息(默认true) | deliberate | backend-docstring | Simulation |
| 223 | backend/app/api/simulation.py | 95 | """获取单个实体的详细信息""" | deliberate | backend-docstring | Simulation |
| 224 | backend/app/api/simulation.py | 128 | """获取指定类型的所有实体""" | deliberate | backend-docstring | Simulation |
| 225 | backend/app/api/simulation.py | 163 | # ============== 模拟管理接口 ============== | deliberate | backend-comment | Simulation |
| 226 | backend/app/api/simulation.py | 168 | 创建新的模拟 | deliberate | backend-docstring | Simulation |
| 227 | backend/app/api/simulation.py | 170 | 注意:max_rounds等参数由LLM智能生成,无需手动设置 | deliberate | backend-docstring | Simulation |
| 228 | backend/app/api/simulation.py | 172 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 229 | backend/app/api/simulation.py | 174 | "project_id": "proj_xxxx", // 必填 | review-needed | backend-string | Simulation |
| 230 | backend/app/api/simulation.py | 175 | "graph_id": "mirofish_xxxx", // 可选,如不提供则从project获取 | review-needed | backend-string | Simulation |
| 231 | backend/app/api/simulation.py | 176 | "enable_twitter": true, // 可选,默认true | review-needed | backend-string | Simulation |
| 232 | backend/app/api/simulation.py | 177 | "enable_reddit": true // 可选,默认true | review-needed | backend-string | Simulation |
| 233 | backend/app/api/simulation.py | 180 | 返回: | deliberate | backend-docstring | Simulation |
| 234 | backend/app/api/simulation.py | 242 | 检查模拟是否已经准备完成 | deliberate | backend-docstring | Simulation |
| 235 | backend/app/api/simulation.py | 244 | 检查条件: | deliberate | backend-docstring | Simulation |
| 236 | backend/app/api/simulation.py | 245 | 1. state.json 存在且 status 为 "ready" | review-needed | backend-string | Simulation |
| 237 | backend/app/api/simulation.py | 246 | 2. 必要文件存在:reddit_profiles.json, twitter_profiles.csv, simulation_config.json | deliberate | backend-docstring | Simulation |
| 238 | backend/app/api/simulation.py | 248 | 注意:运行脚本(run_*.py)保留在 backend/scripts/ 目录,不再复制到模拟目录 | deliberate | backend-docstring | Simulation |
| 239 | backend/app/api/simulation.py | 251 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 240 | backend/app/api/simulation.py | 261 | # 检查目录是否存在 | deliberate | backend-comment | Simulation |
| 241 | backend/app/api/simulation.py | 263 | return False, {"reason": "模拟目录不存在"} | review-needed | backend-string | Simulation |
| 242 | backend/app/api/simulation.py | 265 | # 必要文件列表(不包括脚本,脚本位于 backend/scripts/) | deliberate | backend-comment | Simulation |
| 243 | backend/app/api/simulation.py | 273 | # 检查文件是否存在 | deliberate | backend-comment | Simulation |
| 244 | backend/app/api/simulation.py | 285 | "reason": "缺少必要文件", | review-needed | backend-string | Simulation |
| 245 | backend/app/api/simulation.py | 290 | # 检查state.json中的状态 | deliberate | backend-comment | Simulation |
| 246 | backend/app/api/simulation.py | 300 | # 详细日志 | deliberate | backend-comment | Simulation |
| 247 | backend/app/api/simulation.py | 303 | # 如果 config_generated=True 且文件存在,认为准备完成 | deliberate | backend-comment | Simulation |
| 248 | backend/app/api/simulation.py | 304 | # 以下状态都说明准备工作已完成: | deliberate | backend-comment | Simulation |
| 249 | backend/app/api/simulation.py | 305 | # - ready: 准备完成,可以运行 | deliberate | backend-comment | Simulation |
| 250 | backend/app/api/simulation.py | 306 | # - preparing: 如果 config_generated=True 说明已完成 | deliberate | backend-comment | Simulation |
| 251 | backend/app/api/simulation.py | 307 | # - running: 正在运行,说明准备早就完成了 | deliberate | backend-comment | Simulation |
| 252 | backend/app/api/simulation.py | 308 | # - completed: 运行完成,说明准备早就完成了 | deliberate | backend-comment | Simulation |
| 253 | backend/app/api/simulation.py | 309 | # - stopped: 已停止,说明准备早就完成了 | deliberate | backend-comment | Simulation |
| 254 | backend/app/api/simulation.py | 310 | # - failed: 运行失败(但准备是完成的) | deliberate | backend-comment | Simulation |
| 255 | backend/app/api/simulation.py | 313 | # 获取文件统计信息 | deliberate | backend-comment | Simulation |
| 256 | backend/app/api/simulation.py | 323 | # 如果状态是preparing但文件已完成,自动更新状态为ready | deliberate | backend-comment | Simulation |
| 257 | backend/app/api/simulation.py | 350 | "reason": f"状态不在已准备列表中或config_generated为false: status={status}, config_generated={config_generated}", | review-needed | backend-string | Simulation |
| 258 | backend/app/api/simulation.py | 356 | return False, {"reason": f"读取状态文件失败: {str(e)}"} | review-needed | backend-string | Simulation |
| 259 | backend/app/api/simulation.py | 362 | 准备模拟环境(异步任务,LLM智能生成所有参数) | deliberate | backend-docstring | Simulation |
| 260 | backend/app/api/simulation.py | 364 | 这是一个耗时操作,接口会立即返回task_id, | deliberate | backend-docstring | Simulation |
| 261 | backend/app/api/simulation.py | 365 | 使用 GET /api/simulation/prepare/status 查询进度 | deliberate | backend-docstring | Simulation |
| 262 | backend/app/api/simulation.py | 367 | 特性: | deliberate | backend-docstring | Simulation |
| 263 | backend/app/api/simulation.py | 368 | - 自动检测已完成的准备工作,避免重复生成 | deliberate | backend-docstring | Simulation |
| 264 | backend/app/api/simulation.py | 369 | - 如果已准备完成,直接返回已有结果 | deliberate | backend-docstring | Simulation |
| 265 | backend/app/api/simulation.py | 370 | - 支持强制重新生成(force_regenerate=true) | deliberate | backend-docstring | Simulation |
| 266 | backend/app/api/simulation.py | 372 | 步骤: | deliberate | backend-docstring | Simulation |
| 267 | backend/app/api/simulation.py | 373 | 1. 检查是否已有完成的准备工作 | deliberate | backend-docstring | Simulation |
| 268 | backend/app/api/simulation.py | 374 | 2. 从Zep图谱读取并过滤实体 | deliberate | backend-docstring | Simulation |
| 269 | backend/app/api/simulation.py | 375 | 3. 为每个实体生成OASIS Agent Profile(带重试机制) | deliberate | backend-docstring | Simulation |
| 270 | backend/app/api/simulation.py | 376 | 4. LLM智能生成模拟配置(带重试机制) | deliberate | backend-docstring | Simulation |
| 271 | backend/app/api/simulation.py | 377 | 5. 保存配置文件和预设脚本 | deliberate | backend-docstring | Simulation |
| 272 | backend/app/api/simulation.py | 379 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 273 | backend/app/api/simulation.py | 381 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | Simulation |
| 274 | backend/app/api/simulation.py | 382 | "entity_types": ["Student", "PublicFigure"], // 可选,指定实体类型 | review-needed | backend-string | Simulation |
| 275 | backend/app/api/simulation.py | 383 | "use_llm_for_profiles": true, // 可选,是否用LLM生成人设 | review-needed | backend-string | Simulation |
| 276 | backend/app/api/simulation.py | 384 | "parallel_profile_count": 5, // 可选,并行生成人设数量,默认5 | review-needed | backend-string | Simulation |
| 277 | backend/app/api/simulation.py | 385 | "force_regenerate": false // 可选,强制重新生成,默认false | review-needed | backend-string | Simulation |
| 278 | backend/app/api/simulation.py | 388 | 返回: | deliberate | backend-docstring | Simulation |
| 279 | backend/app/api/simulation.py | 393 | "task_id": "task_xxxx", // 新任务时返回 | review-needed | backend-string | Simulation |
| 280 | backend/app/api/simulation.py | 395 | "message": "准备任务已启动|已有完成的准备工作", | review-needed | backend-string | Simulation |
| 281 | backend/app/api/simulation.py | 396 | "already_prepared": true|false // 是否已准备完成 | review-needed | backend-string | Simulation |
| 282 | backend/app/api/simulation.py | 424 | # 检查是否强制重新生成 | deliberate | backend-comment | Simulation |
| 283 | backend/app/api/simulation.py | 428 | # 检查是否已经准备完成(避免重复生成) | deliberate | backend-comment | Simulation |
| 284 | backend/app/api/simulation.py | 440 | "message": "已有完成的准备工作,无需重复生成", | review-needed | backend-string | Simulation |
| 285 | backend/app/api/simulation.py | 448 | # 从项目获取必要信息 | deliberate | backend-comment | Simulation |
| 286 | backend/app/api/simulation.py | 456 | # 获取模拟需求 | deliberate | backend-comment | Simulation |
| 287 | backend/app/api/simulation.py | 464 | # 获取文档文本 | deliberate | backend-comment | Simulation |
| 288 | backend/app/api/simulation.py | 471 | # ========== 同步获取实体数量(在后台任务启动前) ========== | deliberate | backend-comment | Simulation |
| 289 | backend/app/api/simulation.py | 472 | # 这样前端在调用prepare后立即就能获取到预期Agent总数 | deliberate | backend-comment | Simulation |
| 290 | backend/app/api/simulation.py | 476 | # 快速读取实体(不需要边信息,只统计数量) | deliberate | backend-comment | Simulation |
| 291 | backend/app/api/simulation.py | 480 | enrich_with_edges=False # 不获取边信息,加快速度 | deliberate | backend-docstring | Simulation |
| 292 | backend/app/api/simulation.py | 482 | # 保存实体数量到状态(供前端立即获取) | deliberate | backend-comment | Simulation |
| 293 | backend/app/api/simulation.py | 488 | # 失败不影响后续流程,后台任务会重新获取 | deliberate | backend-comment | Simulation |
| 294 | backend/app/api/simulation.py | 490 | # 创建异步任务 | deliberate | backend-comment | Simulation |
| 295 | backend/app/api/simulation.py | 500 | # 更新模拟状态(包含预先获取的实体数量) | deliberate | backend-comment | Simulation |
| 296 | backend/app/api/simulation.py | 504 | # 定义后台任务 | deliberate | backend-comment | Simulation |
| 297 | backend/app/api/simulation.py | 511 | message="开始准备模拟环境..." | review-needed | backend-string | Simulation |
| 298 | backend/app/api/simulation.py | 514 | # 准备模拟(带进度回调) | deliberate | backend-comment | Simulation |
| 299 | backend/app/api/simulation.py | 515 | # 存储阶段进度详情 | deliberate | backend-comment | Simulation |
| 300 | backend/app/api/simulation.py | 519 | # 计算总进度 | deliberate | backend-comment | Simulation |
| 301 | backend/app/api/simulation.py | 530 | # 构建详细进度信息 | deliberate | backend-comment | Simulation |
| 302 | backend/app/api/simulation.py | 532 | "reading": "读取图谱实体", | review-needed | backend-string | Simulation |
| 303 | backend/app/api/simulation.py | 533 | "generating_profiles": "生成Agent人设", | review-needed | backend-string | Simulation |
| 304 | backend/app/api/simulation.py | 534 | "generating_config": "生成模拟配置", | review-needed | backend-string | Simulation |
| 305 | backend/app/api/simulation.py | 535 | "copying_scripts": "准备模拟脚本" | review-needed | backend-string | Simulation |
| 306 | backend/app/api/simulation.py | 541 | # 更新阶段详情 | deliberate | backend-comment | Simulation |
| 307 | backend/app/api/simulation.py | 550 | # 构建详细进度信息 | deliberate | backend-comment | Simulation |
| 308 | backend/app/api/simulation.py | 563 | # 构建简洁消息 | deliberate | backend-comment | Simulation |
| 309 | backend/app/api/simulation.py | 589 | # 任务完成 | deliberate | backend-comment | Simulation |
| 310 | backend/app/api/simulation.py | 599 | # 更新模拟状态为失败 | deliberate | backend-comment | Simulation |
| 311 | backend/app/api/simulation.py | 606 | # 启动后台线程 | deliberate | backend-comment | Simulation |
| 312 | backend/app/api/simulation.py | 616 | "message": "准备任务已启动,请通过 /api/simulation/prepare/status 查询进度", | review-needed | backend-string | Simulation |
| 313 | backend/app/api/simulation.py | 618 | "expected_entities_count": state.entities_count, # 预期的Agent总数 | review-needed | backend-string | Simulation |
| 314 | backend/app/api/simulation.py | 619 | "entity_types": state.entity_types # 实体类型列表 | review-needed | backend-string | Simulation |
| 315 | backend/app/api/simulation.py | 641 | 查询准备任务进度 | deliberate | backend-docstring | Simulation |
| 316 | backend/app/api/simulation.py | 643 | 支持两种查询方式: | deliberate | backend-docstring | Simulation |
| 317 | backend/app/api/simulation.py | 644 | 1. 通过task_id查询正在进行的任务进度 | deliberate | backend-docstring | Simulation |
| 318 | backend/app/api/simulation.py | 645 | 2. 通过simulation_id检查是否已有完成的准备工作 | deliberate | backend-docstring | Simulation |
| 319 | backend/app/api/simulation.py | 647 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 320 | backend/app/api/simulation.py | 649 | "task_id": "task_xxxx", // 可选,prepare返回的task_id | review-needed | backend-string | Simulation |
| 321 | backend/app/api/simulation.py | 650 | "simulation_id": "sim_xxxx" // 可选,模拟ID(用于检查已完成的准备) | review-needed | backend-string | Simulation |
| 322 | backend/app/api/simulation.py | 653 | 返回: | deliberate | backend-docstring | Simulation |
| 323 | backend/app/api/simulation.py | 661 | "already_prepared": true|false, // 是否已有完成的准备 | review-needed | backend-string | Simulation |
| 324 | backend/app/api/simulation.py | 662 | "prepare_info": {...} // 已准备完成时的详细信息 | review-needed | backend-string | Simulation |
| 325 | backend/app/api/simulation.py | 674 | # 如果提供了simulation_id,先检查是否已准备完成 | deliberate | backend-comment | Simulation |
| 326 | backend/app/api/simulation.py | 684 | "message": "已有完成的准备工作", | review-needed | backend-string | Simulation |
| 327 | backend/app/api/simulation.py | 690 | # 如果没有task_id,返回错误 | deliberate | backend-comment | Simulation |
| 328 | backend/app/api/simulation.py | 693 | # 有simulation_id但未准备完成 | deliberate | backend-comment | Simulation |
| 329 | backend/app/api/simulation.py | 700 | "message": "尚未开始准备,请调用 /api/simulation/prepare 开始", | review-needed | backend-string | Simulation |
| 330 | backend/app/api/simulation.py | 713 | # 任务不存在,但如果有simulation_id,检查是否已准备完成 | deliberate | backend-comment | Simulation |
| 331 | backend/app/api/simulation.py | 724 | "message": "任务已完成(准备工作已存在)", | review-needed | backend-string | Simulation |
| 332 | backend/app/api/simulation.py | 753 | """获取模拟状态""" | deliberate | backend-docstring | Simulation |
| 333 | backend/app/api/simulation.py | 766 | # 如果模拟已准备好,附加运行说明 | deliberate | backend-comment | Simulation |
| 334 | backend/app/api/simulation.py | 787 | 列出所有模拟 | deliberate | backend-docstring | Simulation |
| 335 | backend/app/api/simulation.py | 789 | Query参数: | deliberate | backend-docstring | Simulation |
| 336 | backend/app/api/simulation.py | 790 | project_id: 按项目ID过滤(可选) | deliberate | backend-docstring | Simulation |
| 337 | backend/app/api/simulation.py | 815 | 获取 simulation 对应的最新 report_id | deliberate | backend-docstring | Simulation |
| 338 | backend/app/api/simulation.py | 817 | 遍历 reports 目录,找出 simulation_id 匹配的 report, | deliberate | backend-docstring | Simulation |
| 339 | backend/app/api/simulation.py | 818 | 如果有多个则返回最新的(按 created_at 排序) | deliberate | backend-docstring | Simulation |
| 340 | backend/app/api/simulation.py | 821 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 341 | backend/app/api/simulation.py | 824 | report_id 或 None | deliberate | backend-docstring | Simulation |
| 342 | backend/app/api/simulation.py | 829 | # reports 目录路径:backend/uploads/reports | deliberate | backend-comment | Simulation |
| 343 | backend/app/api/simulation.py | 830 | # __file__ 是 app/api/simulation.py,需要向上两级到 backend/ | deliberate | backend-comment | Simulation |
| 344 | backend/app/api/simulation.py | 863 | # 按创建时间倒序排序,返回最新的 | deliberate | backend-comment | Simulation |
| 345 | backend/app/api/simulation.py | 875 | 获取历史模拟列表(带项目详情) | deliberate | backend-docstring | Simulation |
| 346 | backend/app/api/simulation.py | 877 | 用于首页历史项目展示,返回包含项目名称、描述等丰富信息的模拟列表 | deliberate | backend-docstring | Simulation |
| 347 | backend/app/api/simulation.py | 879 | Query参数: | deliberate | backend-docstring | Simulation |
| 348 | backend/app/api/simulation.py | 880 | limit: 返回数量限制(默认20) | deliberate | backend-docstring | Simulation |
| 349 | backend/app/api/simulation.py | 882 | 返回: | deliberate | backend-docstring | Simulation |
| 350 | backend/app/api/simulation.py | 889 | "project_name": "武大舆情分析", | review-needed | backend-string | Simulation |
| 351 | backend/app/api/simulation.py | 890 | "simulation_requirement": "如果武汉大学发布...", | review-needed | backend-string | Simulation |
| 352 | backend/app/api/simulation.py | 913 | # 增强模拟数据,只从 Simulation 文件读取 | deliberate | backend-comment | Simulation |
| 353 | backend/app/api/simulation.py | 918 | # 获取模拟配置信息(从 simulation_config.json 读取 simulation_requirement) | deliberate | backend-comment | Simulation |
| 354 | backend/app/api/simulation.py | 924 | # 推荐轮数(后备值) | deliberate | backend-comment | Simulation |
| 355 | backend/app/api/simulation.py | 934 | # 获取运行状态(从 run_state.json 读取用户设置的实际轮数) | deliberate | backend-comment | Simulation |
| 356 | backend/app/api/simulation.py | 939 | # 使用用户设置的 total_rounds,若无则使用推荐轮数 | deliberate | backend-comment | Simulation |
| 357 | backend/app/api/simulation.py | 946 | # 获取关联项目的文件列表(最多3个) | deliberate | backend-comment | Simulation |
| 358 | backend/app/api/simulation.py | 950 | {"filename": f.get("filename", "未知文件")} | review-needed | backend-string | Simulation |
| 359 | backend/app/api/simulation.py | 956 | # 获取关联的 report_id(查找该 simulation 最新的 report) | deliberate | backend-comment | Simulation |
| 360 | backend/app/api/simulation.py | 959 | # 添加版本号 | deliberate | backend-comment | Simulation |
| 361 | backend/app/api/simulation.py | 962 | # 格式化日期 | deliberate | backend-comment | Simulation |
| 362 | backend/app/api/simulation.py | 989 | 获取模拟的Agent Profile | deliberate | backend-docstring | Simulation |
| 363 | backend/app/api/simulation.py | 991 | Query参数: | deliberate | backend-docstring | Simulation |
| 364 | backend/app/api/simulation.py | 992 | platform: 平台类型(reddit/twitter,默认reddit) | deliberate | backend-docstring | Simulation |
| 365 | backend/app/api/simulation.py | 1027 | 实时获取模拟的Agent Profile(用于在生成过程中实时查看进度) | deliberate | backend-docstring | Simulation |
| 366 | backend/app/api/simulation.py | 1029 | 与 /profiles 接口的区别: | deliberate | backend-docstring | Simulation |
| 367 | backend/app/api/simulation.py | 1030 | - 直接读取文件,不经过 SimulationManager | deliberate | backend-docstring | Simulation |
| 368 | backend/app/api/simulation.py | 1031 | - 适用于生成过程中的实时查看 | deliberate | backend-docstring | Simulation |
| 369 | backend/app/api/simulation.py | 1032 | - 返回额外的元数据(如文件修改时间、是否正在生成等) | deliberate | backend-docstring | Simulation |
| 370 | backend/app/api/simulation.py | 1034 | Query参数: | deliberate | backend-docstring | Simulation |
| 371 | backend/app/api/simulation.py | 1035 | platform: 平台类型(reddit/twitter,默认reddit) | deliberate | backend-docstring | Simulation |
| 372 | backend/app/api/simulation.py | 1037 | 返回: | deliberate | backend-docstring | Simulation |
| 373 | backend/app/api/simulation.py | 1044 | "total_expected": 93, // 预期总数(如果有) | review-needed | backend-string | Simulation |
| 374 | backend/app/api/simulation.py | 1045 | "is_generating": true, // 是否正在生成 | review-needed | backend-string | Simulation |
| 375 | backend/app/api/simulation.py | 1059 | # 获取模拟目录 | deliberate | backend-comment | Simulation |
| 376 | backend/app/api/simulation.py | 1068 | # 确定文件路径 | deliberate | backend-comment | Simulation |
| 377 | backend/app/api/simulation.py | 1074 | # 检查文件是否存在 | deliberate | backend-comment | Simulation |
| 378 | backend/app/api/simulation.py | 1080 | # 获取文件修改时间 | deliberate | backend-comment | Simulation |
| 379 | backend/app/api/simulation.py | 1096 | # 检查是否正在生成(通过 state.json 判断) | deliberate | backend-comment | Simulation |
| 380 | backend/app/api/simulation.py | 1137 | 实时获取模拟配置(用于在生成过程中实时查看进度) | deliberate | backend-docstring | Simulation |
| 381 | backend/app/api/simulation.py | 1139 | 与 /config 接口的区别: | deliberate | backend-docstring | Simulation |
| 382 | backend/app/api/simulation.py | 1140 | - 直接读取文件,不经过 SimulationManager | deliberate | backend-docstring | Simulation |
| 383 | backend/app/api/simulation.py | 1141 | - 适用于生成过程中的实时查看 | deliberate | backend-docstring | Simulation |
| 384 | backend/app/api/simulation.py | 1142 | - 返回额外的元数据(如文件修改时间、是否正在生成等) | deliberate | backend-docstring | Simulation |
| 385 | backend/app/api/simulation.py | 1143 | - 即使配置还没生成完也能返回部分信息 | deliberate | backend-docstring | Simulation |
| 386 | backend/app/api/simulation.py | 1145 | 返回: | deliberate | backend-docstring | Simulation |
| 387 | backend/app/api/simulation.py | 1152 | "is_generating": true, // 是否正在生成 | review-needed | backend-string | Simulation |
| 388 | backend/app/api/simulation.py | 1153 | "generation_stage": "generating_config", // 当前生成阶段 | review-needed | backend-string | Simulation |
| 389 | backend/app/api/simulation.py | 1154 | "config": {...} // 配置内容(如果存在) | review-needed | backend-string | Simulation |
| 390 | backend/app/api/simulation.py | 1162 | # 获取模拟目录 | deliberate | backend-comment | Simulation |
| 391 | backend/app/api/simulation.py | 1171 | # 配置文件路径 | deliberate | backend-comment | Simulation |
| 392 | backend/app/api/simulation.py | 1174 | # 检查文件是否存在 | deliberate | backend-comment | Simulation |
| 393 | backend/app/api/simulation.py | 1180 | # 获取文件修改时间 | deliberate | backend-comment | Simulation |
| 394 | backend/app/api/simulation.py | 1191 | # 检查是否正在生成(通过 state.json 判断) | deliberate | backend-comment | Simulation |
| 395 | backend/app/api/simulation.py | 1205 | # 判断当前阶段 | deliberate | backend-comment | Simulation |
| 396 | backend/app/api/simulation.py | 1216 | # 构建返回数据 | deliberate | backend-comment | Simulation |
| 397 | backend/app/api/simulation.py | 1227 | # 如果配置存在,提取一些关键统计信息 | deliberate | backend-comment | Simulation |
| 398 | backend/app/api/simulation.py | 1257 | 获取模拟配置(LLM智能生成的完整配置) | deliberate | backend-docstring | Simulation |
| 399 | backend/app/api/simulation.py | 1259 | 返回包含: | deliberate | backend-docstring | Simulation |
| 400 | backend/app/api/simulation.py | 1260 | - time_config: 时间配置(模拟时长、轮次、高峰/低谷时段) | deliberate | backend-docstring | Simulation |
| 401 | backend/app/api/simulation.py | 1261 | - agent_configs: 每个Agent的活动配置(活跃度、发言频率、立场等) | deliberate | backend-docstring | Simulation |
| 402 | backend/app/api/simulation.py | 1262 | - event_config: 事件配置(初始帖子、热点话题) | deliberate | backend-docstring | Simulation |
| 403 | backend/app/api/simulation.py | 1263 | - platform_configs: 平台配置 | deliberate | backend-docstring | Simulation |
| 404 | backend/app/api/simulation.py | 1264 | - generation_reasoning: LLM的配置推理说明 | deliberate | backend-docstring | Simulation |
| 405 | backend/app/api/simulation.py | 1292 | """下载模拟配置文件""" | deliberate | backend-docstring | Simulation |
| 406 | backend/app/api/simulation.py | 1322 | 下载模拟运行脚本文件(通用脚本,位于 backend/scripts/) | deliberate | backend-docstring | Simulation |
| 407 | backend/app/api/simulation.py | 1324 | script_name可选值: | deliberate | backend-docstring | Simulation |
| 408 | backend/app/api/simulation.py | 1331 | # 脚本位于 backend/scripts/ 目录 | deliberate | backend-comment | Simulation |
| 409 | backend/app/api/simulation.py | 1334 | # 验证脚本名称 | deliberate | backend-comment | Simulation |
| 410 | backend/app/api/simulation.py | 1371 | # ============== Profile生成接口(独立使用) ============== | deliberate | backend-comment | Simulation |
| 411 | backend/app/api/simulation.py | 1376 | 直接从图谱生成OASIS Agent Profile(不创建模拟) | deliberate | backend-docstring | Simulation |
| 412 | backend/app/api/simulation.py | 1378 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 413 | backend/app/api/simulation.py | 1380 | "graph_id": "mirofish_xxxx", // 必填 | review-needed | backend-string | Simulation |
| 414 | backend/app/api/simulation.py | 1381 | "entity_types": ["Student"], // 可选 | review-needed | backend-string | Simulation |
| 415 | backend/app/api/simulation.py | 1382 | "use_llm": true, // 可选 | review-needed | backend-string | Simulation |
| 416 | backend/app/api/simulation.py | 1383 | "platform": "reddit" // 可选 | review-needed | backend-string | Simulation |
| 417 | backend/app/api/simulation.py | 1445 | # ============== 模拟运行控制接口 ============== | deliberate | backend-comment | Simulation |
| 418 | backend/app/api/simulation.py | 1450 | 开始运行模拟 | deliberate | backend-docstring | Simulation |
| 419 | backend/app/api/simulation.py | 1452 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 420 | backend/app/api/simulation.py | 1454 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | Simulation |
| 421 | backend/app/api/simulation.py | 1455 | "platform": "parallel", // 可选: twitter / reddit / parallel (默认) | review-needed | backend-string | Simulation |
| 422 | backend/app/api/simulation.py | 1456 | "max_rounds": 100, // 可选: 最大模拟轮数,用于截断过长的模拟 | review-needed | backend-string | Simulation |
| 423 | backend/app/api/simulation.py | 1457 | "enable_graph_memory_update": false, // 可选: 是否将Agent活动动态更新到Zep图谱记忆 | review-needed | backend-string | Simulation |
| 424 | backend/app/api/simulation.py | 1458 | "force": false // 可选: 强制重新开始(会停止运行中的模拟并清理日志) | review-needed | backend-string | Simulation |
| 425 | backend/app/api/simulation.py | 1461 | 关于 force 参数: | deliberate | backend-docstring | Simulation |
| 426 | backend/app/api/simulation.py | 1462 | - 启用后,如果模拟正在运行或已完成,会先停止并清理运行日志 | deliberate | backend-docstring | Simulation |
| 427 | backend/app/api/simulation.py | 1463 | - 清理的内容包括:run_state.json, actions.jsonl, simulation.log 等 | deliberate | backend-docstring | Simulation |
| 428 | backend/app/api/simulation.py | 1464 | - 不会清理配置文件(simulation_config.json)和 profile 文件 | deliberate | backend-docstring | Simulation |
| 429 | backend/app/api/simulation.py | 1465 | - 适用于需要重新运行模拟的场景 | deliberate | backend-docstring | Simulation |
| 430 | backend/app/api/simulation.py | 1467 | 关于 enable_graph_memory_update: | deliberate | backend-docstring | Simulation |
| 431 | backend/app/api/simulation.py | 1468 | - 启用后,模拟中所有Agent的活动(发帖、评论、点赞等)都会实时更新到Zep图谱 | deliberate | backend-docstring | Simulation |
| 432 | backend/app/api/simulation.py | 1469 | - 这可以让图谱"记住"模拟过程,用于后续分析或AI对话 | review-needed | backend-string | Simulation |
| 433 | backend/app/api/simulation.py | 1470 | - 需要模拟关联的项目有有效的 graph_id | deliberate | backend-docstring | Simulation |
| 434 | backend/app/api/simulation.py | 1471 | - 采用批量更新机制,减少API调用次数 | deliberate | backend-docstring | Simulation |
| 435 | backend/app/api/simulation.py | 1473 | 返回: | deliberate | backend-docstring | Simulation |
| 436 | backend/app/api/simulation.py | 1483 | "graph_memory_update_enabled": true, // 是否启用了图谱记忆更新 | review-needed | backend-string | Simulation |
| 437 | backend/app/api/simulation.py | 1484 | "force_restarted": true // 是否是强制重新开始 | review-needed | backend-string | Simulation |
| 438 | backend/app/api/simulation.py | 1499 | max_rounds = data.get('max_rounds') # 可选:最大模拟轮数 | review-needed | backend-string | Simulation |
| 439 | backend/app/api/simulation.py | 1500 | enable_graph_memory_update = data.get('enable_graph_memory_update', False) # 可选:是否启用图谱记忆更新 | review-needed | backend-string | Simulation |
| 440 | backend/app/api/simulation.py | 1501 | force = data.get('force', False) # 可选:强制重新开始 | review-needed | backend-string | Simulation |
| 441 | backend/app/api/simulation.py | 1503 | # 验证 max_rounds 参数 | deliberate | backend-comment | Simulation |
| 442 | backend/app/api/simulation.py | 1524 | # 检查模拟是否已准备好 | deliberate | backend-comment | Simulation |
| 443 | backend/app/api/simulation.py | 1536 | # 智能处理状态:如果准备工作已完成,允许重新启动 | deliberate | backend-comment | Simulation |
| 444 | backend/app/api/simulation.py | 1538 | # 检查准备工作是否已完成 | deliberate | backend-comment | Simulation |
| 445 | backend/app/api/simulation.py | 1542 | # 准备工作已完成,检查是否有正在运行的进程 | deliberate | backend-comment | Simulation |
| 446 | backend/app/api/simulation.py | 1544 | # 检查模拟进程是否真的在运行 | deliberate | backend-comment | Simulation |
| 447 | backend/app/api/simulation.py | 1547 | # 进程确实在运行 | deliberate | backend-comment | Simulation |
| 448 | backend/app/api/simulation.py | 1549 | # 强制模式:停止运行中的模拟 | deliberate | backend-comment | Simulation |
| 449 | backend/app/api/simulation.py | 1561 | # 如果是强制模式,清理运行日志 | deliberate | backend-comment | Simulation |
| 450 | backend/app/api/simulation.py | 1569 | # 进程不存在或已结束,重置状态为 ready | deliberate | backend-comment | Simulation |
| 451 | backend/app/api/simulation.py | 1574 | # 准备工作未完成 | deliberate | backend-comment | Simulation |
| 452 | backend/app/api/simulation.py | 1580 | # 获取图谱ID(用于图谱记忆更新) | deliberate | backend-comment | Simulation |
| 453 | backend/app/api/simulation.py | 1583 | # 从模拟状态或项目中获取 graph_id | deliberate | backend-comment | Simulation |
| 454 | backend/app/api/simulation.py | 1586 | # 尝试从项目中获取 | deliberate | backend-comment | Simulation |
| 455 | backend/app/api/simulation.py | 1599 | # 启动模拟 | deliberate | backend-comment | Simulation |
| 456 | backend/app/api/simulation.py | 1608 | # 更新模拟状态 | deliberate | backend-comment | Simulation |
| 457 | backend/app/api/simulation.py | 1643 | 停止模拟 | deliberate | backend-docstring | Simulation |
| 458 | backend/app/api/simulation.py | 1645 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 459 | backend/app/api/simulation.py | 1647 | "simulation_id": "sim_xxxx" // 必填,模拟ID | review-needed | backend-string | Simulation |
| 460 | backend/app/api/simulation.py | 1650 | 返回: | deliberate | backend-docstring | Simulation |
| 461 | backend/app/api/simulation.py | 1672 | # 更新模拟状态 | deliberate | backend-comment | Simulation |
| 462 | backend/app/api/simulation.py | 1699 | # ============== 实时状态监控接口 ============== | deliberate | backend-comment | Simulation |
| 463 | backend/app/api/simulation.py | 1704 | 获取模拟运行实时状态(用于前端轮询) | deliberate | backend-docstring | Simulation |
| 464 | backend/app/api/simulation.py | 1706 | 返回: | deliberate | backend-docstring | Simulation |
| 465 | backend/app/api/simulation.py | 1762 | 获取模拟运行详细状态(包含所有动作) | deliberate | backend-docstring | Simulation |
| 466 | backend/app/api/simulation.py | 1764 | 用于前端展示实时动态 | deliberate | backend-docstring | Simulation |
| 467 | backend/app/api/simulation.py | 1766 | Query参数: | deliberate | backend-docstring | Simulation |
| 468 | backend/app/api/simulation.py | 1767 | platform: 过滤平台(twitter/reddit,可选) | deliberate | backend-docstring | Simulation |
| 469 | backend/app/api/simulation.py | 1769 | 返回: | deliberate | backend-docstring | Simulation |
| 470 | backend/app/api/simulation.py | 1791 | "twitter_actions": [...], # Twitter 平台的所有动作 | review-needed | backend-string | Simulation |
| 471 | backend/app/api/simulation.py | 1792 | "reddit_actions": [...] # Reddit 平台的所有动作 | review-needed | backend-string | Simulation |
| 472 | backend/app/api/simulation.py | 1812 | # 获取完整的动作列表 | deliberate | backend-comment | Simulation |
| 473 | backend/app/api/simulation.py | 1818 | # 分平台获取动作 | deliberate | backend-comment | Simulation |
| 474 | backend/app/api/simulation.py | 1829 | # 获取当前轮次的动作(recent_actions 只展示最新一轮) | deliberate | backend-comment | Simulation |
| 475 | backend/app/api/simulation.py | 1837 | # 获取基础状态信息 | deliberate | backend-comment | Simulation |
| 476 | backend/app/api/simulation.py | 1843 | # recent_actions 只展示当前最新一轮两个平台的内容 | deliberate | backend-comment | Simulation |
| 477 | backend/app/api/simulation.py | 1863 | 获取模拟中的Agent动作历史 | deliberate | backend-docstring | Simulation |
| 478 | backend/app/api/simulation.py | 1865 | Query参数: | deliberate | backend-docstring | Simulation |
| 479 | backend/app/api/simulation.py | 1866 | limit: 返回数量(默认100) | deliberate | backend-docstring | Simulation |
| 480 | backend/app/api/simulation.py | 1867 | offset: 偏移量(默认0) | deliberate | backend-docstring | Simulation |
| 481 | backend/app/api/simulation.py | 1868 | platform: 过滤平台(twitter/reddit) | deliberate | backend-docstring | Simulation |
| 482 | backend/app/api/simulation.py | 1869 | agent_id: 过滤Agent ID | deliberate | backend-docstring | Simulation |
| 483 | backend/app/api/simulation.py | 1870 | round_num: 过滤轮次 | deliberate | backend-docstring | Simulation |
| 484 | backend/app/api/simulation.py | 1872 | 返回: | deliberate | backend-docstring | Simulation |
| 485 | backend/app/api/simulation.py | 1917 | 获取模拟时间线(按轮次汇总) | deliberate | backend-docstring | Simulation |
| 486 | backend/app/api/simulation.py | 1919 | 用于前端展示进度条和时间线视图 | deliberate | backend-docstring | Simulation |
| 487 | backend/app/api/simulation.py | 1921 | Query参数: | deliberate | backend-docstring | Simulation |
| 488 | backend/app/api/simulation.py | 1922 | start_round: 起始轮次(默认0) | deliberate | backend-docstring | Simulation |
| 489 | backend/app/api/simulation.py | 1923 | end_round: 结束轮次(默认全部) | deliberate | backend-docstring | Simulation |
| 490 | backend/app/api/simulation.py | 1925 | 返回每轮的汇总信息 | deliberate | backend-docstring | Simulation |
| 491 | backend/app/api/simulation.py | 1957 | 获取每个Agent的统计信息 | deliberate | backend-docstring | Simulation |
| 492 | backend/app/api/simulation.py | 1959 | 用于前端展示Agent活跃度排行、动作分布等 | deliberate | backend-docstring | Simulation |
| 493 | backend/app/api/simulation.py | 1981 | # ============== 数据库查询接口 ============== | deliberate | backend-comment | Simulation |
| 494 | backend/app/api/simulation.py | 1986 | 获取模拟中的帖子 | deliberate | backend-docstring | Simulation |
| 495 | backend/app/api/simulation.py | 1988 | Query参数: | deliberate | backend-docstring | Simulation |
| 496 | backend/app/api/simulation.py | 1989 | platform: 平台类型(twitter/reddit) | deliberate | backend-docstring | Simulation |
| 497 | backend/app/api/simulation.py | 1990 | limit: 返回数量(默认50) | deliberate | backend-docstring | Simulation |
| 498 | backend/app/api/simulation.py | 1991 | offset: 偏移量 | deliberate | backend-docstring | Simulation |
| 499 | backend/app/api/simulation.py | 1993 | 返回帖子列表(从SQLite数据库读取) | deliberate | backend-docstring | Simulation |
| 500 | backend/app/api/simulation.py | 2015 | "message": "数据库不存在,模拟可能尚未运行" | review-needed | backend-string | Simulation |
| 501 | backend/app/api/simulation.py | 2064 | 获取模拟中的评论(仅Reddit) | deliberate | backend-docstring | Simulation |
| 502 | backend/app/api/simulation.py | 2066 | Query参数: | deliberate | backend-docstring | Simulation |
| 503 | backend/app/api/simulation.py | 2067 | post_id: 过滤帖子ID(可选) | deliberate | backend-docstring | Simulation |
| 504 | backend/app/api/simulation.py | 2068 | limit: 返回数量 | deliberate | backend-docstring | Simulation |
| 505 | backend/app/api/simulation.py | 2069 | offset: 偏移量 | deliberate | backend-docstring | Simulation |
| 506 | backend/app/api/simulation.py | 2136 | # ============== Interview 采访接口 ============== | deliberate | backend-comment | Simulation |
| 507 | backend/app/api/simulation.py | 2141 | 采访单个Agent | deliberate | backend-docstring | Simulation |
| 508 | backend/app/api/simulation.py | 2143 | 注意:此功能需要模拟环境处于运行状态(完成模拟循环后进入等待命令模式) | deliberate | backend-docstring | Simulation |
| 509 | backend/app/api/simulation.py | 2145 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 510 | backend/app/api/simulation.py | 2147 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | Simulation |
| 511 | backend/app/api/simulation.py | 2148 | "agent_id": 0, // 必填,Agent ID | review-needed | backend-string | Simulation |
| 512 | backend/app/api/simulation.py | 2149 | "prompt": "你对这件事有什么看法?", // 必填,采访问题 | review-needed | backend-string | Simulation |
| 513 | backend/app/api/simulation.py | 2150 | "platform": "twitter", // 可选,指定平台(twitter/reddit) | review-needed | backend-string | Simulation |
| 514 | backend/app/api/simulation.py | 2151 | // 不指定时:双平台模拟同时采访两个平台 | deliberate | backend-docstring | Simulation |
| 515 | backend/app/api/simulation.py | 2152 | "timeout": 60 // 可选,超时时间(秒),默认60 | review-needed | backend-string | Simulation |
| 516 | backend/app/api/simulation.py | 2155 | 返回(不指定platform,双平台模式): | deliberate | backend-docstring | Simulation |
| 517 | backend/app/api/simulation.py | 2160 | "prompt": "你对这件事有什么看法?", | review-needed | backend-string | Simulation |
| 518 | backend/app/api/simulation.py | 2173 | 返回(指定platform): | deliberate | backend-docstring | Simulation |
| 519 | backend/app/api/simulation.py | 2178 | "prompt": "你对这件事有什么看法?", | review-needed | backend-string | Simulation |
| 520 | backend/app/api/simulation.py | 2181 | "response": "我认为...", | review-needed | backend-string | Simulation |
| 521 | backend/app/api/simulation.py | 2195 | platform = data.get('platform') # 可选:twitter/reddit/None | review-needed | backend-string | Simulation |
| 522 | backend/app/api/simulation.py | 2216 | # 验证platform参数 | deliberate | backend-comment | Simulation |
| 523 | backend/app/api/simulation.py | 2223 | # 检查环境状态 | deliberate | backend-comment | Simulation |
| 524 | backend/app/api/simulation.py | 2230 | # 优化prompt,添加前缀避免Agent调用工具 | deliberate | backend-comment | Simulation |
| 525 | backend/app/api/simulation.py | 2270 | 批量采访多个Agent | deliberate | backend-docstring | Simulation |
| 526 | backend/app/api/simulation.py | 2272 | 注意:此功能需要模拟环境处于运行状态 | deliberate | backend-docstring | Simulation |
| 527 | backend/app/api/simulation.py | 2274 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 528 | backend/app/api/simulation.py | 2276 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | Simulation |
| 529 | backend/app/api/simulation.py | 2277 | "interviews": [ // 必填,采访列表 | review-needed | backend-string | Simulation |
| 530 | backend/app/api/simulation.py | 2280 | "prompt": "你对A有什么看法?", | review-needed | backend-string | Simulation |
| 531 | backend/app/api/simulation.py | 2281 | "platform": "twitter" // 可选,指定该Agent的采访平台 | review-needed | backend-string | Simulation |
| 532 | backend/app/api/simulation.py | 2285 | "prompt": "你对B有什么看法?" // 不指定platform则使用默认值 | review-needed | backend-string | Simulation |
| 533 | backend/app/api/simulation.py | 2288 | "platform": "reddit", // 可选,默认平台(被每项的platform覆盖) | review-needed | backend-string | Simulation |
| 534 | backend/app/api/simulation.py | 2289 | // 不指定时:双平台模拟每个Agent同时采访两个平台 | deliberate | backend-docstring | Simulation |
| 535 | backend/app/api/simulation.py | 2290 | "timeout": 120 // 可选,超时时间(秒),默认120 | review-needed | backend-string | Simulation |
| 536 | backend/app/api/simulation.py | 2293 | 返回: | deliberate | backend-docstring | Simulation |
| 537 | backend/app/api/simulation.py | 2316 | platform = data.get('platform') # 可选:twitter/reddit/None | review-needed | backend-string | Simulation |
| 538 | backend/app/api/simulation.py | 2331 | # 验证platform参数 | deliberate | backend-comment | Simulation |
| 539 | backend/app/api/simulation.py | 2338 | # 验证每个采访项 | deliberate | backend-comment | Simulation |
| 540 | backend/app/api/simulation.py | 2350 | # 验证每项的platform(如果有) | deliberate | backend-comment | Simulation |
| 541 | backend/app/api/simulation.py | 2358 | # 检查环境状态 | deliberate | backend-comment | Simulation |
| 542 | backend/app/api/simulation.py | 2365 | # 优化每个采访项的prompt,添加前缀避免Agent调用工具 | deliberate | backend-comment | Simulation |
| 543 | backend/app/api/simulation.py | 2408 | 全局采访 - 使用相同问题采访所有Agent | deliberate | backend-docstring | Simulation |
| 544 | backend/app/api/simulation.py | 2410 | 注意:此功能需要模拟环境处于运行状态 | deliberate | backend-docstring | Simulation |
| 545 | backend/app/api/simulation.py | 2412 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 546 | backend/app/api/simulation.py | 2414 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | Simulation |
| 547 | backend/app/api/simulation.py | 2415 | "prompt": "你对这件事整体有什么看法?", // 必填,采访问题(所有Agent使用相同问题) | review-needed | backend-string | Simulation |
| 548 | backend/app/api/simulation.py | 2416 | "platform": "reddit", // 可选,指定平台(twitter/reddit) | review-needed | backend-string | Simulation |
| 549 | backend/app/api/simulation.py | 2417 | // 不指定时:双平台模拟每个Agent同时采访两个平台 | deliberate | backend-docstring | Simulation |
| 550 | backend/app/api/simulation.py | 2418 | "timeout": 180 // 可选,超时时间(秒),默认180 | review-needed | backend-string | Simulation |
| 551 | backend/app/api/simulation.py | 2421 | 返回: | deliberate | backend-docstring | Simulation |
| 552 | backend/app/api/simulation.py | 2443 | platform = data.get('platform') # 可选:twitter/reddit/None | review-needed | backend-string | Simulation |
| 553 | backend/app/api/simulation.py | 2458 | # 验证platform参数 | deliberate | backend-comment | Simulation |
| 554 | backend/app/api/simulation.py | 2465 | # 检查环境状态 | deliberate | backend-comment | Simulation |
| 555 | backend/app/api/simulation.py | 2472 | # 优化prompt,添加前缀避免Agent调用工具 | deliberate | backend-comment | Simulation |
| 556 | backend/app/api/simulation.py | 2511 | 获取Interview历史记录 | deliberate | backend-docstring | Simulation |
| 557 | backend/app/api/simulation.py | 2513 | 从模拟数据库中读取所有Interview记录 | deliberate | backend-docstring | Simulation |
| 558 | backend/app/api/simulation.py | 2515 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 559 | backend/app/api/simulation.py | 2517 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | Simulation |
| 560 | backend/app/api/simulation.py | 2518 | "platform": "reddit", // 可选,平台类型(reddit/twitter) | review-needed | backend-string | Simulation |
| 561 | backend/app/api/simulation.py | 2519 | // 不指定则返回两个平台的所有历史 | deliberate | backend-docstring | Simulation |
| 562 | backend/app/api/simulation.py | 2520 | "agent_id": 0, // 可选,只获取该Agent的采访历史 | review-needed | backend-string | Simulation |
| 563 | backend/app/api/simulation.py | 2521 | "limit": 100 // 可选,返回数量,默认100 | review-needed | backend-string | Simulation |
| 564 | backend/app/api/simulation.py | 2524 | 返回: | deliberate | backend-docstring | Simulation |
| 565 | backend/app/api/simulation.py | 2532 | "response": "我认为...", | review-needed | backend-string | Simulation |
| 566 | backend/app/api/simulation.py | 2533 | "prompt": "你对这件事有什么看法?", | review-needed | backend-string | Simulation |
| 567 | backend/app/api/simulation.py | 2546 | platform = data.get('platform') # 不指定则返回两个平台的历史 | review-needed | backend-string | Simulation |
| 568 | backend/app/api/simulation.py | 2583 | 获取模拟环境状态 | deliberate | backend-docstring | Simulation |
| 569 | backend/app/api/simulation.py | 2585 | 检查模拟环境是否存活(可以接收Interview命令) | deliberate | backend-docstring | Simulation |
| 570 | backend/app/api/simulation.py | 2587 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 571 | backend/app/api/simulation.py | 2589 | "simulation_id": "sim_xxxx" // 必填,模拟ID | review-needed | backend-string | Simulation |
| 572 | backend/app/api/simulation.py | 2592 | 返回: | deliberate | backend-docstring | Simulation |
| 573 | backend/app/api/simulation.py | 2600 | "message": "环境正在运行,可以接收Interview命令" | review-needed | backend-string | Simulation |
| 574 | backend/app/api/simulation.py | 2617 | # 获取更详细的状态信息 | deliberate | backend-comment | Simulation |
| 575 | backend/app/api/simulation.py | 2621 | message = "环境正在运行,可以接收Interview命令" | review-needed | backend-string | Simulation |
| 576 | backend/app/api/simulation.py | 2623 | message = "环境未运行或已关闭" | review-needed | backend-string | Simulation |
| 577 | backend/app/api/simulation.py | 2648 | 关闭模拟环境 | deliberate | backend-docstring | Simulation |
| 578 | backend/app/api/simulation.py | 2650 | 向模拟发送关闭环境命令,使其优雅退出等待命令模式。 | deliberate | backend-docstring | Simulation |
| 579 | backend/app/api/simulation.py | 2652 | 注意:这不同于 /stop 接口,/stop 会强制终止进程, | deliberate | backend-docstring | Simulation |
| 580 | backend/app/api/simulation.py | 2653 | 而此接口会让模拟优雅地关闭环境并退出。 | deliberate | backend-docstring | Simulation |
| 581 | backend/app/api/simulation.py | 2655 | 请求(JSON): | deliberate | backend-docstring | Simulation |
| 582 | backend/app/api/simulation.py | 2657 | "simulation_id": "sim_xxxx", // 必填,模拟ID | review-needed | backend-string | Simulation |
| 583 | backend/app/api/simulation.py | 2658 | "timeout": 30 // 可选,超时时间(秒),默认30 | review-needed | backend-string | Simulation |
| 584 | backend/app/api/simulation.py | 2661 | 返回: | deliberate | backend-docstring | Simulation |
| 585 | backend/app/api/simulation.py | 2665 | "message": "环境关闭命令已发送", | review-needed | backend-string | Simulation |
| 586 | backend/app/api/simulation.py | 2688 | # 更新模拟状态 | deliberate | backend-comment | Simulation |
| 587 | backend/app/config.py | 2 | 配置管理 | deliberate | backend-docstring | n/a |
| 588 | backend/app/config.py | 3 | 统一从项目根目录的 .env 文件加载配置 | deliberate | backend-docstring | n/a |
| 589 | backend/app/config.py | 9 | # 加载项目根目录的 .env 文件 | deliberate | backend-comment | n/a |
| 590 | backend/app/config.py | 10 | # 路径: MiroFish/.env (相对于 backend/app/config.py) | deliberate | backend-comment | n/a |
| 591 | backend/app/config.py | 16 | # 如果根目录没有 .env,尝试加载环境变量(用于生产环境) | deliberate | backend-comment | n/a |
| 592 | backend/app/config.py | 21 | """Flask配置类""" | deliberate | backend-docstring | n/a |
| 593 | backend/app/config.py | 23 | # Flask配置 | deliberate | backend-comment | n/a |
| 594 | backend/app/config.py | 27 | # JSON配置 - 禁用ASCII转义,让中文直接显示(而不是 \uXXXX 格式) | deliberate | backend-comment | n/a |
| 595 | backend/app/config.py | 30 | # LLM配置(统一使用OpenAI格式) | deliberate | backend-comment | n/a |
| 596 | backend/app/config.py | 35 | # Neo4j + Graphiti配置(替代 Zep Cloud) | deliberate | backend-comment | n/a |
| 597 | backend/app/config.py | 53 | # Zep配置(保留兼容性,已废弃) | deliberate | backend-comment | n/a |
| 598 | backend/app/config.py | 56 | # 文件上传配置 | deliberate | backend-comment | n/a |
| 599 | backend/app/config.py | 61 | # 文本处理配置 | deliberate | backend-comment | n/a |
| 600 | backend/app/config.py | 62 | DEFAULT_CHUNK_SIZE = 500 # 默认切块大小 | deliberate | backend-docstring | n/a |
| 601 | backend/app/config.py | 63 | DEFAULT_CHUNK_OVERLAP = 50 # 默认重叠大小 | deliberate | backend-docstring | n/a |
| 602 | backend/app/config.py | 65 | # OASIS模拟配置 | deliberate | backend-comment | n/a |
| 603 | backend/app/config.py | 69 | # OASIS平台可用动作配置 | deliberate | backend-comment | n/a |
| 604 | backend/app/config.py | 79 | # Report Agent配置 | deliberate | backend-comment | n/a |
| 605 | backend/app/config.py | 86 | """验证必要配置""" | deliberate | backend-docstring | n/a |
| 606 | backend/app/config.py | 89 | errors.append("LLM_API_KEY 未配置") | review-needed | backend-string | n/a |
| 607 | backend/app/config.py | 91 | errors.append("NEO4J_PASSWORD 未配置") | review-needed | backend-string | n/a |
| 608 | backend/app/models/__init__.py | 2 | 数据模型模块 | deliberate | backend-docstring | n/a |
| 609 | backend/app/models/project.py | 2 | 项目上下文管理 | deliberate | backend-docstring | n/a |
| 610 | backend/app/models/project.py | 3 | 用于在服务端持久化项目状态,避免前端在接口间传递大量数据 | deliberate | backend-docstring | n/a |
| 611 | backend/app/models/project.py | 18 | """项目状态""" | deliberate | backend-docstring | n/a |
| 612 | backend/app/models/project.py | 19 | CREATED = "created" # 刚创建,文件已上传 | review-needed | backend-string | n/a |
| 613 | backend/app/models/project.py | 20 | ONTOLOGY_GENERATED = "ontology_generated" # 本体已生成 | review-needed | backend-string | n/a |
| 614 | backend/app/models/project.py | 21 | GRAPH_BUILDING = "graph_building" # 图谱构建中 | review-needed | backend-string | n/a |
| 615 | backend/app/models/project.py | 22 | GRAPH_COMPLETED = "graph_completed" # 图谱构建完成 | review-needed | backend-string | n/a |
| 616 | backend/app/models/project.py | 23 | FAILED = "failed" # 失败 | review-needed | backend-string | n/a |
| 617 | backend/app/models/project.py | 28 | """项目数据模型""" | deliberate | backend-docstring | n/a |
| 618 | backend/app/models/project.py | 35 | # 文件信息 | deliberate | backend-comment | n/a |
| 619 | backend/app/models/project.py | 39 | # 本体信息(接口1生成后填充) | deliberate | backend-comment | n/a |
| 620 | backend/app/models/project.py | 43 | # 图谱信息(接口2完成后填充) | deliberate | backend-comment | n/a |
| 621 | backend/app/models/project.py | 47 | # 配置 | deliberate | backend-comment | n/a |
| 622 | backend/app/models/project.py | 52 | # 错误信息 | deliberate | backend-comment | n/a |
| 623 | backend/app/models/project.py | 56 | """转换为字典""" | deliberate | backend-docstring | n/a |
| 624 | backend/app/models/project.py | 77 | """从字典创建""" | deliberate | backend-docstring | n/a |
| 625 | backend/app/models/project.py | 102 | """项目管理器 - 负责项目的持久化存储和检索""" | deliberate | backend-docstring | n/a |
| 626 | backend/app/models/project.py | 104 | # 项目存储根目录 | deliberate | backend-comment | n/a |
| 627 | backend/app/models/project.py | 109 | """确保项目目录存在""" | deliberate | backend-docstring | n/a |
| 628 | backend/app/models/project.py | 114 | """获取项目目录路径""" | deliberate | backend-docstring | n/a |
| 629 | backend/app/models/project.py | 119 | """获取项目元数据文件路径""" | deliberate | backend-docstring | n/a |
| 630 | backend/app/models/project.py | 124 | """获取项目文件存储目录""" | deliberate | backend-docstring | n/a |
| 631 | backend/app/models/project.py | 129 | """获取项目提取文本存储路径""" | deliberate | backend-docstring | n/a |
| 632 | backend/app/models/project.py | 135 | 创建新项目 | deliberate | backend-docstring | n/a |
| 633 | backend/app/models/project.py | 138 | name: 项目名称 | deliberate | backend-docstring | n/a |
| 634 | backend/app/models/project.py | 141 | 新创建的Project对象 | deliberate | backend-docstring | n/a |
| 635 | backend/app/models/project.py | 156 | # 创建项目目录结构 | deliberate | backend-comment | n/a |
| 636 | backend/app/models/project.py | 162 | # 保存项目元数据 | deliberate | backend-comment | n/a |
| 637 | backend/app/models/project.py | 169 | """保存项目元数据""" | deliberate | backend-docstring | n/a |
| 638 | backend/app/models/project.py | 179 | 获取项目 | deliberate | backend-docstring | n/a |
| 639 | backend/app/models/project.py | 182 | project_id: 项目ID | deliberate | backend-docstring | n/a |
| 640 | backend/app/models/project.py | 185 | Project对象,如果不存在返回None | deliberate | backend-docstring | n/a |
| 641 | backend/app/models/project.py | 200 | 列出所有项目 | deliberate | backend-docstring | n/a |
| 642 | backend/app/models/project.py | 203 | limit: 返回数量限制 | deliberate | backend-docstring | n/a |
| 643 | backend/app/models/project.py | 206 | 项目列表,按创建时间倒序 | deliberate | backend-docstring | n/a |
| 644 | backend/app/models/project.py | 216 | # 按创建时间倒序排序 | deliberate | backend-comment | n/a |
| 645 | backend/app/models/project.py | 224 | 删除项目及其所有文件 | deliberate | backend-docstring | n/a |
| 646 | backend/app/models/project.py | 227 | project_id: 项目ID | deliberate | backend-docstring | n/a |
| 647 | backend/app/models/project.py | 230 | 是否删除成功 | deliberate | backend-docstring | n/a |
| 648 | backend/app/models/project.py | 243 | 保存上传的文件到项目目录 | deliberate | backend-docstring | n/a |
| 649 | backend/app/models/project.py | 246 | project_id: 项目ID | deliberate | backend-docstring | n/a |
| 650 | backend/app/models/project.py | 247 | file_storage: Flask的FileStorage对象 | deliberate | backend-docstring | n/a |
| 651 | backend/app/models/project.py | 248 | original_filename: 原始文件名 | deliberate | backend-docstring | n/a |
| 652 | backend/app/models/project.py | 251 | 文件信息字典 {filename, path, size} | deliberate | backend-docstring | n/a |
| 653 | backend/app/models/project.py | 256 | # 生成安全的文件名 | deliberate | backend-comment | n/a |
| 654 | backend/app/models/project.py | 261 | # 保存文件 | deliberate | backend-comment | n/a |
| 655 | backend/app/models/project.py | 264 | # 获取文件大小 | deliberate | backend-comment | n/a |
| 656 | backend/app/models/project.py | 276 | """保存提取的文本""" | deliberate | backend-docstring | n/a |
| 657 | backend/app/models/project.py | 283 | """获取提取的文本""" | deliberate | backend-docstring | n/a |
| 658 | backend/app/models/project.py | 294 | """获取项目的所有文件路径""" | deliberate | backend-docstring | n/a |
| 659 | backend/app/models/task.py | 2 | 任务状态管理 | deliberate | backend-docstring | n/a |
| 660 | backend/app/models/task.py | 3 | 用于跟踪长时间运行的任务(如图谱构建) | deliberate | backend-docstring | n/a |
| 661 | backend/app/models/task.py | 17 | """任务状态枚举""" | deliberate | backend-docstring | n/a |
| 662 | backend/app/models/task.py | 18 | PENDING = "pending" # 等待中 | review-needed | backend-string | n/a |
| 663 | backend/app/models/task.py | 19 | PROCESSING = "processing" # 处理中 | review-needed | backend-string | n/a |
| 664 | backend/app/models/task.py | 20 | COMPLETED = "completed" # 已完成 | review-needed | backend-string | n/a |
| 665 | backend/app/models/task.py | 21 | FAILED = "failed" # 失败 | review-needed | backend-string | n/a |
| 666 | backend/app/models/task.py | 26 | """任务数据类""" | deliberate | backend-docstring | n/a |
| 667 | backend/app/models/task.py | 32 | progress: int = 0 # 总进度百分比 0-100 | deliberate | backend-docstring | n/a |
| 668 | backend/app/models/task.py | 33 | message: str = "" # 状态消息 | review-needed | backend-string | n/a |
| 669 | backend/app/models/task.py | 34 | result: Optional[Dict] = None # 任务结果 | deliberate | backend-docstring | n/a |
| 670 | backend/app/models/task.py | 35 | error: Optional[str] = None # 错误信息 | deliberate | backend-docstring | n/a |
| 671 | backend/app/models/task.py | 36 | metadata: Dict = field(default_factory=dict) # 额外元数据 | deliberate | backend-docstring | n/a |
| 672 | backend/app/models/task.py | 37 | progress_detail: Dict = field(default_factory=dict) # 详细进度信息 | deliberate | backend-docstring | n/a |
| 673 | backend/app/models/task.py | 40 | """转换为字典""" | deliberate | backend-docstring | n/a |
| 674 | backend/app/models/task.py | 58 | 任务管理器 | deliberate | backend-docstring | n/a |
| 675 | backend/app/models/task.py | 59 | 线程安全的任务状态管理 | deliberate | backend-docstring | n/a |
| 676 | backend/app/models/task.py | 66 | """单例模式""" | deliberate | backend-docstring | n/a |
| 677 | backend/app/models/task.py | 77 | 创建新任务 | deliberate | backend-docstring | n/a |
| 678 | backend/app/models/task.py | 80 | task_type: 任务类型 | deliberate | backend-docstring | n/a |
| 679 | backend/app/models/task.py | 81 | metadata: 额外元数据 | deliberate | backend-docstring | n/a |
| 680 | backend/app/models/task.py | 84 | 任务ID | deliberate | backend-docstring | n/a |
| 681 | backend/app/models/task.py | 104 | """获取任务""" | deliberate | backend-docstring | n/a |
| 682 | backend/app/models/task.py | 119 | 更新任务状态 | deliberate | backend-docstring | n/a |
| 683 | backend/app/models/task.py | 122 | task_id: 任务ID | deliberate | backend-docstring | n/a |
| 684 | backend/app/models/task.py | 123 | status: 新状态 | deliberate | backend-docstring | n/a |
| 685 | backend/app/models/task.py | 124 | progress: 进度 | deliberate | backend-docstring | n/a |
| 686 | backend/app/models/task.py | 125 | message: 消息 | deliberate | backend-docstring | n/a |
| 687 | backend/app/models/task.py | 126 | result: 结果 | deliberate | backend-docstring | n/a |
| 688 | backend/app/models/task.py | 127 | error: 错误信息 | deliberate | backend-docstring | n/a |
| 689 | backend/app/models/task.py | 128 | progress_detail: 详细进度信息 | deliberate | backend-docstring | n/a |
| 690 | backend/app/models/task.py | 148 | """标记任务完成""" | deliberate | backend-docstring | n/a |
| 691 | backend/app/models/task.py | 158 | """标记任务失败""" | deliberate | backend-docstring | n/a |
| 692 | backend/app/models/task.py | 167 | """列出任务""" | deliberate | backend-docstring | n/a |
| 693 | backend/app/models/task.py | 175 | """清理旧任务""" | deliberate | backend-docstring | n/a |
| 694 | backend/app/services/__init__.py | 2 | 业务服务模块 | deliberate | backend-docstring | n/a |
| 695 | backend/app/services/graph_builder.py | 2 | 图谱构建服务 | deliberate | backend-docstring | Graph Build |
| 696 | backend/app/services/graph_builder.py | 3 | 接口2:使用Zep API构建Standalone Graph | deliberate | backend-docstring | Graph Build |
| 697 | backend/app/services/graph_builder.py | 72 | """图谱信息""" | deliberate | backend-docstring | Graph Build |
| 698 | backend/app/services/graph_builder.py | 89 | 图谱构建服务 | deliberate | backend-docstring | Graph Build |
| 699 | backend/app/services/graph_builder.py | 90 | 负责调用Zep API构建知识图谱 | deliberate | backend-docstring | Graph Build |
| 700 | backend/app/services/graph_builder.py | 107 | 异步构建图谱 | deliberate | backend-docstring | Graph Build |
| 701 | backend/app/services/graph_builder.py | 110 | text: 输入文本 | deliberate | backend-docstring | Graph Build |
| 702 | backend/app/services/graph_builder.py | 111 | ontology: 本体定义(来自接口1的输出) | deliberate | backend-docstring | Graph Build |
| 703 | backend/app/services/graph_builder.py | 112 | graph_name: 图谱名称 | deliberate | backend-docstring | Graph Build |
| 704 | backend/app/services/graph_builder.py | 113 | chunk_size: 文本块大小 | deliberate | backend-docstring | Graph Build |
| 705 | backend/app/services/graph_builder.py | 114 | chunk_overlap: 块重叠大小 | deliberate | backend-docstring | Graph Build |
| 706 | backend/app/services/graph_builder.py | 115 | batch_size: 每批发送的块数量 | deliberate | backend-docstring | Graph Build |
| 707 | backend/app/services/graph_builder.py | 118 | 任务ID | deliberate | backend-docstring | Graph Build |
| 708 | backend/app/services/graph_builder.py | 120 | # 创建任务 | deliberate | backend-comment | Graph Build |
| 709 | backend/app/services/graph_builder.py | 133 | # 在后台线程中执行构建 | deliberate | backend-comment | Graph Build |
| 710 | backend/app/services/graph_builder.py | 154 | """图谱构建工作线程""" | deliberate | backend-docstring | Graph Build |
| 711 | backend/app/services/graph_builder.py | 164 | # 1. 创建图谱 | deliberate | backend-comment | Graph Build |
| 712 | backend/app/services/graph_builder.py | 172 | # 2. 设置本体 | deliberate | backend-comment | Graph Build |
| 713 | backend/app/services/graph_builder.py | 180 | # 3. 文本分块 | deliberate | backend-comment | Graph Build |
| 714 | backend/app/services/graph_builder.py | 189 | # 4. 分批发送数据 | deliberate | backend-comment | Graph Build |
| 715 | backend/app/services/graph_builder.py | 199 | # 5. 等待Zep处理完成 | deliberate | backend-comment | Graph Build |
| 716 | backend/app/services/graph_builder.py | 215 | # 6. 获取图谱信息 | deliberate | backend-comment | Graph Build |
| 717 | backend/app/services/graph_builder.py | 224 | # 完成 | deliberate | backend-comment | Graph Build |
| 718 | backend/app/services/graph_builder.py | 237 | """创建Zep图谱(公开方法)""" | deliberate | backend-docstring | Graph Build |
| 719 | backend/app/services/graph_builder.py | 249 | """设置图谱本体提示(Graphiti自动提取实体,本体作为提示存储)""" | deliberate | backend-docstring | Graph Build |
| 720 | backend/app/services/graph_builder.py | 264 | """分批添加文本到图谱,返回所有 episode 的 uuid 列表。 | deliberate | backend-docstring | Graph Build |
| 721 | backend/app/services/graph_builder.py | 265 | skip_chunks: 跳过已处理的块数(用于断点续传)。""" | review-needed | backend-string | Graph Build |
| 722 | backend/app/services/graph_builder.py | 282 | # 构建episode数据 | deliberate | backend-comment | Graph Build |
| 723 | backend/app/services/graph_builder.py | 288 | # 发送到Zep | deliberate | backend-comment | Graph Build |
| 724 | backend/app/services/graph_builder.py | 295 | # 收集返回的 episode uuid | deliberate | backend-comment | Graph Build |
| 725 | backend/app/services/graph_builder.py | 302 | # 避免请求过快 | deliberate | backend-comment | Graph Build |
| 726 | backend/app/services/graph_builder.py | 318 | """等待所有 episode 处理完成(通过查询每个 episode 的 processed 状态)""" | deliberate | backend-docstring | Graph Build |
| 727 | backend/app/services/graph_builder.py | 341 | # 检查每个 episode 的处理状态 | deliberate | backend-comment | Graph Build |
| 728 | backend/app/services/graph_builder.py | 352 | # 忽略单个查询错误,继续 | deliberate | backend-comment | Graph Build |
| 729 | backend/app/services/graph_builder.py | 363 | time.sleep(3) # 每3秒检查一次 | deliberate | backend-docstring | Graph Build |
| 730 | backend/app/services/graph_builder.py | 369 | """获取图谱信息""" | deliberate | backend-docstring | Graph Build |
| 731 | backend/app/services/graph_builder.py | 370 | # 获取节点(分页) | deliberate | backend-comment | Graph Build |
| 732 | backend/app/services/graph_builder.py | 373 | # 获取边(分页) | deliberate | backend-comment | Graph Build |
| 733 | backend/app/services/graph_builder.py | 376 | # 统计实体类型 | deliberate | backend-comment | Graph Build |
| 734 | backend/app/services/graph_builder.py | 393 | 获取完整图谱数据(包含详细信息) | deliberate | backend-docstring | Graph Build |
| 735 | backend/app/services/graph_builder.py | 396 | graph_id: 图谱ID | deliberate | backend-docstring | Graph Build |
| 736 | backend/app/services/graph_builder.py | 399 | 包含nodes和edges的字典,包括时间信息、属性等详细数据 | deliberate | backend-docstring | Graph Build |
| 737 | backend/app/services/graph_builder.py | 404 | # 创建节点映射用于获取节点名称 | deliberate | backend-comment | Graph Build |
| 738 | backend/app/services/graph_builder.py | 411 | # 获取创建时间 | deliberate | backend-comment | Graph Build |
| 739 | backend/app/services/graph_builder.py | 432 | # 获取时间信息 | deliberate | backend-comment | Graph Build |
| 740 | backend/app/services/graph_builder.py | 438 | # 获取 episodes | deliberate | backend-comment | Graph Build |
| 741 | backend/app/services/graph_builder.py | 445 | # 获取 fact_type | deliberate | backend-comment | Graph Build |
| 742 | backend/app/services/graph_builder.py | 474 | """删除图谱""" | deliberate | backend-docstring | Graph Build |
| 743 | backend/app/services/oasis_profile_generator.py | 2 | OASIS Agent Profile生成器 | deliberate | backend-docstring | Env Setup |
| 744 | backend/app/services/oasis_profile_generator.py | 3 | 将Zep图谱中的实体转换为OASIS模拟平台所需的Agent Profile格式 | deliberate | backend-docstring | Env Setup |
| 745 | backend/app/services/oasis_profile_generator.py | 5 | 优化改进: | deliberate | backend-docstring | Env Setup |
| 746 | backend/app/services/oasis_profile_generator.py | 6 | 1. 调用Zep检索功能二次丰富节点信息 | deliberate | backend-docstring | Env Setup |
| 747 | backend/app/services/oasis_profile_generator.py | 7 | 2. 优化提示词生成非常详细的人设 | deliberate | backend-docstring | Env Setup |
| 748 | backend/app/services/oasis_profile_generator.py | 8 | 3. 区分个人实体和抽象群体实体 | deliberate | backend-docstring | Env Setup |
| 749 | backend/app/services/oasis_profile_generator.py | 31 | """OASIS Agent Profile数据结构""" | deliberate | backend-docstring | Env Setup |
| 750 | backend/app/services/oasis_profile_generator.py | 32 | # 通用字段 | deliberate | backend-comment | Env Setup |
| 751 | backend/app/services/oasis_profile_generator.py | 39 | # 可选字段 - Reddit风格 | deliberate | backend-comment | Env Setup |
| 752 | backend/app/services/oasis_profile_generator.py | 42 | # 可选字段 - Twitter风格 | deliberate | backend-comment | Env Setup |
| 753 | backend/app/services/oasis_profile_generator.py | 47 | # 额外人设信息 | deliberate | backend-comment | Env Setup |
| 754 | backend/app/services/oasis_profile_generator.py | 55 | # 来源实体信息 | deliberate | backend-comment | Env Setup |
| 755 | backend/app/services/oasis_profile_generator.py | 62 | """转换为Reddit平台格式""" | deliberate | backend-docstring | Env Setup |
| 756 | backend/app/services/oasis_profile_generator.py | 65 | "username": self.user_name, # OASIS 库要求字段名为 username(无下划线) | gap | backend-prompt-label | Env Setup |
| 757 | backend/app/services/oasis_profile_generator.py | 73 | # 添加额外人设信息(如果有) | deliberate | backend-comment | Env Setup |
| 758 | backend/app/services/oasis_profile_generator.py | 90 | """转换为Twitter平台格式""" | deliberate | backend-docstring | Env Setup |
| 759 | backend/app/services/oasis_profile_generator.py | 93 | "username": self.user_name, # OASIS 库要求字段名为 username(无下划线) | gap | backend-prompt-label | Env Setup |
| 760 | backend/app/services/oasis_profile_generator.py | 103 | # 添加额外人设信息 | deliberate | backend-comment | Env Setup |
| 761 | backend/app/services/oasis_profile_generator.py | 120 | """转换为完整字典格式""" | deliberate | backend-docstring | Env Setup |
| 762 | backend/app/services/oasis_profile_generator.py | 145 | OASIS Profile生成器 | deliberate | backend-docstring | Env Setup |
| 763 | backend/app/services/oasis_profile_generator.py | 147 | 将Zep图谱中的实体转换为OASIS模拟所需的Agent Profile | deliberate | backend-docstring | Env Setup |
| 764 | backend/app/services/oasis_profile_generator.py | 149 | 优化特性: | deliberate | backend-docstring | Env Setup |
| 765 | backend/app/services/oasis_profile_generator.py | 150 | 1. 调用Zep图谱检索功能获取更丰富的上下文 | deliberate | backend-docstring | Env Setup |
| 766 | backend/app/services/oasis_profile_generator.py | 151 | 2. 生成非常详细的人设(包括基本信息、职业经历、性格特征、社交媒体行为等) | deliberate | backend-docstring | Env Setup |
| 767 | backend/app/services/oasis_profile_generator.py | 152 | 3. 区分个人实体和抽象群体实体 | deliberate | backend-docstring | Env Setup |
| 768 | backend/app/services/oasis_profile_generator.py | 155 | # MBTI类型列表 | deliberate | backend-comment | Env Setup |
| 769 | backend/app/services/oasis_profile_generator.py | 163 | # 常见国家列表 | deliberate | backend-comment | Env Setup |
| 770 | backend/app/services/oasis_profile_generator.py | 169 | # 个人类型实体(需要生成具体人设) | deliberate | backend-comment | Env Setup |
| 771 | backend/app/services/oasis_profile_generator.py | 175 | # 群体/机构类型实体(需要生成群体代表人设) | deliberate | backend-comment | Env Setup |
| 772 | backend/app/services/oasis_profile_generator.py | 194 | raise ValueError("LLM_API_KEY 未配置") | gap | backend-prompt-label | Env Setup |
| 773 | backend/app/services/oasis_profile_generator.py | 211 | 从Zep实体生成OASIS Agent Profile | deliberate | backend-docstring | Env Setup |
| 774 | backend/app/services/oasis_profile_generator.py | 214 | entity: Zep实体节点 | deliberate | backend-docstring | Env Setup |
| 775 | backend/app/services/oasis_profile_generator.py | 215 | user_id: 用户ID(用于OASIS) | deliberate | backend-docstring | Env Setup |
| 776 | backend/app/services/oasis_profile_generator.py | 216 | use_llm: 是否使用LLM生成详细人设 | deliberate | backend-docstring | Env Setup |
| 777 | backend/app/services/oasis_profile_generator.py | 223 | # 基础信息 | deliberate | backend-comment | Env Setup |
| 778 | backend/app/services/oasis_profile_generator.py | 227 | # 构建上下文信息 | deliberate | backend-comment | Env Setup |
| 779 | backend/app/services/oasis_profile_generator.py | 231 | # 使用LLM生成详细人设 | deliberate | backend-comment | Env Setup |
| 780 | backend/app/services/oasis_profile_generator.py | 240 | # 使用规则生成基础人设 | deliberate | backend-comment | Env Setup |
| 781 | backend/app/services/oasis_profile_generator.py | 269 | """生成用户名""" | deliberate | backend-docstring | Env Setup |
| 782 | backend/app/services/oasis_profile_generator.py | 270 | # 移除特殊字符,转换为小写 | deliberate | backend-comment | Env Setup |
| 783 | backend/app/services/oasis_profile_generator.py | 274 | # 添加随机后缀避免重复 | deliberate | backend-comment | Env Setup |
| 784 | backend/app/services/oasis_profile_generator.py | 280 | 使用Zep图谱混合搜索功能获取实体相关的丰富信息 | deliberate | backend-docstring | Env Setup |
| 785 | backend/app/services/oasis_profile_generator.py | 282 | Zep没有内置混合搜索接口,需要分别搜索edges和nodes然后合并结果。 | deliberate | backend-docstring | Env Setup |
| 786 | backend/app/services/oasis_profile_generator.py | 283 | 使用并行请求同时搜索,提高效率。 | deliberate | backend-docstring | Env Setup |
| 787 | backend/app/services/oasis_profile_generator.py | 286 | entity: 实体节点对象 | deliberate | backend-docstring | Env Setup |
| 788 | backend/app/services/oasis_profile_generator.py | 289 | 包含facts, node_summaries, context的字典 | deliberate | backend-docstring | Env Setup |
| 789 | backend/app/services/oasis_profile_generator.py | 304 | # 必须有graph_id才能进行搜索 | deliberate | backend-comment | Env Setup |
| 790 | backend/app/services/oasis_profile_generator.py | 312 | """搜索边(事实/关系)- 带重试机制""" | deliberate | backend-docstring | Env Setup |
| 791 | backend/app/services/oasis_profile_generator.py | 336 | """搜索节点(实体摘要)- 带重试机制""" | deliberate | backend-docstring | Env Setup |
| 792 | backend/app/services/oasis_profile_generator.py | 360 | # 并行执行edges和nodes搜索 | deliberate | backend-comment | Env Setup |
| 793 | backend/app/services/oasis_profile_generator.py | 365 | # 获取结果 | deliberate | backend-comment | Env Setup |
| 794 | backend/app/services/oasis_profile_generator.py | 369 | # 处理边搜索结果 | deliberate | backend-comment | Env Setup |
| 795 | backend/app/services/oasis_profile_generator.py | 377 | # 处理节点搜索结果 | deliberate | backend-comment | Env Setup |
| 796 | backend/app/services/oasis_profile_generator.py | 384 | all_summaries.add(f"相关实体: {node.name}") | gap | backend-prompt-label | Env Setup |
| 797 | backend/app/services/oasis_profile_generator.py | 387 | # 构建综合上下文 | deliberate | backend-comment | Env Setup |
| 798 | backend/app/services/oasis_profile_generator.py | 390 | context_parts.append("事实信息:\n" + "\n".join(f"- {f}" for f in results["facts"][:20])) | gap | backend-prompt-label | Env Setup |
| 799 | backend/app/services/oasis_profile_generator.py | 392 | context_parts.append("相关实体:\n" + "\n".join(f"- {s}" for s in results["node_summaries"][:10])) | gap | backend-prompt-label | Env Setup |
| 800 | backend/app/services/oasis_profile_generator.py | 406 | 构建实体的完整上下文信息 | deliberate | backend-docstring | Env Setup |
| 801 | backend/app/services/oasis_profile_generator.py | 408 | 包括: | deliberate | backend-docstring | Env Setup |
| 802 | backend/app/services/oasis_profile_generator.py | 409 | 1. 实体本身的边信息(事实) | deliberate | backend-docstring | Env Setup |
| 803 | backend/app/services/oasis_profile_generator.py | 410 | 2. 关联节点的详细信息 | deliberate | backend-docstring | Env Setup |
| 804 | backend/app/services/oasis_profile_generator.py | 411 | 3. Zep混合检索到的丰富信息 | deliberate | backend-docstring | Env Setup |
| 805 | backend/app/services/oasis_profile_generator.py | 415 | # 1. 添加实体属性信息 | deliberate | backend-comment | Env Setup |
| 806 | backend/app/services/oasis_profile_generator.py | 422 | context_parts.append("### 实体属性\n" + "\n".join(attrs)) | gap | backend-prompt-label | Env Setup |
| 807 | backend/app/services/oasis_profile_generator.py | 424 | # 2. 添加相关边信息(事实/关系) | deliberate | backend-comment | Env Setup |
| 808 | backend/app/services/oasis_profile_generator.py | 428 | for edge in entity.related_edges: # 不限制数量 | deliberate | backend-docstring | Env Setup |
| 809 | backend/app/services/oasis_profile_generator.py | 438 | relationships.append(f"- {entity.name} --[{edge_name}]--> (相关实体)") | gap | backend-prompt-label | Env Setup |
| 810 | backend/app/services/oasis_profile_generator.py | 440 | relationships.append(f"- (相关实体) --[{edge_name}]--> {entity.name}") | gap | backend-prompt-label | Env Setup |
| 811 | backend/app/services/oasis_profile_generator.py | 443 | context_parts.append("### 相关事实和关系\n" + "\n".join(relationships)) | gap | backend-prompt-label | Env Setup |
| 812 | backend/app/services/oasis_profile_generator.py | 445 | # 3. 添加关联节点的详细信息 | deliberate | backend-comment | Env Setup |
| 813 | backend/app/services/oasis_profile_generator.py | 448 | for node in entity.related_nodes: # 不限制数量 | deliberate | backend-docstring | Env Setup |
| 814 | backend/app/services/oasis_profile_generator.py | 453 | # 过滤掉默认标签 | deliberate | backend-comment | Env Setup |
| 815 | backend/app/services/oasis_profile_generator.py | 463 | context_parts.append("### 关联实体信息\n" + "\n".join(related_info)) | gap | backend-prompt-label | Env Setup |
| 816 | backend/app/services/oasis_profile_generator.py | 465 | # 4. 使用Zep混合检索获取更丰富的信息 | deliberate | backend-comment | Env Setup |
| 817 | backend/app/services/oasis_profile_generator.py | 469 | # 去重:排除已存在的事实 | deliberate | backend-comment | Env Setup |
| 818 | backend/app/services/oasis_profile_generator.py | 472 | context_parts.append("### Zep检索到的事实信息\n" + "\n".join(f"- {f}" for f in new_facts[:15])) | gap | backend-prompt-label | Env Setup |
| 819 | backend/app/services/oasis_profile_generator.py | 475 | context_parts.append("### Zep检索到的相关节点\n" + "\n".join(f"- {s}" for s in zep_results["node_summaries"][:10])) | gap | backend-prompt-label | Env Setup |
| 820 | backend/app/services/oasis_profile_generator.py | 480 | """判断是否是个人类型实体""" | deliberate | backend-docstring | Env Setup |
| 821 | backend/app/services/oasis_profile_generator.py | 484 | """判断是否是群体/机构类型实体""" | deliberate | backend-docstring | Env Setup |
| 822 | backend/app/services/oasis_profile_generator.py | 496 | 使用LLM生成非常详细的人设 | deliberate | backend-docstring | Env Setup |
| 823 | backend/app/services/oasis_profile_generator.py | 498 | 根据实体类型区分: | deliberate | backend-docstring | Env Setup |
| 824 | backend/app/services/oasis_profile_generator.py | 499 | - 个人实体:生成具体的人物设定 | deliberate | backend-docstring | Env Setup |
| 825 | backend/app/services/oasis_profile_generator.py | 500 | - 群体/机构实体:生成代表性账号设定 | deliberate | backend-docstring | Env Setup |
| 826 | backend/app/services/oasis_profile_generator.py | 514 | # 尝试多次生成,直到成功或达到最大重试次数 | deliberate | backend-comment | Env Setup |
| 827 | backend/app/services/oasis_profile_generator.py | 527 | temperature=0.7 - (attempt * 0.1) # 每次重试降低温度 | deliberate | backend-docstring | Env Setup |
| 828 | backend/app/services/oasis_profile_generator.py | 528 | # 不设置max_tokens,让LLM自由发挥 | deliberate | backend-comment | Env Setup |
| 829 | backend/app/services/oasis_profile_generator.py | 533 | # 检查是否被截断(finish_reason不是'stop') | deliberate | backend-comment | Env Setup |
| 830 | backend/app/services/oasis_profile_generator.py | 539 | # 尝试解析JSON | deliberate | backend-comment | Env Setup |
| 831 | backend/app/services/oasis_profile_generator.py | 543 | # 验证必需字段 | deliberate | backend-comment | Env Setup |
| 832 | backend/app/services/oasis_profile_generator.py | 547 | result["persona"] = entity_summary or f"{entity_name}是一个{entity_type}。" | gap | backend-prompt-label | Env Setup |
| 833 | backend/app/services/oasis_profile_generator.py | 554 | # 尝试修复JSON | deliberate | backend-comment | Env Setup |
| 834 | backend/app/services/oasis_profile_generator.py | 566 | time.sleep(1 * (attempt + 1)) # 指数退避 | deliberate | backend-docstring | Env Setup |
| 835 | backend/app/services/oasis_profile_generator.py | 574 | """修复被截断的JSON(输出被max_tokens限制截断)""" | deliberate | backend-docstring | Env Setup |
| 836 | backend/app/services/oasis_profile_generator.py | 577 | # 如果JSON被截断,尝试闭合它 | deliberate | backend-comment | Env Setup |
| 837 | backend/app/services/oasis_profile_generator.py | 580 | # 计算未闭合的括号 | deliberate | backend-comment | Env Setup |
| 838 | backend/app/services/oasis_profile_generator.py | 584 | # 检查是否有未闭合的字符串 | deliberate | backend-comment | Env Setup |
| 839 | backend/app/services/oasis_profile_generator.py | 585 | # 简单检查:如果最后一个引号后没有逗号或闭合括号,可能是字符串被截断 | deliberate | backend-comment | Env Setup |
| 840 | backend/app/services/oasis_profile_generator.py | 587 | # 尝试闭合字符串 | deliberate | backend-comment | Env Setup |
| 841 | backend/app/services/oasis_profile_generator.py | 590 | # 闭合括号 | deliberate | backend-comment | Env Setup |
| 842 | backend/app/services/oasis_profile_generator.py | 597 | """尝试修复损坏的JSON""" | deliberate | backend-docstring | Env Setup |
| 843 | backend/app/services/oasis_profile_generator.py | 600 | # 1. 首先尝试修复被截断的情况 | deliberate | backend-comment | Env Setup |
| 844 | backend/app/services/oasis_profile_generator.py | 603 | # 2. 尝试提取JSON部分 | deliberate | backend-comment | Env Setup |
| 845 | backend/app/services/oasis_profile_generator.py | 608 | # 3. 处理字符串中的换行符问题 | deliberate | backend-comment | Env Setup |
| 846 | backend/app/services/oasis_profile_generator.py | 609 | # 找到所有字符串值并替换其中的换行符 | deliberate | backend-comment | Env Setup |
| 847 | backend/app/services/oasis_profile_generator.py | 612 | # 替换字符串内的实际换行符为空格 | deliberate | backend-comment | Env Setup |
| 848 | backend/app/services/oasis_profile_generator.py | 614 | # 替换多余空格 | deliberate | backend-comment | Env Setup |
| 849 | backend/app/services/oasis_profile_generator.py | 618 | # 匹配JSON字符串值 | deliberate | backend-comment | Env Setup |
| 850 | backend/app/services/oasis_profile_generator.py | 621 | # 4. 尝试解析 | deliberate | backend-comment | Env Setup |
| 851 | backend/app/services/oasis_profile_generator.py | 627 | # 5. 如果还是失败,尝试更激进的修复 | deliberate | backend-comment | Env Setup |
| 852 | backend/app/services/oasis_profile_generator.py | 629 | # 移除所有控制字符 | deliberate | backend-comment | Env Setup |
| 853 | backend/app/services/oasis_profile_generator.py | 631 | # 替换所有连续空白 | deliberate | backend-comment | Env Setup |
| 854 | backend/app/services/oasis_profile_generator.py | 639 | # 6. 尝试从内容中提取部分信息 | deliberate | backend-comment | Env Setup |
| 855 | backend/app/services/oasis_profile_generator.py | 641 | persona_match = re.search(r'"persona"\s*:\s*"([^"]*)', content) # 可能被截断 | gap | backend-prompt-label | Env Setup |
| 856 | backend/app/services/oasis_profile_generator.py | 644 | persona = persona_match.group(1) if persona_match else (entity_summary or f"{entity_name}是一个{entity_type}。") | gap | backend-prompt-label | Env Setup |
| 857 | backend/app/services/oasis_profile_generator.py | 646 | # 如果提取到了有意义的内容,标记为已修复 | deliberate | backend-comment | Env Setup |
| 858 | backend/app/services/oasis_profile_generator.py | 655 | # 7. 完全失败,返回基础结构 | deliberate | backend-comment | Env Setup |
| 859 | backend/app/services/oasis_profile_generator.py | 659 | "persona": entity_summary or f"{entity_name}是一个{entity_type}。" | gap | backend-prompt-label | Env Setup |
| 860 | backend/app/services/oasis_profile_generator.py | 663 | """获取系统提示词""" | deliberate | backend-docstring | Env Setup |
| 861 | backend/app/services/oasis_profile_generator.py | 664 | base_prompt = "你是社交媒体用户画像生成专家。生成详细、真实的人设用于舆论模拟,最大程度还原已有现实情况。必须返回有效的JSON格式,所有字符串值不能包含未转义的换行符。" | gap | backend-prompt-label | Env Setup |
| 862 | backend/app/services/oasis_profile_generator.py | 675 | """构建个人实体的详细人设提示词""" | deliberate | backend-docstring | Env Setup |
| 863 | backend/app/services/oasis_profile_generator.py | 677 | attrs_str = json.dumps(entity_attributes, ensure_ascii=False) if entity_attributes else "无" | gap | backend-prompt-label | Env Setup |
| 864 | backend/app/services/oasis_profile_generator.py | 678 | context_str = context[:3000] if context else "无额外上下文" | gap | backend-prompt-label | Env Setup |
| 865 | backend/app/services/oasis_profile_generator.py | 680 | return f"""为实体生成详细的社交媒体用户人设,最大程度还原已有现实情况。 | gap | backend-prompt-label | Env Setup |
| 866 | backend/app/services/oasis_profile_generator.py | 682 | 实体名称: {entity_name} | deliberate | backend-docstring | Env Setup |
| 867 | backend/app/services/oasis_profile_generator.py | 683 | 实体类型: {entity_type} | deliberate | backend-docstring | Env Setup |
| 868 | backend/app/services/oasis_profile_generator.py | 684 | 实体摘要: {entity_summary} | deliberate | backend-docstring | Env Setup |
| 869 | backend/app/services/oasis_profile_generator.py | 685 | 实体属性: {attrs_str} | deliberate | backend-docstring | Env Setup |
| 870 | backend/app/services/oasis_profile_generator.py | 687 | 上下文信息: | deliberate | backend-docstring | Env Setup |
| 871 | backend/app/services/oasis_profile_generator.py | 690 | 请生成JSON,包含以下字段: | deliberate | backend-docstring | Env Setup |
| 872 | backend/app/services/oasis_profile_generator.py | 692 | 1. bio: 社交媒体简介,200字 | deliberate | backend-docstring | Env Setup |
| 873 | backend/app/services/oasis_profile_generator.py | 693 | 2. persona: 详细人设描述(2000字的纯文本),需包含: | deliberate | backend-docstring | Env Setup |
| 874 | backend/app/services/oasis_profile_generator.py | 694 | - 基本信息(年龄、职业、教育背景、所在地) | deliberate | backend-docstring | Env Setup |
| 875 | backend/app/services/oasis_profile_generator.py | 695 | - 人物背景(重要经历、与事件的关联、社会关系) | deliberate | backend-docstring | Env Setup |
| 876 | backend/app/services/oasis_profile_generator.py | 696 | - 性格特征(MBTI类型、核心性格、情绪表达方式) | deliberate | backend-docstring | Env Setup |
| 877 | backend/app/services/oasis_profile_generator.py | 697 | - 社交媒体行为(发帖频率、内容偏好、互动风格、语言特点) | deliberate | backend-docstring | Env Setup |
| 878 | backend/app/services/oasis_profile_generator.py | 698 | - 立场观点(对话题的态度、可能被激怒/感动的内容) | deliberate | backend-docstring | Env Setup |
| 879 | backend/app/services/oasis_profile_generator.py | 699 | - 独特特征(口头禅、特殊经历、个人爱好) | deliberate | backend-docstring | Env Setup |
| 880 | backend/app/services/oasis_profile_generator.py | 700 | - 个人记忆(人设的重要部分,要介绍这个个体与事件的关联,以及这个个体在事件中的已有动作与反应) | deliberate | backend-docstring | Env Setup |
| 881 | backend/app/services/oasis_profile_generator.py | 701 | 3. age: 年龄数字(必须是整数) | deliberate | backend-docstring | Env Setup |
| 882 | backend/app/services/oasis_profile_generator.py | 702 | 4. gender: 性别,必须是英文: "male" 或 "female" | gap | backend-prompt-label | Env Setup |
| 883 | backend/app/services/oasis_profile_generator.py | 703 | 5. mbti: MBTI类型(如INTJ、ENFP等) | deliberate | backend-docstring | Env Setup |
| 884 | backend/app/services/oasis_profile_generator.py | 704 | 6. country: 国家(使用中文,如"中国") | gap | backend-prompt-label | Env Setup |
| 885 | backend/app/services/oasis_profile_generator.py | 705 | 7. profession: 职业 | deliberate | backend-docstring | Env Setup |
| 886 | backend/app/services/oasis_profile_generator.py | 706 | 8. interested_topics: 感兴趣话题数组 | deliberate | backend-docstring | Env Setup |
| 887 | backend/app/services/oasis_profile_generator.py | 708 | 重要: | deliberate | backend-docstring | Env Setup |
| 888 | backend/app/services/oasis_profile_generator.py | 709 | - 所有字段值必须是字符串或数字,不要使用换行符 | deliberate | backend-docstring | Env Setup |
| 889 | backend/app/services/oasis_profile_generator.py | 710 | - persona必须是一段连贯的文字描述 | deliberate | backend-docstring | Env Setup |
| 890 | backend/app/services/oasis_profile_generator.py | 711 | - {get_language_instruction()} (gender字段必须用英文male/female) | deliberate | backend-docstring | Env Setup |
| 891 | backend/app/services/oasis_profile_generator.py | 712 | - 内容要与实体信息保持一致 | deliberate | backend-docstring | Env Setup |
| 892 | backend/app/services/oasis_profile_generator.py | 713 | - age必须是有效的整数,gender必须是"male"或"female" | gap | backend-prompt-label | Env Setup |
| 893 | backend/app/services/oasis_profile_generator.py | 724 | """构建群体/机构实体的详细人设提示词""" | deliberate | backend-docstring | Env Setup |
| 894 | backend/app/services/oasis_profile_generator.py | 726 | attrs_str = json.dumps(entity_attributes, ensure_ascii=False) if entity_attributes else "无" | gap | backend-prompt-label | Env Setup |
| 895 | backend/app/services/oasis_profile_generator.py | 727 | context_str = context[:3000] if context else "无额外上下文" | gap | backend-prompt-label | Env Setup |
| 896 | backend/app/services/oasis_profile_generator.py | 729 | return f"""为机构/群体实体生成详细的社交媒体账号设定,最大程度还原已有现实情况。 | gap | backend-prompt-label | Env Setup |
| 897 | backend/app/services/oasis_profile_generator.py | 731 | 实体名称: {entity_name} | deliberate | backend-docstring | Env Setup |
| 898 | backend/app/services/oasis_profile_generator.py | 732 | 实体类型: {entity_type} | deliberate | backend-docstring | Env Setup |
| 899 | backend/app/services/oasis_profile_generator.py | 733 | 实体摘要: {entity_summary} | deliberate | backend-docstring | Env Setup |
| 900 | backend/app/services/oasis_profile_generator.py | 734 | 实体属性: {attrs_str} | deliberate | backend-docstring | Env Setup |
| 901 | backend/app/services/oasis_profile_generator.py | 736 | 上下文信息: | deliberate | backend-docstring | Env Setup |
| 902 | backend/app/services/oasis_profile_generator.py | 739 | 请生成JSON,包含以下字段: | deliberate | backend-docstring | Env Setup |
| 903 | backend/app/services/oasis_profile_generator.py | 741 | 1. bio: 官方账号简介,200字,专业得体 | deliberate | backend-docstring | Env Setup |
| 904 | backend/app/services/oasis_profile_generator.py | 742 | 2. persona: 详细账号设定描述(2000字的纯文本),需包含: | deliberate | backend-docstring | Env Setup |
| 905 | backend/app/services/oasis_profile_generator.py | 743 | - 机构基本信息(正式名称、机构性质、成立背景、主要职能) | deliberate | backend-docstring | Env Setup |
| 906 | backend/app/services/oasis_profile_generator.py | 744 | - 账号定位(账号类型、目标受众、核心功能) | deliberate | backend-docstring | Env Setup |
| 907 | backend/app/services/oasis_profile_generator.py | 745 | - 发言风格(语言特点、常用表达、禁忌话题) | deliberate | backend-docstring | Env Setup |
| 908 | backend/app/services/oasis_profile_generator.py | 746 | - 发布内容特点(内容类型、发布频率、活跃时间段) | deliberate | backend-docstring | Env Setup |
| 909 | backend/app/services/oasis_profile_generator.py | 747 | - 立场态度(对核心话题的官方立场、面对争议的处理方式) | deliberate | backend-docstring | Env Setup |
| 910 | backend/app/services/oasis_profile_generator.py | 748 | - 特殊说明(代表的群体画像、运营习惯) | deliberate | backend-docstring | Env Setup |
| 911 | backend/app/services/oasis_profile_generator.py | 749 | - 机构记忆(机构人设的重要部分,要介绍这个机构与事件的关联,以及这个机构在事件中的已有动作与反应) | deliberate | backend-docstring | Env Setup |
| 912 | backend/app/services/oasis_profile_generator.py | 750 | 3. age: 固定填30(机构账号的虚拟年龄) | deliberate | backend-docstring | Env Setup |
| 913 | backend/app/services/oasis_profile_generator.py | 751 | 4. gender: 固定填"other"(机构账号使用other表示非个人) | gap | backend-prompt-label | Env Setup |
| 914 | backend/app/services/oasis_profile_generator.py | 752 | 5. mbti: MBTI类型,用于描述账号风格,如ISTJ代表严谨保守 | deliberate | backend-docstring | Env Setup |
| 915 | backend/app/services/oasis_profile_generator.py | 753 | 6. country: 国家(使用中文,如"中国") | gap | backend-prompt-label | Env Setup |
| 916 | backend/app/services/oasis_profile_generator.py | 754 | 7. profession: 机构职能描述 | deliberate | backend-docstring | Env Setup |
| 917 | backend/app/services/oasis_profile_generator.py | 755 | 8. interested_topics: 关注领域数组 | deliberate | backend-docstring | Env Setup |
| 918 | backend/app/services/oasis_profile_generator.py | 757 | 重要: | deliberate | backend-docstring | Env Setup |
| 919 | backend/app/services/oasis_profile_generator.py | 758 | - 所有字段值必须是字符串或数字,不允许null值 | deliberate | backend-docstring | Env Setup |
| 920 | backend/app/services/oasis_profile_generator.py | 759 | - persona必须是一段连贯的文字描述,不要使用换行符 | deliberate | backend-docstring | Env Setup |
| 921 | backend/app/services/oasis_profile_generator.py | 760 | - {get_language_instruction()} (gender字段必须用英文"other") | gap | backend-prompt-label | Env Setup |
| 922 | backend/app/services/oasis_profile_generator.py | 761 | - age必须是整数30,gender必须是字符串"other" | gap | backend-prompt-label | Env Setup |
| 923 | backend/app/services/oasis_profile_generator.py | 762 | - 机构账号发言要符合其身份定位""" | gap | backend-prompt-label | Env Setup |
| 924 | backend/app/services/oasis_profile_generator.py | 771 | """使用规则生成基础人设""" | deliberate | backend-docstring | Env Setup |
| 925 | backend/app/services/oasis_profile_generator.py | 773 | # 根据实体类型生成不同的人设 | deliberate | backend-comment | Env Setup |
| 926 | backend/app/services/oasis_profile_generator.py | 804 | "age": 30, # 机构虚拟年龄 | gap | backend-prompt-label | Env Setup |
| 927 | backend/app/services/oasis_profile_generator.py | 805 | "gender": "other", # 机构使用other | gap | backend-prompt-label | Env Setup |
| 928 | backend/app/services/oasis_profile_generator.py | 806 | "mbti": "ISTJ", # 机构风格:严谨保守 | gap | backend-prompt-label | Env Setup |
| 929 | backend/app/services/oasis_profile_generator.py | 807 | "country": "中国", | gap | backend-prompt-label | Env Setup |
| 930 | backend/app/services/oasis_profile_generator.py | 816 | "age": 30, # 机构虚拟年龄 | gap | backend-prompt-label | Env Setup |
| 931 | backend/app/services/oasis_profile_generator.py | 817 | "gender": "other", # 机构使用other | gap | backend-prompt-label | Env Setup |
| 932 | backend/app/services/oasis_profile_generator.py | 818 | "mbti": "ISTJ", # 机构风格:严谨保守 | gap | backend-prompt-label | Env Setup |
| 933 | backend/app/services/oasis_profile_generator.py | 819 | "country": "中国", | gap | backend-prompt-label | Env Setup |
| 934 | backend/app/services/oasis_profile_generator.py | 825 | # 默认人设 | deliberate | backend-comment | Env Setup |
| 935 | backend/app/services/oasis_profile_generator.py | 838 | """设置图谱ID用于Zep检索""" | deliberate | backend-docstring | Env Setup |
| 936 | backend/app/services/oasis_profile_generator.py | 852 | 批量从实体生成Agent Profile(支持并行生成) | deliberate | backend-docstring | Env Setup |
| 937 | backend/app/services/oasis_profile_generator.py | 855 | entities: 实体列表 | deliberate | backend-docstring | Env Setup |
| 938 | backend/app/services/oasis_profile_generator.py | 856 | use_llm: 是否使用LLM生成详细人设 | deliberate | backend-docstring | Env Setup |
| 939 | backend/app/services/oasis_profile_generator.py | 857 | progress_callback: 进度回调函数 (current, total, message) | deliberate | backend-docstring | Env Setup |
| 940 | backend/app/services/oasis_profile_generator.py | 858 | graph_id: 图谱ID,用于Zep检索获取更丰富上下文 | deliberate | backend-docstring | Env Setup |
| 941 | backend/app/services/oasis_profile_generator.py | 859 | parallel_count: 并行生成数量,默认5 | deliberate | backend-docstring | Env Setup |
| 942 | backend/app/services/oasis_profile_generator.py | 860 | realtime_output_path: 实时写入的文件路径(如果提供,每生成一个就写入一次) | deliberate | backend-docstring | Env Setup |
| 943 | backend/app/services/oasis_profile_generator.py | 861 | output_platform: 输出平台格式 ("reddit" 或 "twitter") | gap | backend-prompt-label | Env Setup |
| 944 | backend/app/services/oasis_profile_generator.py | 864 | Agent Profile列表 | deliberate | backend-docstring | Env Setup |
| 945 | backend/app/services/oasis_profile_generator.py | 869 | # 设置graph_id用于Zep检索 | deliberate | backend-comment | Env Setup |
| 946 | backend/app/services/oasis_profile_generator.py | 874 | profiles = [None] * total # 预分配列表保持顺序 | deliberate | backend-docstring | Env Setup |
| 947 | backend/app/services/oasis_profile_generator.py | 875 | completed_count = [0] # 使用列表以便在闭包中修改 | deliberate | backend-docstring | Env Setup |
| 948 | backend/app/services/oasis_profile_generator.py | 878 | # 实时写入文件的辅助函数 | deliberate | backend-comment | Env Setup |
| 949 | backend/app/services/oasis_profile_generator.py | 880 | """实时保存已生成的 profiles 到文件""" | deliberate | backend-docstring | Env Setup |
| 950 | backend/app/services/oasis_profile_generator.py | 885 | # 过滤出已生成的 profiles | deliberate | backend-comment | Env Setup |
| 951 | backend/app/services/oasis_profile_generator.py | 892 | # Reddit JSON 格式 | deliberate | backend-comment | Env Setup |
| 952 | backend/app/services/oasis_profile_generator.py | 897 | # Twitter CSV 格式 | deliberate | backend-comment | Env Setup |
| 953 | backend/app/services/oasis_profile_generator.py | 913 | """生成单个profile的工作函数""" | deliberate | backend-docstring | Env Setup |
| 954 | backend/app/services/oasis_profile_generator.py | 924 | # 实时输出生成的人设到控制台和日志 | deliberate | backend-comment | Env Setup |
| 955 | backend/app/services/oasis_profile_generator.py | 931 | # 创建一个基础profile | deliberate | backend-comment | Env Setup |
| 956 | backend/app/services/oasis_profile_generator.py | 945 | print(f"开始生成Agent人设 - 共 {total} 个实体,并行数: {parallel_count}") | gap | backend-log | Logs |
| 957 | backend/app/services/oasis_profile_generator.py | 948 | # 使用线程池并行执行 | deliberate | backend-comment | Env Setup |
| 958 | backend/app/services/oasis_profile_generator.py | 950 | # 提交所有任务 | deliberate | backend-comment | Env Setup |
| 959 | backend/app/services/oasis_profile_generator.py | 956 | # 收集结果 | deliberate | backend-comment | Env Setup |
| 960 | backend/app/services/oasis_profile_generator.py | 969 | # 实时写入文件 | deliberate | backend-comment | Env Setup |
| 961 | backend/app/services/oasis_profile_generator.py | 976 | f"已完成 {current}/{total}: {entity.name}({entity_type})" | gap | backend-prompt-label | Env Setup |
| 962 | backend/app/services/oasis_profile_generator.py | 997 | # 实时写入文件(即使是备用人设) | deliberate | backend-comment | Env Setup |
| 963 | backend/app/services/oasis_profile_generator.py | 1001 | print(f"人设生成完成!共生成 {len([p for p in profiles if p])} 个Agent") | gap | backend-log | Logs |
| 964 | backend/app/services/oasis_profile_generator.py | 1007 | """实时输出生成的人设到控制台(完整内容,不截断)""" | deliberate | backend-docstring | Env Setup |
| 965 | backend/app/services/oasis_profile_generator.py | 1010 | # 构建完整输出内容(不截断) | deliberate | backend-comment | Env Setup |
| 966 | backend/app/services/oasis_profile_generator.py | 1011 | topics_str = ', '.join(profile.interested_topics) if profile.interested_topics else '无' | gap | backend-prompt-label | Env Setup |
| 967 | backend/app/services/oasis_profile_generator.py | 1017 | f"用户名: {profile.user_name}", | gap | backend-prompt-label | Env Setup |
| 968 | backend/app/services/oasis_profile_generator.py | 1019 | f"【简介】", | gap | backend-prompt-label | Env Setup |
| 969 | backend/app/services/oasis_profile_generator.py | 1022 | f"【详细人设】", | gap | backend-prompt-label | Env Setup |
| 970 | backend/app/services/oasis_profile_generator.py | 1025 | f"【基本属性】", | gap | backend-prompt-label | Env Setup |
| 971 | backend/app/services/oasis_profile_generator.py | 1026 | f"年龄: {profile.age} | 性别: {profile.gender} | MBTI: {profile.mbti}", | gap | backend-prompt-label | Env Setup |
| 972 | backend/app/services/oasis_profile_generator.py | 1027 | f"职业: {profile.profession} | 国家: {profile.country}", | gap | backend-prompt-label | Env Setup |
| 973 | backend/app/services/oasis_profile_generator.py | 1028 | f"兴趣话题: {topics_str}", | gap | backend-prompt-label | Env Setup |
| 974 | backend/app/services/oasis_profile_generator.py | 1034 | # 只输出到控制台(避免重复,logger不再输出完整内容) | deliberate | backend-comment | Env Setup |
| 975 | backend/app/services/oasis_profile_generator.py | 1044 | 保存Profile到文件(根据平台选择正确格式) | deliberate | backend-docstring | Env Setup |
| 976 | backend/app/services/oasis_profile_generator.py | 1046 | OASIS平台格式要求: | deliberate | backend-docstring | Env Setup |
| 977 | backend/app/services/oasis_profile_generator.py | 1047 | - Twitter: CSV格式 | deliberate | backend-docstring | Env Setup |
| 978 | backend/app/services/oasis_profile_generator.py | 1048 | - Reddit: JSON格式 | deliberate | backend-docstring | Env Setup |
| 979 | backend/app/services/oasis_profile_generator.py | 1051 | profiles: Profile列表 | deliberate | backend-docstring | Env Setup |
| 980 | backend/app/services/oasis_profile_generator.py | 1052 | file_path: 文件路径 | deliberate | backend-docstring | Env Setup |
| 981 | backend/app/services/oasis_profile_generator.py | 1053 | platform: 平台类型 ("reddit" 或 "twitter") | gap | backend-prompt-label | Env Setup |
| 982 | backend/app/services/oasis_profile_generator.py | 1062 | 保存Twitter Profile为CSV格式(符合OASIS官方要求) | deliberate | backend-docstring | Env Setup |
| 983 | backend/app/services/oasis_profile_generator.py | 1064 | OASIS Twitter要求的CSV字段: | deliberate | backend-docstring | Env Setup |
| 984 | backend/app/services/oasis_profile_generator.py | 1065 | - user_id: 用户ID(根据CSV顺序从0开始) | deliberate | backend-docstring | Env Setup |
| 985 | backend/app/services/oasis_profile_generator.py | 1066 | - name: 用户真实姓名 | deliberate | backend-docstring | Env Setup |
| 986 | backend/app/services/oasis_profile_generator.py | 1067 | - username: 系统中的用户名 | deliberate | backend-docstring | Env Setup |
| 987 | backend/app/services/oasis_profile_generator.py | 1068 | - user_char: 详细人设描述(注入到LLM系统提示中,指导Agent行为) | deliberate | backend-docstring | Env Setup |
| 988 | backend/app/services/oasis_profile_generator.py | 1069 | - description: 简短的公开简介(显示在用户资料页面) | deliberate | backend-docstring | Env Setup |
| 989 | backend/app/services/oasis_profile_generator.py | 1071 | user_char vs description 区别: | deliberate | backend-docstring | Env Setup |
| 990 | backend/app/services/oasis_profile_generator.py | 1072 | - user_char: 内部使用,LLM系统提示,决定Agent如何思考和行动 | deliberate | backend-docstring | Env Setup |
| 991 | backend/app/services/oasis_profile_generator.py | 1073 | - description: 外部显示,其他用户可见的简介 | deliberate | backend-docstring | Env Setup |
| 992 | backend/app/services/oasis_profile_generator.py | 1077 | # 确保文件扩展名是.csv | deliberate | backend-comment | Env Setup |
| 993 | backend/app/services/oasis_profile_generator.py | 1084 | # 写入OASIS要求的表头 | deliberate | backend-comment | Env Setup |
| 994 | backend/app/services/oasis_profile_generator.py | 1088 | # 写入数据行 | deliberate | backend-comment | Env Setup |
| 995 | backend/app/services/oasis_profile_generator.py | 1090 | # user_char: 完整人设(bio + persona),用于LLM系统提示 | deliberate | backend-comment | Env Setup |
| 996 | backend/app/services/oasis_profile_generator.py | 1094 | # 处理换行符(CSV中用空格替代) | deliberate | backend-comment | Env Setup |
| 997 | backend/app/services/oasis_profile_generator.py | 1097 | # description: 简短简介,用于外部显示 | deliberate | backend-comment | Env Setup |
| 998 | backend/app/services/oasis_profile_generator.py | 1101 | idx, # user_id: 从0开始的顺序ID | deliberate | backend-docstring | Env Setup |
| 999 | backend/app/services/oasis_profile_generator.py | 1102 | profile.name, # name: 真实姓名 | deliberate | backend-docstring | Env Setup |
| 1000 | backend/app/services/oasis_profile_generator.py | 1103 | profile.user_name, # username: 用户名 | deliberate | backend-docstring | Env Setup |
| 1001 | backend/app/services/oasis_profile_generator.py | 1104 | user_char, # user_char: 完整人设(内部LLM使用) | deliberate | backend-docstring | Env Setup |
| 1002 | backend/app/services/oasis_profile_generator.py | 1105 | description # description: 简短简介(外部显示) | deliberate | backend-docstring | Env Setup |
| 1003 | backend/app/services/oasis_profile_generator.py | 1113 | 标准化gender字段为OASIS要求的英文格式 | deliberate | backend-docstring | Env Setup |
| 1004 | backend/app/services/oasis_profile_generator.py | 1115 | OASIS要求: male, female, other | deliberate | backend-docstring | Env Setup |
| 1005 | backend/app/services/oasis_profile_generator.py | 1122 | # 中文映射 | deliberate | backend-comment | Env Setup |
| 1006 | backend/app/services/oasis_profile_generator.py | 1124 | "男": "male", | gap | backend-prompt-label | Env Setup |
| 1007 | backend/app/services/oasis_profile_generator.py | 1125 | "女": "female", | gap | backend-prompt-label | Env Setup |
| 1008 | backend/app/services/oasis_profile_generator.py | 1126 | "机构": "other", | gap | backend-prompt-label | Env Setup |
| 1009 | backend/app/services/oasis_profile_generator.py | 1127 | "其他": "other", | gap | backend-prompt-label | Env Setup |
| 1010 | backend/app/services/oasis_profile_generator.py | 1128 | # 英文已有 | deliberate | backend-comment | Env Setup |
| 1011 | backend/app/services/oasis_profile_generator.py | 1138 | 保存Reddit Profile为JSON格式 | deliberate | backend-docstring | Env Setup |
| 1012 | backend/app/services/oasis_profile_generator.py | 1140 | 使用与 to_reddit_format() 一致的格式,确保 OASIS 能正确读取。 | deliberate | backend-docstring | Env Setup |
| 1013 | backend/app/services/oasis_profile_generator.py | 1141 | 必须包含 user_id 字段,这是 OASIS agent_graph.get_agent() 匹配的关键! | deliberate | backend-docstring | Env Setup |
| 1014 | backend/app/services/oasis_profile_generator.py | 1143 | 必需字段: | deliberate | backend-docstring | Env Setup |
| 1015 | backend/app/services/oasis_profile_generator.py | 1144 | - user_id: 用户ID(整数,用于匹配 initial_posts 中的 poster_agent_id) | deliberate | backend-docstring | Env Setup |
| 1016 | backend/app/services/oasis_profile_generator.py | 1145 | - username: 用户名 | deliberate | backend-docstring | Env Setup |
| 1017 | backend/app/services/oasis_profile_generator.py | 1146 | - name: 显示名称 | deliberate | backend-docstring | Env Setup |
| 1018 | backend/app/services/oasis_profile_generator.py | 1147 | - bio: 简介 | deliberate | backend-docstring | Env Setup |
| 1019 | backend/app/services/oasis_profile_generator.py | 1148 | - persona: 详细人设 | deliberate | backend-docstring | Env Setup |
| 1020 | backend/app/services/oasis_profile_generator.py | 1149 | - age: 年龄(整数) | deliberate | backend-docstring | Env Setup |
| 1021 | backend/app/services/oasis_profile_generator.py | 1150 | - gender: "male", "female", 或 "other" | gap | backend-prompt-label | Env Setup |
| 1022 | backend/app/services/oasis_profile_generator.py | 1151 | - mbti: MBTI类型 | deliberate | backend-docstring | Env Setup |
| 1023 | backend/app/services/oasis_profile_generator.py | 1152 | - country: 国家 | deliberate | backend-docstring | Env Setup |
| 1024 | backend/app/services/oasis_profile_generator.py | 1156 | # 使用与 to_reddit_format() 一致的格式 | deliberate | backend-comment | Env Setup |
| 1025 | backend/app/services/oasis_profile_generator.py | 1158 | "user_id": profile.user_id if profile.user_id is not None else idx, # 关键:必须包含 user_id | gap | backend-prompt-label | Env Setup |
| 1026 | backend/app/services/oasis_profile_generator.py | 1165 | # OASIS必需字段 - 确保都有默认值 | deliberate | backend-comment | Env Setup |
| 1027 | backend/app/services/oasis_profile_generator.py | 1169 | "country": profile.country if profile.country else "中国", | gap | backend-prompt-label | Env Setup |
| 1028 | backend/app/services/oasis_profile_generator.py | 1172 | # 可选字段 | deliberate | backend-comment | Env Setup |
| 1029 | backend/app/services/oasis_profile_generator.py | 1185 | # 保留旧方法名作为别名,保持向后兼容 | deliberate | backend-comment | Env Setup |
| 1030 | backend/app/services/oasis_profile_generator.py | 1192 | """[已废弃] 请使用 save_profiles() 方法""" | deliberate | backend-docstring | Env Setup |
| 1031 | backend/app/services/ontology_generator.py | 2 | 本体生成服务 | deliberate | backend-docstring | Graph Build |
| 1032 | backend/app/services/ontology_generator.py | 3 | 接口1:分析文本内容,生成适合社会模拟的实体和关系类型定义 | deliberate | backend-docstring | Graph Build |
| 1033 | backend/app/services/ontology_generator.py | 17 | """将任意格式的名称转换为 PascalCase(如 'works_for' -> 'WorksFor', 'person' -> 'Person')""" | deliberate | backend-docstring | Graph Build |
| 1034 | backend/app/services/ontology_generator.py | 18 | # 按非字母数字字符分割 | deliberate | backend-comment | Graph Build |
| 1035 | backend/app/services/ontology_generator.py | 20 | # 再按 camelCase 边界分割(如 'camelCase' -> ['camel', 'Case']) | deliberate | backend-comment | Graph Build |
| 1036 | backend/app/services/ontology_generator.py | 24 | # 每个词首字母大写,过滤空串 | deliberate | backend-comment | Graph Build |
| 1037 | backend/app/services/ontology_generator.py | 29 | # 本体生成的系统提示词 | deliberate | backend-comment | Graph Build |
| 1038 | backend/app/services/ontology_generator.py | 178 | 本体生成器 | deliberate | backend-docstring | Graph Build |
| 1039 | backend/app/services/ontology_generator.py | 179 | 分析文本内容,生成实体和关系类型定义 | deliberate | backend-docstring | Graph Build |
| 1040 | backend/app/services/ontology_generator.py | 192 | 生成本体定义 | deliberate | backend-docstring | Graph Build |
| 1041 | backend/app/services/ontology_generator.py | 195 | document_texts: 文档文本列表 | deliberate | backend-docstring | Graph Build |
| 1042 | backend/app/services/ontology_generator.py | 196 | simulation_requirement: 模拟需求描述 | deliberate | backend-docstring | Graph Build |
| 1043 | backend/app/services/ontology_generator.py | 197 | additional_context: 额外上下文 | deliberate | backend-docstring | Graph Build |
| 1044 | backend/app/services/ontology_generator.py | 200 | 本体定义(entity_types, edge_types等) | deliberate | backend-docstring | Graph Build |
| 1045 | backend/app/services/ontology_generator.py | 202 | # 构建用户消息 | deliberate | backend-comment | Graph Build |
| 1046 | backend/app/services/ontology_generator.py | 216 | # 调用LLM | deliberate | backend-comment | Graph Build |
| 1047 | backend/app/services/ontology_generator.py | 223 | # 验证和后处理 | deliberate | backend-comment | Graph Build |
| 1048 | backend/app/services/ontology_generator.py | 228 | # 传给 LLM 的文本最大长度(5万字) | deliberate | backend-comment | Graph Build |
| 1049 | backend/app/services/ontology_generator.py | 237 | """构建用户消息""" | deliberate | backend-docstring | Graph Build |
| 1050 | backend/app/services/ontology_generator.py | 239 | # 合并文本 | deliberate | backend-comment | Graph Build |
| 1051 | backend/app/services/ontology_generator.py | 243 | # 如果文本超过5万字,截断(仅影响传给LLM的内容,不影响图谱构建) | deliberate | backend-comment | Graph Build |
| 1052 | backend/app/services/ontology_generator.py | 278 | """验证和后处理结果""" | deliberate | backend-docstring | Graph Build |
| 1053 | backend/app/services/ontology_generator.py | 280 | # 确保必要字段存在 | deliberate | backend-comment | Graph Build |
| 1054 | backend/app/services/ontology_generator.py | 288 | # 验证实体类型 | deliberate | backend-comment | Graph Build |
| 1055 | backend/app/services/ontology_generator.py | 289 | # 记录原始名称到 PascalCase 的映射,用于后续修正 edge 的 source_targets 引用 | deliberate | backend-comment | Graph Build |
| 1056 | backend/app/services/ontology_generator.py | 292 | # 强制将 entity name 转为 PascalCase(Zep API 要求) | deliberate | backend-comment | Graph Build |
| 1057 | backend/app/services/ontology_generator.py | 303 | # 确保description不超过100字符 | deliberate | backend-comment | Graph Build |
| 1058 | backend/app/services/ontology_generator.py | 307 | # 验证关系类型 | deliberate | backend-comment | Graph Build |
| 1059 | backend/app/services/ontology_generator.py | 309 | # 强制将 edge name 转为 SCREAMING_SNAKE_CASE(Zep API 要求) | deliberate | backend-comment | Graph Build |
| 1060 | backend/app/services/ontology_generator.py | 315 | # 修正 source_targets 中的实体名称引用,与转换后的 PascalCase 保持一致 | deliberate | backend-comment | Graph Build |
| 1061 | backend/app/services/ontology_generator.py | 328 | # Zep API 限制:最多 10 个自定义实体类型,最多 10 个自定义边类型 | deliberate | backend-comment | Graph Build |
| 1062 | backend/app/services/ontology_generator.py | 332 | # 去重:按 name 去重,保留首次出现的 | deliberate | backend-comment | Graph Build |
| 1063 | backend/app/services/ontology_generator.py | 344 | # 兜底类型定义 | deliberate | backend-comment | Graph Build |
| 1064 | backend/app/services/ontology_generator.py | 365 | # 检查是否已有兜底类型 | deliberate | backend-comment | Graph Build |
| 1065 | backend/app/services/ontology_generator.py | 370 | # 需要添加的兜底类型 | deliberate | backend-comment | Graph Build |
| 1066 | backend/app/services/ontology_generator.py | 381 | # 如果添加后会超过 10 个,需要移除一些现有类型 | deliberate | backend-comment | Graph Build |
| 1067 | backend/app/services/ontology_generator.py | 383 | # 计算需要移除多少个 | deliberate | backend-comment | Graph Build |
| 1068 | backend/app/services/ontology_generator.py | 385 | # 从末尾移除(保留前面更重要的具体类型) | deliberate | backend-comment | Graph Build |
| 1069 | backend/app/services/ontology_generator.py | 388 | # 添加兜底类型 | deliberate | backend-comment | Graph Build |
| 1070 | backend/app/services/ontology_generator.py | 391 | # 最终确保不超过限制(防御性编程) | deliberate | backend-comment | Graph Build |
| 1071 | backend/app/services/ontology_generator.py | 402 | 将本体定义转换为Python代码(类似ontology.py) | deliberate | backend-docstring | Graph Build |
| 1072 | backend/app/services/ontology_generator.py | 405 | ontology: 本体定义 | deliberate | backend-docstring | Graph Build |
| 1073 | backend/app/services/ontology_generator.py | 408 | Python代码字符串 | deliberate | backend-docstring | Graph Build |
| 1074 | backend/app/services/ontology_generator.py | 412 | '自定义实体类型定义', | gap | backend-prompt-label | Graph Build |
| 1075 | backend/app/services/ontology_generator.py | 413 | '由MiroFish自动生成,用于社会舆论模拟', | gap | backend-prompt-label | Graph Build |
| 1076 | backend/app/services/ontology_generator.py | 420 | '# ============== 实体类型定义 ==============', | gap | backend-prompt-label | Graph Build |
| 1077 | backend/app/services/ontology_generator.py | 424 | # 生成实体类型 | deliberate | backend-comment | Graph Build |
| 1078 | backend/app/services/ontology_generator.py | 447 | code_lines.append('# ============== 关系类型定义 ==============') | gap | backend-prompt-label | Graph Build |
| 1079 | backend/app/services/ontology_generator.py | 450 | # 生成关系类型 | deliberate | backend-comment | Graph Build |
| 1080 | backend/app/services/ontology_generator.py | 453 | # 转换为PascalCase类名 | deliberate | backend-comment | Graph Build |
| 1081 | backend/app/services/ontology_generator.py | 475 | # 生成类型字典 | deliberate | backend-comment | Graph Build |
| 1082 | backend/app/services/ontology_generator.py | 476 | code_lines.append('# ============== 类型配置 ==============') | gap | backend-prompt-label | Graph Build |
| 1083 | backend/app/services/ontology_generator.py | 492 | # 生成边的source_targets映射 | deliberate | backend-comment | Graph Build |
| 1084 | backend/app/services/report_agent.py | 2 | Report Agent服务 | deliberate | backend-docstring | Report |
| 1085 | backend/app/services/report_agent.py | 3 | 使用LangChain + Zep实现ReACT模式的模拟报告生成 | deliberate | backend-docstring | Report |
| 1086 | backend/app/services/report_agent.py | 5 | 功能: | deliberate | backend-docstring | Report |
| 1087 | backend/app/services/report_agent.py | 6 | 1. 根据模拟需求和Zep图谱信息生成报告 | deliberate | backend-docstring | Report |
| 1088 | backend/app/services/report_agent.py | 7 | 2. 先规划目录结构,然后分段生成 | deliberate | backend-docstring | Report |
| 1089 | backend/app/services/report_agent.py | 8 | 3. 每段采用ReACT多轮思考与反思模式 | deliberate | backend-docstring | Report |
| 1090 | backend/app/services/report_agent.py | 9 | 4. 支持与用户对话,在对话中自主调用检索工具 | deliberate | backend-docstring | Report |
| 1091 | backend/app/services/report_agent.py | 38 | Report Agent 详细日志记录器 | deliberate | backend-docstring | Report |
| 1092 | backend/app/services/report_agent.py | 40 | 在报告文件夹中生成 agent_log.jsonl 文件,记录每一步详细动作。 | deliberate | backend-docstring | Report |
| 1093 | backend/app/services/report_agent.py | 41 | 每行是一个完整的 JSON 对象,包含时间戳、动作类型、详细内容等。 | deliberate | backend-docstring | Report |
| 1094 | backend/app/services/report_agent.py | 46 | 初始化日志记录器 | deliberate | backend-docstring | Report |
| 1095 | backend/app/services/report_agent.py | 49 | report_id: 报告ID,用于确定日志文件路径 | deliberate | backend-docstring | Report |
| 1096 | backend/app/services/report_agent.py | 59 | """确保日志文件所在目录存在""" | deliberate | backend-docstring | Report |
| 1097 | backend/app/services/report_agent.py | 64 | """获取从开始到现在的耗时(秒)""" | deliberate | backend-docstring | Report |
| 1098 | backend/app/services/report_agent.py | 76 | 记录一条日志 | deliberate | backend-docstring | Report |
| 1099 | backend/app/services/report_agent.py | 79 | action: 动作类型,如 'start', 'tool_call', 'llm_response', 'section_complete' 等 | gap | backend-prompt-label | Report |
| 1100 | backend/app/services/report_agent.py | 80 | stage: 当前阶段,如 'planning', 'generating', 'completed' | gap | backend-prompt-label | Report |
| 1101 | backend/app/services/report_agent.py | 81 | details: 详细内容字典,不截断 | deliberate | backend-docstring | Report |
| 1102 | backend/app/services/report_agent.py | 82 | section_title: 当前章节标题(可选) | deliberate | backend-docstring | Report |
| 1103 | backend/app/services/report_agent.py | 83 | section_index: 当前章节索引(可选) | deliberate | backend-docstring | Report |
| 1104 | backend/app/services/report_agent.py | 96 | # 追加写入 JSONL 文件 | deliberate | backend-comment | Report |
| 1105 | backend/app/services/report_agent.py | 101 | """记录报告生成开始""" | deliberate | backend-docstring | Report |
| 1106 | backend/app/services/report_agent.py | 114 | """记录大纲规划开始""" | deliberate | backend-docstring | Report |
| 1107 | backend/app/services/report_agent.py | 122 | """记录规划时获取的上下文信息""" | deliberate | backend-docstring | Report |
| 1108 | backend/app/services/report_agent.py | 133 | """记录大纲规划完成""" | deliberate | backend-docstring | Report |
| 1109 | backend/app/services/report_agent.py | 144 | """记录章节生成开始""" | deliberate | backend-docstring | Report |
| 1110 | backend/app/services/report_agent.py | 154 | """记录 ReACT 思考过程""" | deliberate | backend-docstring | Report |
| 1111 | backend/app/services/report_agent.py | 175 | """记录工具调用""" | deliberate | backend-docstring | Report |
| 1112 | backend/app/services/report_agent.py | 197 | """记录工具调用结果(完整内容,不截断)""" | deliberate | backend-docstring | Report |
| 1113 | backend/app/services/report_agent.py | 206 | "result": result, # 完整结果,不截断 | gap | backend-prompt-label | Report |
| 1114 | backend/app/services/report_agent.py | 221 | """记录 LLM 响应(完整内容,不截断)""" | deliberate | backend-docstring | Report |
| 1115 | backend/app/services/report_agent.py | 229 | "response": response, # 完整响应,不截断 | gap | backend-prompt-label | Report |
| 1116 | backend/app/services/report_agent.py | 244 | """记录章节内容生成完成(仅记录内容,不代表整个章节完成)""" | deliberate | backend-docstring | Report |
| 1117 | backend/app/services/report_agent.py | 251 | "content": content, # 完整内容,不截断 | gap | backend-prompt-label | Report |
| 1118 | backend/app/services/report_agent.py | 265 | 记录章节生成完成 | deliberate | backend-docstring | Report |
| 1119 | backend/app/services/report_agent.py | 267 | 前端应监听此日志来判断一个章节是否真正完成,并获取完整内容 | deliberate | backend-docstring | Report |
| 1120 | backend/app/services/report_agent.py | 282 | """记录报告生成完成""" | deliberate | backend-docstring | Report |
| 1121 | backend/app/services/report_agent.py | 294 | """记录错误""" | deliberate | backend-docstring | Report |
| 1122 | backend/app/services/report_agent.py | 309 | Report Agent 控制台日志记录器 | deliberate | backend-docstring | Report |
| 1123 | backend/app/services/report_agent.py | 311 | 将控制台风格的日志(INFO、WARNING等)写入报告文件夹中的 console_log.txt 文件。 | deliberate | backend-docstring | Report |
| 1124 | backend/app/services/report_agent.py | 312 | 这些日志与 agent_log.jsonl 不同,是纯文本格式的控制台输出。 | deliberate | backend-docstring | Report |
| 1125 | backend/app/services/report_agent.py | 317 | 初始化控制台日志记录器 | deliberate | backend-docstring | Report |
| 1126 | backend/app/services/report_agent.py | 320 | report_id: 报告ID,用于确定日志文件路径 | deliberate | backend-docstring | Report |
| 1127 | backend/app/services/report_agent.py | 331 | """确保日志文件所在目录存在""" | deliberate | backend-docstring | Report |
| 1128 | backend/app/services/report_agent.py | 336 | """设置文件处理器,将日志同时写入文件""" | deliberate | backend-docstring | Report |
| 1129 | backend/app/services/report_agent.py | 339 | # 创建文件处理器 | deliberate | backend-comment | Report |
| 1130 | backend/app/services/report_agent.py | 347 | # 使用与控制台相同的简洁格式 | deliberate | backend-comment | Report |
| 1131 | backend/app/services/report_agent.py | 354 | # 添加到 report_agent 相关的 logger | deliberate | backend-comment | Report |
| 1132 | backend/app/services/report_agent.py | 362 | # 避免重复添加 | deliberate | backend-comment | Report |
| 1133 | backend/app/services/report_agent.py | 367 | """关闭文件处理器并从 logger 中移除""" | deliberate | backend-docstring | Report |
| 1134 | backend/app/services/report_agent.py | 385 | """析构时确保关闭文件处理器""" | deliberate | backend-docstring | Report |
| 1135 | backend/app/services/report_agent.py | 390 | """报告状态""" | deliberate | backend-docstring | Report |
| 1136 | backend/app/services/report_agent.py | 400 | """报告章节""" | deliberate | backend-docstring | Report |
| 1137 | backend/app/services/report_agent.py | 411 | """转换为Markdown格式""" | deliberate | backend-docstring | Report |
| 1138 | backend/app/services/report_agent.py | 420 | """报告大纲""" | deliberate | backend-docstring | Report |
| 1139 | backend/app/services/report_agent.py | 433 | """转换为Markdown格式""" | deliberate | backend-docstring | Report |
| 1140 | backend/app/services/report_agent.py | 443 | """完整报告""" | deliberate | backend-docstring | Report |
| 1141 | backend/app/services/report_agent.py | 471 | # Prompt 模板常量 | deliberate | backend-comment | Report |
| 1142 | backend/app/services/report_agent.py | 474 | # ── 工具描述 ── | deliberate | backend-comment | Report |
| 1143 | backend/app/services/report_agent.py | 550 | # ── 大纲规划 prompt ── | deliberate | backend-comment | Report |
| 1144 | backend/app/services/report_agent.py | 613 | # ── 章节生成 prompt ── | deliberate | backend-comment | Report |
| 1145 | backend/app/services/report_agent.py | 794 | # ── ReACT 循环内消息模板 ── | deliberate | backend-comment | Report |
| 1146 | backend/app/services/report_agent.py | 861 | # ReportAgent 主类 | deliberate | backend-comment | Report |
| 1147 | backend/app/services/report_agent.py | 867 | Report Agent - 模拟报告生成Agent | deliberate | backend-docstring | Report |
| 1148 | backend/app/services/report_agent.py | 869 | 采用ReACT(Reasoning + Acting)模式: | deliberate | backend-docstring | Report |
| 1149 | backend/app/services/report_agent.py | 870 | 1. 规划阶段:分析模拟需求,规划报告目录结构 | deliberate | backend-docstring | Report |
| 1150 | backend/app/services/report_agent.py | 871 | 2. 生成阶段:逐章节生成内容,每章节可多次调用工具获取信息 | deliberate | backend-docstring | Report |
| 1151 | backend/app/services/report_agent.py | 872 | 3. 反思阶段:检查内容完整性和准确性 | deliberate | backend-docstring | Report |
| 1152 | backend/app/services/report_agent.py | 875 | # 最大工具调用次数(每个章节) | deliberate | backend-comment | Report |
| 1153 | backend/app/services/report_agent.py | 878 | # 最大反思轮数 | deliberate | backend-comment | Report |
| 1154 | backend/app/services/report_agent.py | 881 | # 对话中的最大工具调用次数 | deliberate | backend-comment | Report |
| 1155 | backend/app/services/report_agent.py | 893 | 初始化Report Agent | deliberate | backend-docstring | Report |
| 1156 | backend/app/services/report_agent.py | 896 | graph_id: 图谱ID | deliberate | backend-docstring | Report |
| 1157 | backend/app/services/report_agent.py | 897 | simulation_id: 模拟ID | deliberate | backend-docstring | Report |
| 1158 | backend/app/services/report_agent.py | 898 | simulation_requirement: 模拟需求描述 | deliberate | backend-docstring | Report |
| 1159 | backend/app/services/report_agent.py | 899 | llm_client: LLM客户端(可选) | deliberate | backend-docstring | Report |
| 1160 | backend/app/services/report_agent.py | 900 | zep_tools: Zep工具服务(可选) | deliberate | backend-docstring | Report |
| 1161 | backend/app/services/report_agent.py | 909 | # 工具定义 | deliberate | backend-comment | Report |
| 1162 | backend/app/services/report_agent.py | 912 | # 日志记录器(在 generate_report 中初始化) | deliberate | backend-comment | Report |
| 1163 | backend/app/services/report_agent.py | 914 | # 控制台日志记录器(在 generate_report 中初始化) | deliberate | backend-comment | Report |
| 1164 | backend/app/services/report_agent.py | 920 | """定义可用工具""" | deliberate | backend-docstring | Report |
| 1165 | backend/app/services/report_agent.py | 958 | 执行工具调用 | deliberate | backend-docstring | Report |
| 1166 | backend/app/services/report_agent.py | 961 | tool_name: 工具名称 | deliberate | backend-docstring | Report |
| 1167 | backend/app/services/report_agent.py | 962 | parameters: 工具参数 | deliberate | backend-docstring | Report |
| 1168 | backend/app/services/report_agent.py | 963 | report_context: 报告上下文(用于InsightForge) | deliberate | backend-docstring | Report |
| 1169 | backend/app/services/report_agent.py | 966 | 工具执行结果(文本格式) | deliberate | backend-docstring | Report |
| 1170 | backend/app/services/report_agent.py | 983 | # 广度搜索 - 获取全貌 | deliberate | backend-comment | Report |
| 1171 | backend/app/services/report_agent.py | 996 | # 简单搜索 - 快速检索 | deliberate | backend-comment | Report |
| 1172 | backend/app/services/report_agent.py | 1009 | # 深度采访 - 调用真实的OASIS采访API获取模拟Agent的回答(双平台) | deliberate | backend-comment | Report |
| 1173 | backend/app/services/report_agent.py | 1023 | # ========== 向后兼容的旧工具(内部重定向到新工具) ========== | deliberate | backend-comment | Report |
| 1174 | backend/app/services/report_agent.py | 1026 | # 重定向到 quick_search | deliberate | backend-comment | Report |
| 1175 | backend/app/services/report_agent.py | 1043 | # 重定向到 insight_forge,因为它更强大 | deliberate | backend-comment | Report |
| 1176 | backend/app/services/report_agent.py | 1064 | # 合法的工具名称集合,用于裸 JSON 兜底解析时校验 | deliberate | backend-comment | Report |
| 1177 | backend/app/services/report_agent.py | 1069 | 从LLM响应中解析工具调用 | deliberate | backend-docstring | Report |
| 1178 | backend/app/services/report_agent.py | 1071 | 支持的格式(按优先级): | deliberate | backend-docstring | Report |
| 1179 | backend/app/services/report_agent.py | 1073 | 2. 裸 JSON(响应整体或单行就是一个工具调用 JSON) | deliberate | backend-docstring | Report |
| 1180 | backend/app/services/report_agent.py | 1077 | # 格式1: XML风格(标准格式) | deliberate | backend-comment | Report |
| 1181 | backend/app/services/report_agent.py | 1089 | # 格式2: 兜底 - LLM 直接输出裸 JSON(没包 <tool_call> 标签) | deliberate | backend-comment | Report |
| 1182 | backend/app/services/report_agent.py | 1090 | # 只在格式1未匹配时尝试,避免误匹配正文中的 JSON | deliberate | backend-comment | Report |
| 1183 | backend/app/services/report_agent.py | 1101 | # 响应可能包含思考文字 + 裸 JSON,尝试提取最后一个 JSON 对象 | deliberate | backend-comment | Report |
| 1184 | backend/app/services/report_agent.py | 1115 | """校验解析出的 JSON 是否是合法的工具调用""" | deliberate | backend-docstring | Report |
| 1185 | backend/app/services/report_agent.py | 1116 | # 支持 {"name": ..., "parameters": ...} 和 {"tool": ..., "params": ...} 两种键名 | deliberate | backend-comment | Report |
| 1186 | backend/app/services/report_agent.py | 1119 | # 统一键名为 name / parameters | deliberate | backend-comment | Report |
| 1187 | backend/app/services/report_agent.py | 1128 | """生成工具描述文本""" | deliberate | backend-docstring | Report |
| 1188 | backend/app/services/report_agent.py | 1142 | 规划报告大纲 | deliberate | backend-docstring | Report |
| 1189 | backend/app/services/report_agent.py | 1144 | 使用LLM分析模拟需求,规划报告的目录结构 | deliberate | backend-docstring | Report |
| 1190 | backend/app/services/report_agent.py | 1147 | progress_callback: 进度回调函数 | deliberate | backend-docstring | Report |
| 1191 | backend/app/services/report_agent.py | 1150 | ReportOutline: 报告大纲 | deliberate | backend-docstring | Report |
| 1192 | backend/app/services/report_agent.py | 1157 | # 首先获取模拟上下文 | deliberate | backend-comment | Report |
| 1193 | backend/app/services/report_agent.py | 1188 | # 解析大纲 | deliberate | backend-comment | Report |
| 1194 | backend/app/services/report_agent.py | 1210 | # 返回默认大纲(3个章节,作为fallback) | deliberate | backend-comment | Report |
| 1195 | backend/app/services/report_agent.py | 1230 | 使用ReACT模式生成单个章节内容 | deliberate | backend-docstring | Report |
| 1196 | backend/app/services/report_agent.py | 1232 | ReACT循环: | deliberate | backend-docstring | Report |
| 1197 | backend/app/services/report_agent.py | 1233 | 1. Thought(思考)- 分析需要什么信息 | deliberate | backend-docstring | Report |
| 1198 | backend/app/services/report_agent.py | 1234 | 2. Action(行动)- 调用工具获取信息 | deliberate | backend-docstring | Report |
| 1199 | backend/app/services/report_agent.py | 1235 | 3. Observation(观察)- 分析工具返回结果 | deliberate | backend-docstring | Report |
| 1200 | backend/app/services/report_agent.py | 1236 | 4. 重复直到信息足够或达到最大次数 | deliberate | backend-docstring | Report |
| 1201 | backend/app/services/report_agent.py | 1237 | 5. Final Answer(最终回答)- 生成章节内容 | deliberate | backend-docstring | Report |
| 1202 | backend/app/services/report_agent.py | 1240 | section: 要生成的章节 | deliberate | backend-docstring | Report |
| 1203 | backend/app/services/report_agent.py | 1241 | outline: 完整大纲 | deliberate | backend-docstring | Report |
| 1204 | backend/app/services/report_agent.py | 1242 | previous_sections: 之前章节的内容(用于保持连贯性) | deliberate | backend-docstring | Report |
| 1205 | backend/app/services/report_agent.py | 1243 | progress_callback: 进度回调 | deliberate | backend-docstring | Report |
| 1206 | backend/app/services/report_agent.py | 1244 | section_index: 章节索引(用于日志记录) | deliberate | backend-docstring | Report |
| 1207 | backend/app/services/report_agent.py | 1247 | 章节内容(Markdown格式) | deliberate | backend-docstring | Report |
| 1208 | backend/app/services/report_agent.py | 1251 | # 记录章节开始日志 | deliberate | backend-comment | Report |
| 1209 | backend/app/services/report_agent.py | 1264 | # 构建用户prompt - 每个已完成章节各传入最大4000字 | deliberate | backend-comment | Report |
| 1210 | backend/app/services/report_agent.py | 1268 | # 每个章节最多4000字 | deliberate | backend-comment | Report |
| 1211 | backend/app/services/report_agent.py | 1285 | # ReACT循环 | deliberate | backend-comment | Report |
| 1212 | backend/app/services/report_agent.py | 1287 | max_iterations = 5 # 最大迭代轮数 | deliberate | backend-docstring | Report |
| 1213 | backend/app/services/report_agent.py | 1288 | min_tool_calls = 3 # 最少工具调用次数 | deliberate | backend-docstring | Report |
| 1214 | backend/app/services/report_agent.py | 1289 | conflict_retries = 0 # 工具调用与Final Answer同时出现的连续冲突次数 | deliberate | backend-docstring | Report |
| 1215 | backend/app/services/report_agent.py | 1290 | used_tools = set() # 记录已调用过的工具名 | deliberate | backend-docstring | Report |
| 1216 | backend/app/services/report_agent.py | 1293 | # 报告上下文,用于InsightForge的子问题生成 | deliberate | backend-comment | Report |
| 1217 | backend/app/services/report_agent.py | 1304 | # 调用LLM | deliberate | backend-comment | Report |
| 1218 | backend/app/services/report_agent.py | 1311 | # 检查 LLM 返回是否为 None(API 异常或内容为空) | deliberate | backend-comment | Report |
| 1219 | backend/app/services/report_agent.py | 1314 | # 如果还有迭代次数,添加消息并重试 | deliberate | backend-comment | Report |
| 1220 | backend/app/services/report_agent.py | 1319 | # 最后一次迭代也返回 None,跳出循环进入强制收尾 | deliberate | backend-comment | Report |
| 1221 | backend/app/services/report_agent.py | 1324 | # 解析一次,复用结果 | deliberate | backend-comment | Report |
| 1222 | backend/app/services/report_agent.py | 1329 | # ── 冲突处理:LLM 同时输出了工具调用和 Final Answer ── | deliberate | backend-comment | Report |
| 1223 | backend/app/services/report_agent.py | 1337 | # 前两次:丢弃本次响应,要求 LLM 重新回复 | deliberate | backend-comment | Report |
| 1224 | backend/app/services/report_agent.py | 1351 | # 第三次:降级处理,截断到第一个工具调用,强制执行 | deliberate | backend-comment | Report |
| 1225 | backend/app/services/report_agent.py | 1363 | # 记录 LLM 响应日志 | deliberate | backend-comment | Report |
| 1226 | backend/app/services/report_agent.py | 1374 | # ── 情况1:LLM 输出了 Final Answer ── | deliberate | backend-comment | Report |
| 1227 | backend/app/services/report_agent.py | 1376 | # 工具调用次数不足,拒绝并要求继续调工具 | deliberate | backend-comment | Report |
| 1228 | backend/app/services/report_agent.py | 1391 | # 正常结束 | deliberate | backend-comment | Report |
| 1229 | backend/app/services/report_agent.py | 1404 | # ── 情况2:LLM 尝试调用工具 ── | deliberate | backend-comment | Report |
| 1230 | backend/app/services/report_agent.py | 1406 | # 工具额度已耗尽 → 明确告知,要求输出 Final Answer | deliberate | backend-comment | Report |
| 1231 | backend/app/services/report_agent.py | 1418 | # 只执行第一个工具调用 | deliberate | backend-comment | Report |
| 1232 | backend/app/services/report_agent.py | 1450 | # 构建未使用工具提示 | deliberate | backend-comment | Report |
| 1233 | backend/app/services/report_agent.py | 1470 | # ── 情况3:既没有工具调用,也没有 Final Answer ── | deliberate | backend-comment | Report |
| 1234 | backend/app/services/report_agent.py | 1474 | # 工具调用次数不足,推荐未用过的工具 | deliberate | backend-comment | Report |
| 1235 | backend/app/services/report_agent.py | 1488 | # 工具调用已足够,LLM 输出了内容但没带 "Final Answer:" 前缀 | deliberate | backend-comment | Report |
| 1236 | backend/app/services/report_agent.py | 1489 | # 直接将这段内容作为最终答案,不再空转 | deliberate | backend-comment | Report |
| 1237 | backend/app/services/report_agent.py | 1502 | # 达到最大迭代次数,强制生成内容 | deliberate | backend-comment | Report |
| 1238 | backend/app/services/report_agent.py | 1512 | # 检查强制收尾时 LLM 返回是否为 None | deliberate | backend-comment | Report |
| 1239 | backend/app/services/report_agent.py | 1521 | # 记录章节内容生成完成日志 | deliberate | backend-comment | Report |
| 1240 | backend/app/services/report_agent.py | 1538 | 生成完整报告(分章节实时输出) | deliberate | backend-docstring | Report |
| 1241 | backend/app/services/report_agent.py | 1540 | 每个章节生成完成后立即保存到文件夹,不需要等待整个报告完成。 | deliberate | backend-docstring | Report |
| 1242 | backend/app/services/report_agent.py | 1541 | 文件结构: | deliberate | backend-docstring | Report |
| 1243 | backend/app/services/report_agent.py | 1543 | meta.json - 报告元信息 | deliberate | backend-docstring | Report |
| 1244 | backend/app/services/report_agent.py | 1544 | outline.json - 报告大纲 | deliberate | backend-docstring | Report |
| 1245 | backend/app/services/report_agent.py | 1545 | progress.json - 生成进度 | deliberate | backend-docstring | Report |
| 1246 | backend/app/services/report_agent.py | 1546 | section_01.md - 第1章节 | deliberate | backend-docstring | Report |
| 1247 | backend/app/services/report_agent.py | 1547 | section_02.md - 第2章节 | deliberate | backend-docstring | Report |
| 1248 | backend/app/services/report_agent.py | 1549 | full_report.md - 完整报告 | deliberate | backend-docstring | Report |
| 1249 | backend/app/services/report_agent.py | 1552 | progress_callback: 进度回调函数 (stage, progress, message) | deliberate | backend-docstring | Report |
| 1250 | backend/app/services/report_agent.py | 1553 | report_id: 报告ID(可选,如果不传则自动生成) | deliberate | backend-docstring | Report |
| 1251 | backend/app/services/report_agent.py | 1556 | Report: 完整报告 | deliberate | backend-docstring | Report |
| 1252 | backend/app/services/report_agent.py | 1560 | # 如果没有传入 report_id,则自动生成 | deliberate | backend-comment | Report |
| 1253 | backend/app/services/report_agent.py | 1574 | # 已完成的章节标题列表(用于进度追踪) | deliberate | backend-comment | Report |
| 1254 | backend/app/services/report_agent.py | 1578 | # 初始化:创建报告文件夹并保存初始状态 | deliberate | backend-comment | Report |
| 1255 | backend/app/services/report_agent.py | 1581 | # 初始化日志记录器(结构化日志 agent_log.jsonl) | deliberate | backend-comment | Report |
| 1256 | backend/app/services/report_agent.py | 1589 | # 初始化控制台日志记录器(console_log.txt) | deliberate | backend-comment | Report |
| 1257 | backend/app/services/report_agent.py | 1598 | # 阶段1: 规划大纲 | deliberate | backend-comment | Report |
| 1258 | backend/app/services/report_agent.py | 1605 | # 记录规划开始日志 | deliberate | backend-comment | Report |
| 1259 | backend/app/services/report_agent.py | 1617 | # 记录规划完成日志 | deliberate | backend-comment | Report |
| 1260 | backend/app/services/report_agent.py | 1620 | # 保存大纲到文件 | deliberate | backend-comment | Report |
| 1261 | backend/app/services/report_agent.py | 1630 | # 阶段2: 逐章节生成(分章节保存) | deliberate | backend-comment | Report |
| 1262 | backend/app/services/report_agent.py | 1634 | generated_sections = [] # 保存内容用于上下文 | deliberate | backend-docstring | Report |
| 1263 | backend/app/services/report_agent.py | 1640 | # 更新进度 | deliberate | backend-comment | Report |
| 1264 | backend/app/services/report_agent.py | 1655 | # 生成主章节内容 | deliberate | backend-comment | Report |
| 1265 | backend/app/services/report_agent.py | 1672 | # 保存章节 | deliberate | backend-comment | Report |
| 1266 | backend/app/services/report_agent.py | 1676 | # 记录章节完成日志 | deliberate | backend-comment | Report |
| 1267 | backend/app/services/report_agent.py | 1688 | # 更新进度 | deliberate | backend-comment | Report |
| 1268 | backend/app/services/report_agent.py | 1697 | # 阶段3: 组装完整报告 | deliberate | backend-comment | Report |
| 1269 | backend/app/services/report_agent.py | 1706 | # 使用ReportManager组装完整报告 | deliberate | backend-comment | Report |
| 1270 | backend/app/services/report_agent.py | 1711 | # 计算总耗时 | deliberate | backend-comment | Report |
| 1271 | backend/app/services/report_agent.py | 1714 | # 记录报告完成日志 | deliberate | backend-comment | Report |
| 1272 | backend/app/services/report_agent.py | 1721 | # 保存最终报告 | deliberate | backend-comment | Report |
| 1273 | backend/app/services/report_agent.py | 1733 | # 关闭控制台日志记录器 | deliberate | backend-comment | Report |
| 1274 | backend/app/services/report_agent.py | 1745 | # 记录错误日志 | deliberate | backend-comment | Report |
| 1275 | backend/app/services/report_agent.py | 1749 | # 保存失败状态 | deliberate | backend-comment | Report |
| 1276 | backend/app/services/report_agent.py | 1757 | pass # 忽略保存失败的错误 | deliberate | backend-docstring | Report |
| 1277 | backend/app/services/report_agent.py | 1759 | # 关闭控制台日志记录器 | deliberate | backend-comment | Report |
| 1278 | backend/app/services/report_agent.py | 1772 | 与Report Agent对话 | deliberate | backend-docstring | Report |
| 1279 | backend/app/services/report_agent.py | 1774 | 在对话中Agent可以自主调用检索工具来回答问题 | deliberate | backend-docstring | Report |
| 1280 | backend/app/services/report_agent.py | 1777 | message: 用户消息 | deliberate | backend-docstring | Report |
| 1281 | backend/app/services/report_agent.py | 1778 | chat_history: 对话历史 | deliberate | backend-docstring | Report |
| 1282 | backend/app/services/report_agent.py | 1782 | "response": "Agent回复", | gap | backend-prompt-label | Report |
| 1283 | backend/app/services/report_agent.py | 1783 | "tool_calls": [调用的工具列表], | gap | backend-prompt-label | Report |
| 1284 | backend/app/services/report_agent.py | 1784 | "sources": [信息来源] | gap | backend-prompt-label | Report |
| 1285 | backend/app/services/report_agent.py | 1791 | # 获取已生成的报告内容 | deliberate | backend-comment | Report |
| 1286 | backend/app/services/report_agent.py | 1796 | # 限制报告长度,避免上下文过长 | deliberate | backend-comment | Report |
| 1287 | backend/app/services/report_agent.py | 1810 | # 构建消息 | deliberate | backend-comment | Report |
| 1288 | backend/app/services/report_agent.py | 1813 | # 添加历史对话 | deliberate | backend-comment | Report |
| 1289 | backend/app/services/report_agent.py | 1814 | for h in chat_history[-10:]: # 限制历史长度 | deliberate | backend-docstring | Report |
| 1290 | backend/app/services/report_agent.py | 1817 | # 添加用户消息 | deliberate | backend-comment | Report |
| 1291 | backend/app/services/report_agent.py | 1823 | # ReACT循环(简化版) | deliberate | backend-comment | Report |
| 1292 | backend/app/services/report_agent.py | 1825 | max_iterations = 2 # 减少迭代轮数 | deliberate | backend-docstring | Report |
| 1293 | backend/app/services/report_agent.py | 1833 | # 解析工具调用 | deliberate | backend-comment | Report |
| 1294 | backend/app/services/report_agent.py | 1837 | # 没有工具调用,直接返回响应 | deliberate | backend-comment | Report |
| 1295 | backend/app/services/report_agent.py | 1847 | # 执行工具调用(限制数量) | deliberate | backend-comment | Report |
| 1296 | backend/app/services/report_agent.py | 1849 | for call in tool_calls[:1]: # 每轮最多执行1次工具调用 | deliberate | backend-docstring | Report |
| 1297 | backend/app/services/report_agent.py | 1855 | "result": result[:1500] # 限制结果长度 | gap | backend-prompt-label | Report |
| 1298 | backend/app/services/report_agent.py | 1859 | # 将结果添加到消息 | deliberate | backend-comment | Report |
| 1299 | backend/app/services/report_agent.py | 1867 | # 达到最大迭代,获取最终响应 | deliberate | backend-comment | Report |
| 1300 | backend/app/services/report_agent.py | 1873 | # 清理响应 | deliberate | backend-comment | Report |
| 1301 | backend/app/services/report_agent.py | 1886 | 报告管理器 | deliberate | backend-docstring | Report |
| 1302 | backend/app/services/report_agent.py | 1888 | 负责报告的持久化存储和检索 | deliberate | backend-docstring | Report |
| 1303 | backend/app/services/report_agent.py | 1890 | 文件结构(分章节输出): | deliberate | backend-docstring | Report |
| 1304 | backend/app/services/report_agent.py | 1893 | meta.json - 报告元信息和状态 | deliberate | backend-docstring | Report |
| 1305 | backend/app/services/report_agent.py | 1894 | outline.json - 报告大纲 | deliberate | backend-docstring | Report |
| 1306 | backend/app/services/report_agent.py | 1895 | progress.json - 生成进度 | deliberate | backend-docstring | Report |
| 1307 | backend/app/services/report_agent.py | 1896 | section_01.md - 第1章节 | deliberate | backend-docstring | Report |
| 1308 | backend/app/services/report_agent.py | 1897 | section_02.md - 第2章节 | deliberate | backend-docstring | Report |
| 1309 | backend/app/services/report_agent.py | 1899 | full_report.md - 完整报告 | deliberate | backend-docstring | Report |
| 1310 | backend/app/services/report_agent.py | 1902 | # 报告存储目录 | deliberate | backend-comment | Report |
| 1311 | backend/app/services/report_agent.py | 1907 | """确保报告根目录存在""" | deliberate | backend-docstring | Report |
| 1312 | backend/app/services/report_agent.py | 1912 | """获取报告文件夹路径""" | deliberate | backend-docstring | Report |
| 1313 | backend/app/services/report_agent.py | 1917 | """确保报告文件夹存在并返回路径""" | deliberate | backend-docstring | Report |
| 1314 | backend/app/services/report_agent.py | 1924 | """获取报告元信息文件路径""" | deliberate | backend-docstring | Report |
| 1315 | backend/app/services/report_agent.py | 1929 | """获取完整报告Markdown文件路径""" | deliberate | backend-docstring | Report |
| 1316 | backend/app/services/report_agent.py | 1934 | """获取大纲文件路径""" | deliberate | backend-docstring | Report |
| 1317 | backend/app/services/report_agent.py | 1939 | """获取进度文件路径""" | deliberate | backend-docstring | Report |
| 1318 | backend/app/services/report_agent.py | 1944 | """获取章节Markdown文件路径""" | deliberate | backend-docstring | Report |
| 1319 | backend/app/services/report_agent.py | 1949 | """获取 Agent 日志文件路径""" | deliberate | backend-docstring | Report |
| 1320 | backend/app/services/report_agent.py | 1954 | """获取控制台日志文件路径""" | deliberate | backend-docstring | Report |
| 1321 | backend/app/services/report_agent.py | 1960 | 获取控制台日志内容 | deliberate | backend-docstring | Report |
| 1322 | backend/app/services/report_agent.py | 1962 | 这是报告生成过程中的控制台输出日志(INFO、WARNING等), | deliberate | backend-docstring | Report |
| 1323 | backend/app/services/report_agent.py | 1963 | 与 agent_log.jsonl 的结构化日志不同。 | deliberate | backend-docstring | Report |
| 1324 | backend/app/services/report_agent.py | 1966 | report_id: 报告ID | deliberate | backend-docstring | Report |
| 1325 | backend/app/services/report_agent.py | 1967 | from_line: 从第几行开始读取(用于增量获取,0 表示从头开始) | deliberate | backend-docstring | Report |
| 1326 | backend/app/services/report_agent.py | 1971 | "logs": [日志行列表], | gap | backend-prompt-label | Report |
| 1327 | backend/app/services/report_agent.py | 1972 | "total_lines": 总行数, | gap | backend-prompt-label | Report |
| 1328 | backend/app/services/report_agent.py | 1973 | "from_line": 起始行号, | gap | backend-prompt-label | Report |
| 1329 | backend/app/services/report_agent.py | 1974 | "has_more": 是否还有更多日志 | gap | backend-prompt-label | Report |
| 1330 | backend/app/services/report_agent.py | 1994 | # 保留原始日志行,去掉末尾换行符 | deliberate | backend-comment | Report |
| 1331 | backend/app/services/report_agent.py | 2001 | "has_more": False # 已读取到末尾 | gap | backend-prompt-label | Report |
| 1332 | backend/app/services/report_agent.py | 2007 | 获取完整的控制台日志(一次性获取全部) | deliberate | backend-docstring | Report |
| 1333 | backend/app/services/report_agent.py | 2010 | report_id: 报告ID | deliberate | backend-docstring | Report |
| 1334 | backend/app/services/report_agent.py | 2013 | 日志行列表 | deliberate | backend-docstring | Report |
| 1335 | backend/app/services/report_agent.py | 2021 | 获取 Agent 日志内容 | deliberate | backend-docstring | Report |
| 1336 | backend/app/services/report_agent.py | 2024 | report_id: 报告ID | deliberate | backend-docstring | Report |
| 1337 | backend/app/services/report_agent.py | 2025 | from_line: 从第几行开始读取(用于增量获取,0 表示从头开始) | deliberate | backend-docstring | Report |
| 1338 | backend/app/services/report_agent.py | 2029 | "logs": [日志条目列表], | gap | backend-prompt-label | Report |
| 1339 | backend/app/services/report_agent.py | 2030 | "total_lines": 总行数, | gap | backend-prompt-label | Report |
| 1340 | backend/app/services/report_agent.py | 2031 | "from_line": 起始行号, | gap | backend-prompt-label | Report |
| 1341 | backend/app/services/report_agent.py | 2032 | "has_more": 是否还有更多日志 | gap | backend-prompt-label | Report |
| 1342 | backend/app/services/report_agent.py | 2056 | # 跳过解析失败的行 | deliberate | backend-comment | Report |
| 1343 | backend/app/services/report_agent.py | 2063 | "has_more": False # 已读取到末尾 | gap | backend-prompt-label | Report |
| 1344 | backend/app/services/report_agent.py | 2069 | 获取完整的 Agent 日志(用于一次性获取全部) | deliberate | backend-docstring | Report |
| 1345 | backend/app/services/report_agent.py | 2072 | report_id: 报告ID | deliberate | backend-docstring | Report |
| 1346 | backend/app/services/report_agent.py | 2075 | 日志条目列表 | deliberate | backend-docstring | Report |
| 1347 | backend/app/services/report_agent.py | 2083 | 保存报告大纲 | deliberate | backend-docstring | Report |
| 1348 | backend/app/services/report_agent.py | 2085 | 在规划阶段完成后立即调用 | deliberate | backend-docstring | Report |
| 1349 | backend/app/services/report_agent.py | 2102 | 保存单个章节 | deliberate | backend-docstring | Report |
| 1350 | backend/app/services/report_agent.py | 2104 | 在每个章节生成完成后立即调用,实现分章节输出 | deliberate | backend-docstring | Report |
| 1351 | backend/app/services/report_agent.py | 2107 | report_id: 报告ID | deliberate | backend-docstring | Report |
| 1352 | backend/app/services/report_agent.py | 2108 | section_index: 章节索引(从1开始) | deliberate | backend-docstring | Report |
| 1353 | backend/app/services/report_agent.py | 2109 | section: 章节对象 | deliberate | backend-docstring | Report |
| 1354 | backend/app/services/report_agent.py | 2112 | 保存的文件路径 | deliberate | backend-docstring | Report |
| 1355 | backend/app/services/report_agent.py | 2116 | # 构建章节Markdown内容 - 清理可能存在的重复标题 | deliberate | backend-comment | Report |
| 1356 | backend/app/services/report_agent.py | 2122 | # 保存文件 | deliberate | backend-comment | Report |
| 1357 | backend/app/services/report_agent.py | 2134 | 清理章节内容 | deliberate | backend-docstring | Report |
| 1358 | backend/app/services/report_agent.py | 2136 | 1. 移除内容开头与章节标题重复的Markdown标题行 | deliberate | backend-docstring | Report |
| 1359 | backend/app/services/report_agent.py | 2137 | 2. 将所有 ### 及以下级别的标题转换为粗体文本 | deliberate | backend-docstring | Report |
| 1360 | backend/app/services/report_agent.py | 2140 | content: 原始内容 | deliberate | backend-docstring | Report |
| 1361 | backend/app/services/report_agent.py | 2141 | section_title: 章节标题 | deliberate | backend-docstring | Report |
| 1362 | backend/app/services/report_agent.py | 2144 | 清理后的内容 | deliberate | backend-docstring | Report |
| 1363 | backend/app/services/report_agent.py | 2159 | # 检查是否是Markdown标题行 | deliberate | backend-comment | Report |
| 1364 | backend/app/services/report_agent.py | 2166 | # 检查是否是与章节标题重复的标题(跳过前5行内的重复) | deliberate | backend-comment | Report |
| 1365 | backend/app/services/report_agent.py | 2172 | # 将所有级别的标题(#, ##, ###, ####等)转换为粗体 | deliberate | backend-comment | Report |
| 1366 | backend/app/services/report_agent.py | 2173 | # 因为章节标题由系统添加,内容中不应有任何标题 | deliberate | backend-comment | Report |
| 1367 | backend/app/services/report_agent.py | 2175 | cleaned_lines.append("") # 添加空行 | gap | backend-prompt-label | Report |
| 1368 | backend/app/services/report_agent.py | 2178 | # 如果上一行是被跳过的标题,且当前行为空,也跳过 | deliberate | backend-comment | Report |
| 1369 | backend/app/services/report_agent.py | 2186 | # 移除开头的空行 | deliberate | backend-comment | Report |
| 1370 | backend/app/services/report_agent.py | 2190 | # 移除开头的分隔线 | deliberate | backend-comment | Report |
| 1371 | backend/app/services/report_agent.py | 2193 | # 同时移除分隔线后的空行 | deliberate | backend-comment | Report |
| 1372 | backend/app/services/report_agent.py | 2210 | 更新报告生成进度 | deliberate | backend-docstring | Report |
| 1373 | backend/app/services/report_agent.py | 2212 | 前端可以通过读取progress.json获取实时进度 | deliberate | backend-docstring | Report |
| 1374 | backend/app/services/report_agent.py | 2230 | """获取报告生成进度""" | deliberate | backend-docstring | Report |
| 1375 | backend/app/services/report_agent.py | 2242 | 获取已生成的章节列表 | deliberate | backend-docstring | Report |
| 1376 | backend/app/services/report_agent.py | 2244 | 返回所有已保存的章节文件信息 | deliberate | backend-docstring | Report |
| 1377 | backend/app/services/report_agent.py | 2258 | # 从文件名解析章节索引 | deliberate | backend-comment | Report |
| 1378 | backend/app/services/report_agent.py | 2273 | 组装完整报告 | deliberate | backend-docstring | Report |
| 1379 | backend/app/services/report_agent.py | 2275 | 从已保存的章节文件组装完整报告,并进行标题清理 | deliberate | backend-docstring | Report |
| 1380 | backend/app/services/report_agent.py | 2279 | # 构建报告头部 | deliberate | backend-comment | Report |
| 1381 | backend/app/services/report_agent.py | 2284 | # 按顺序读取所有章节文件 | deliberate | backend-comment | Report |
| 1382 | backend/app/services/report_agent.py | 2289 | # 后处理:清理整个报告的标题问题 | deliberate | backend-comment | Report |
| 1383 | backend/app/services/report_agent.py | 2292 | # 保存完整报告 | deliberate | backend-comment | Report |
| 1384 | backend/app/services/report_agent.py | 2303 | 后处理报告内容 | deliberate | backend-docstring | Report |
| 1385 | backend/app/services/report_agent.py | 2305 | 1. 移除重复的标题 | deliberate | backend-docstring | Report |
| 1386 | backend/app/services/report_agent.py | 2306 | 2. 保留报告主标题(#)和章节标题(##),移除其他级别的标题(###, ####等) | deliberate | backend-docstring | Report |
| 1387 | backend/app/services/report_agent.py | 2307 | 3. 清理多余的空行和分隔线 | deliberate | backend-docstring | Report |
| 1388 | backend/app/services/report_agent.py | 2310 | content: 原始报告内容 | deliberate | backend-docstring | Report |
| 1389 | backend/app/services/report_agent.py | 2311 | outline: 报告大纲 | deliberate | backend-docstring | Report |
| 1390 | backend/app/services/report_agent.py | 2314 | 处理后的内容 | deliberate | backend-docstring | Report |
| 1391 | backend/app/services/report_agent.py | 2322 | # 收集大纲中的所有章节标题 | deliberate | backend-comment | Report |
| 1392 | backend/app/services/report_agent.py | 2332 | # 检查是否是标题行 | deliberate | backend-comment | Report |
| 1393 | backend/app/services/report_agent.py | 2339 | # 检查是否是重复标题(在连续5行内出现相同内容的标题) | deliberate | backend-comment | Report |
| 1394 | backend/app/services/report_agent.py | 2351 | # 跳过重复标题及其后的空行 | deliberate | backend-comment | Report |
| 1395 | backend/app/services/report_agent.py | 2357 | # 标题层级处理: | deliberate | backend-comment | Report |
| 1396 | backend/app/services/report_agent.py | 2358 | # - # (level=1) 只保留报告主标题 | deliberate | backend-comment | Report |
| 1397 | backend/app/services/report_agent.py | 2359 | # - ## (level=2) 保留章节标题 | deliberate | backend-comment | Report |
| 1398 | backend/app/services/report_agent.py | 2360 | # - ### 及以下 (level>=3) 转换为粗体文本 | deliberate | backend-comment | Report |
| 1399 | backend/app/services/report_agent.py | 2364 | # 保留报告主标题 | deliberate | backend-comment | Report |
| 1400 | backend/app/services/report_agent.py | 2368 | # 章节标题错误使用了#,修正为## | deliberate | backend-comment | Report |
| 1401 | backend/app/services/report_agent.py | 2372 | # 其他一级标题转为粗体 | deliberate | backend-comment | Report |
| 1402 | backend/app/services/report_agent.py | 2378 | # 保留章节标题 | deliberate | backend-comment | Report |
| 1403 | backend/app/services/report_agent.py | 2382 | # 非章节的二级标题转为粗体 | deliberate | backend-comment | Report |
| 1404 | backend/app/services/report_agent.py | 2387 | # ### 及以下级别的标题转换为粗体文本 | deliberate | backend-comment | Report |
| 1405 | backend/app/services/report_agent.py | 2396 | # 跳过标题后紧跟的分隔线 | deliberate | backend-comment | Report |
| 1406 | backend/app/services/report_agent.py | 2401 | # 标题后只保留一个空行 | deliberate | backend-comment | Report |
| 1407 | backend/app/services/report_agent.py | 2412 | # 清理连续的多个空行(保留最多2个) | deliberate | backend-comment | Report |
| 1408 | backend/app/services/report_agent.py | 2428 | """保存报告元信息和完整报告""" | deliberate | backend-docstring | Report |
| 1409 | backend/app/services/report_agent.py | 2431 | # 保存元信息JSON | deliberate | backend-comment | Report |
| 1410 | backend/app/services/report_agent.py | 2435 | # 保存大纲 | deliberate | backend-comment | Report |
| 1411 | backend/app/services/report_agent.py | 2439 | # 保存完整Markdown报告 | deliberate | backend-comment | Report |
| 1412 | backend/app/services/report_agent.py | 2448 | """获取报告""" | deliberate | backend-docstring | Report |
| 1413 | backend/app/services/report_agent.py | 2452 | # 兼容旧格式:检查直接存储在reports目录下的文件 | deliberate | backend-comment | Report |
| 1414 | backend/app/services/report_agent.py | 2462 | # 重建Report对象 | deliberate | backend-comment | Report |
| 1415 | backend/app/services/report_agent.py | 2478 | # 如果markdown_content为空,尝试从full_report.md读取 | deliberate | backend-comment | Report |
| 1416 | backend/app/services/report_agent.py | 2501 | """根据模拟ID获取报告""" | deliberate | backend-docstring | Report |
| 1417 | backend/app/services/report_agent.py | 2506 | # 新格式:文件夹 | deliberate | backend-comment | Report |
| 1418 | backend/app/services/report_agent.py | 2511 | # 兼容旧格式:JSON文件 | deliberate | backend-comment | Report |
| 1419 | backend/app/services/report_agent.py | 2522 | """列出报告""" | deliberate | backend-docstring | Report |
| 1420 | backend/app/services/report_agent.py | 2528 | # 新格式:文件夹 | deliberate | backend-comment | Report |
| 1421 | backend/app/services/report_agent.py | 2534 | # 兼容旧格式:JSON文件 | deliberate | backend-comment | Report |
| 1422 | backend/app/services/report_agent.py | 2542 | # 按创建时间倒序 | deliberate | backend-comment | Report |
| 1423 | backend/app/services/report_agent.py | 2549 | """删除报告(整个文件夹)""" | deliberate | backend-docstring | Report |
| 1424 | backend/app/services/report_agent.py | 2554 | # 新格式:删除整个文件夹 | deliberate | backend-comment | Report |
| 1425 | backend/app/services/report_agent.py | 2560 | # 兼容旧格式:删除单独的文件 | deliberate | backend-comment | Report |
| 1426 | backend/app/services/simulation_config_generator.py | 2 | 模拟配置智能生成器 | deliberate | backend-docstring | Simulation |
| 1427 | backend/app/services/simulation_config_generator.py | 3 | 使用LLM根据模拟需求、文档内容、图谱信息自动生成细致的模拟参数 | deliberate | backend-docstring | Simulation |
| 1428 | backend/app/services/simulation_config_generator.py | 4 | 实现全程自动化,无需人工设置参数 | deliberate | backend-docstring | Simulation |
| 1429 | backend/app/services/simulation_config_generator.py | 6 | 采用分步生成策略,避免一次性生成过长内容导致失败: | deliberate | backend-docstring | Simulation |
| 1430 | backend/app/services/simulation_config_generator.py | 7 | 1. 生成时间配置 | deliberate | backend-docstring | Simulation |
| 1431 | backend/app/services/simulation_config_generator.py | 8 | 2. 生成事件配置 | deliberate | backend-docstring | Simulation |
| 1432 | backend/app/services/simulation_config_generator.py | 9 | 3. 分批生成Agent配置 | deliberate | backend-docstring | Simulation |
| 1433 | backend/app/services/simulation_config_generator.py | 10 | 4. 生成平台配置 | deliberate | backend-docstring | Simulation |
| 1434 | backend/app/services/simulation_config_generator.py | 28 | # 中国作息时间配置(北京时间) | deliberate | backend-comment | Simulation |
| 1435 | backend/app/services/simulation_config_generator.py | 30 | # 深夜时段(几乎无人活动) | deliberate | backend-comment | Simulation |
| 1436 | backend/app/services/simulation_config_generator.py | 32 | # 早间时段(逐渐醒来) | deliberate | backend-comment | Simulation |
| 1437 | backend/app/services/simulation_config_generator.py | 34 | # 工作时段 | deliberate | backend-comment | Simulation |
| 1438 | backend/app/services/simulation_config_generator.py | 36 | # 晚间高峰(最活跃) | deliberate | backend-comment | Simulation |
| 1439 | backend/app/services/simulation_config_generator.py | 38 | # 夜间时段(活跃度下降) | deliberate | backend-comment | Simulation |
| 1440 | backend/app/services/simulation_config_generator.py | 40 | # 活跃度系数 | deliberate | backend-comment | Simulation |
| 1441 | backend/app/services/simulation_config_generator.py | 42 | "dead": 0.05, # 凌晨几乎无人 | gap | backend-prompt-label | Simulation |
| 1442 | backend/app/services/simulation_config_generator.py | 43 | "morning": 0.4, # 早间逐渐活跃 | gap | backend-prompt-label | Simulation |
| 1443 | backend/app/services/simulation_config_generator.py | 44 | "work": 0.7, # 工作时段中等 | gap | backend-prompt-label | Simulation |
| 1444 | backend/app/services/simulation_config_generator.py | 45 | "peak": 1.5, # 晚间高峰 | gap | backend-prompt-label | Simulation |
| 1445 | backend/app/services/simulation_config_generator.py | 46 | "night": 0.5 # 深夜下降 | gap | backend-prompt-label | Simulation |
| 1446 | backend/app/services/simulation_config_generator.py | 53 | """单个Agent的活动配置""" | deliberate | backend-docstring | Simulation |
| 1447 | backend/app/services/simulation_config_generator.py | 59 | # 活跃度配置 (0.0-1.0) | deliberate | backend-comment | Simulation |
| 1448 | backend/app/services/simulation_config_generator.py | 60 | activity_level: float = 0.5 # 整体活跃度 | deliberate | backend-docstring | Simulation |
| 1449 | backend/app/services/simulation_config_generator.py | 62 | # 发言频率(每小时预期发言次数) | deliberate | backend-comment | Simulation |
| 1450 | backend/app/services/simulation_config_generator.py | 66 | # 活跃时间段(24小时制,0-23) | deliberate | backend-comment | Simulation |
| 1451 | backend/app/services/simulation_config_generator.py | 69 | # 响应速度(对热点事件的反应延迟,单位:模拟分钟) | deliberate | backend-comment | Simulation |
| 1452 | backend/app/services/simulation_config_generator.py | 73 | # 情感倾向 (-1.0到1.0,负面到正面) | deliberate | backend-comment | Simulation |
| 1453 | backend/app/services/simulation_config_generator.py | 76 | # 立场(对特定话题的态度) | deliberate | backend-comment | Simulation |
| 1454 | backend/app/services/simulation_config_generator.py | 79 | # 影响力权重(决定其发言被其他Agent看到的概率) | deliberate | backend-comment | Simulation |
| 1455 | backend/app/services/simulation_config_generator.py | 85 | """时间模拟配置(基于中国人作息习惯)""" | deliberate | backend-docstring | Simulation |
| 1456 | backend/app/services/simulation_config_generator.py | 86 | # 模拟总时长(模拟小时数) | deliberate | backend-comment | Simulation |
| 1457 | backend/app/services/simulation_config_generator.py | 87 | total_simulation_hours: int = 72 # 默认模拟72小时(3天) | deliberate | backend-docstring | Simulation |
| 1458 | backend/app/services/simulation_config_generator.py | 89 | # 每轮代表的时间(模拟分钟)- 默认60分钟(1小时),加快时间流速 | deliberate | backend-comment | Simulation |
| 1459 | backend/app/services/simulation_config_generator.py | 92 | # 每小时激活的Agent数量范围 | deliberate | backend-comment | Simulation |
| 1460 | backend/app/services/simulation_config_generator.py | 96 | # 高峰时段(晚间19-22点,中国人最活跃的时间) | deliberate | backend-comment | Simulation |
| 1461 | backend/app/services/simulation_config_generator.py | 100 | # 低谷时段(凌晨0-5点,几乎无人活动) | deliberate | backend-comment | Simulation |
| 1462 | backend/app/services/simulation_config_generator.py | 102 | off_peak_activity_multiplier: float = 0.05 # 凌晨活跃度极低 | deliberate | backend-docstring | Simulation |
| 1463 | backend/app/services/simulation_config_generator.py | 104 | # 早间时段 | deliberate | backend-comment | Simulation |
| 1464 | backend/app/services/simulation_config_generator.py | 108 | # 工作时段 | deliberate | backend-comment | Simulation |
| 1465 | backend/app/services/simulation_config_generator.py | 115 | """事件配置""" | deliberate | backend-docstring | Simulation |
| 1466 | backend/app/services/simulation_config_generator.py | 116 | # 初始事件(模拟开始时的触发事件) | deliberate | backend-comment | Simulation |
| 1467 | backend/app/services/simulation_config_generator.py | 119 | # 定时事件(在特定时间触发的事件) | deliberate | backend-comment | Simulation |
| 1468 | backend/app/services/simulation_config_generator.py | 122 | # 热点话题关键词 | deliberate | backend-comment | Simulation |
| 1469 | backend/app/services/simulation_config_generator.py | 125 | # 舆论引导方向 | deliberate | backend-comment | Simulation |
| 1470 | backend/app/services/simulation_config_generator.py | 131 | """平台特定配置""" | deliberate | backend-docstring | Simulation |
| 1471 | backend/app/services/simulation_config_generator.py | 134 | # 推荐算法权重 | deliberate | backend-comment | Simulation |
| 1472 | backend/app/services/simulation_config_generator.py | 135 | recency_weight: float = 0.4 # 时间新鲜度 | deliberate | backend-docstring | Simulation |
| 1473 | backend/app/services/simulation_config_generator.py | 136 | popularity_weight: float = 0.3 # 热度 | deliberate | backend-docstring | Simulation |
| 1474 | backend/app/services/simulation_config_generator.py | 137 | relevance_weight: float = 0.3 # 相关性 | deliberate | backend-docstring | Simulation |
| 1475 | backend/app/services/simulation_config_generator.py | 139 | # 病毒传播阈值(达到多少互动后触发扩散) | deliberate | backend-comment | Simulation |
| 1476 | backend/app/services/simulation_config_generator.py | 142 | # 回声室效应强度(相似观点聚集程度) | deliberate | backend-comment | Simulation |
| 1477 | backend/app/services/simulation_config_generator.py | 148 | """完整的模拟参数配置""" | deliberate | backend-docstring | Simulation |
| 1478 | backend/app/services/simulation_config_generator.py | 149 | # 基础信息 | deliberate | backend-comment | Simulation |
| 1479 | backend/app/services/simulation_config_generator.py | 155 | # 时间配置 | deliberate | backend-comment | Simulation |
| 1480 | backend/app/services/simulation_config_generator.py | 158 | # Agent配置列表 | deliberate | backend-comment | Simulation |
| 1481 | backend/app/services/simulation_config_generator.py | 161 | # 事件配置 | deliberate | backend-comment | Simulation |
| 1482 | backend/app/services/simulation_config_generator.py | 164 | # 平台配置 | deliberate | backend-comment | Simulation |
| 1483 | backend/app/services/simulation_config_generator.py | 168 | # LLM配置 | deliberate | backend-comment | Simulation |
| 1484 | backend/app/services/simulation_config_generator.py | 172 | # 生成元数据 | deliberate | backend-comment | Simulation |
| 1485 | backend/app/services/simulation_config_generator.py | 174 | generation_reasoning: str = "" # LLM的推理说明 | gap | backend-prompt-label | Simulation |
| 1486 | backend/app/services/simulation_config_generator.py | 177 | """转换为字典""" | deliberate | backend-docstring | Simulation |
| 1487 | backend/app/services/simulation_config_generator.py | 196 | """转换为JSON字符串""" | deliberate | backend-docstring | Simulation |
| 1488 | backend/app/services/simulation_config_generator.py | 202 | 模拟配置智能生成器 | deliberate | backend-docstring | Simulation |
| 1489 | backend/app/services/simulation_config_generator.py | 204 | 使用LLM分析模拟需求、文档内容、图谱实体信息, | deliberate | backend-docstring | Simulation |
| 1490 | backend/app/services/simulation_config_generator.py | 205 | 自动生成最佳的模拟参数配置 | deliberate | backend-docstring | Simulation |
| 1491 | backend/app/services/simulation_config_generator.py | 207 | 采用分步生成策略: | deliberate | backend-docstring | Simulation |
| 1492 | backend/app/services/simulation_config_generator.py | 208 | 1. 生成时间配置和事件配置(轻量级) | deliberate | backend-docstring | Simulation |
| 1493 | backend/app/services/simulation_config_generator.py | 209 | 2. 分批生成Agent配置(每批10-20个) | deliberate | backend-docstring | Simulation |
| 1494 | backend/app/services/simulation_config_generator.py | 210 | 3. 生成平台配置 | deliberate | backend-docstring | Simulation |
| 1495 | backend/app/services/simulation_config_generator.py | 213 | # 上下文最大字符数 | deliberate | backend-comment | Simulation |
| 1496 | backend/app/services/simulation_config_generator.py | 215 | # 每批生成的Agent数量 | deliberate | backend-comment | Simulation |
| 1497 | backend/app/services/simulation_config_generator.py | 218 | # 各步骤的上下文截断长度(字符数) | deliberate | backend-comment | Simulation |
| 1498 | backend/app/services/simulation_config_generator.py | 219 | TIME_CONFIG_CONTEXT_LENGTH = 10000 # 时间配置 | deliberate | backend-docstring | Simulation |
| 1499 | backend/app/services/simulation_config_generator.py | 220 | EVENT_CONFIG_CONTEXT_LENGTH = 8000 # 事件配置 | deliberate | backend-docstring | Simulation |
| 1500 | backend/app/services/simulation_config_generator.py | 221 | ENTITY_SUMMARY_LENGTH = 300 # 实体摘要 | deliberate | backend-docstring | Simulation |
| 1501 | backend/app/services/simulation_config_generator.py | 222 | AGENT_SUMMARY_LENGTH = 300 # Agent配置中的实体摘要 | deliberate | backend-docstring | Simulation |
| 1502 | backend/app/services/simulation_config_generator.py | 223 | ENTITIES_PER_TYPE_DISPLAY = 20 # 每类实体显示数量 | deliberate | backend-docstring | Simulation |
| 1503 | backend/app/services/simulation_config_generator.py | 236 | raise ValueError("LLM_API_KEY 未配置") | gap | backend-prompt-label | Simulation |
| 1504 | backend/app/services/simulation_config_generator.py | 256 | 智能生成完整的模拟配置(分步生成) | deliberate | backend-docstring | Simulation |
| 1505 | backend/app/services/simulation_config_generator.py | 259 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1506 | backend/app/services/simulation_config_generator.py | 260 | project_id: 项目ID | deliberate | backend-docstring | Simulation |
| 1507 | backend/app/services/simulation_config_generator.py | 261 | graph_id: 图谱ID | deliberate | backend-docstring | Simulation |
| 1508 | backend/app/services/simulation_config_generator.py | 262 | simulation_requirement: 模拟需求描述 | deliberate | backend-docstring | Simulation |
| 1509 | backend/app/services/simulation_config_generator.py | 263 | document_text: 原始文档内容 | deliberate | backend-docstring | Simulation |
| 1510 | backend/app/services/simulation_config_generator.py | 264 | entities: 过滤后的实体列表 | deliberate | backend-docstring | Simulation |
| 1511 | backend/app/services/simulation_config_generator.py | 265 | enable_twitter: 是否启用Twitter | deliberate | backend-docstring | Simulation |
| 1512 | backend/app/services/simulation_config_generator.py | 266 | enable_reddit: 是否启用Reddit | deliberate | backend-docstring | Simulation |
| 1513 | backend/app/services/simulation_config_generator.py | 267 | progress_callback: 进度回调函数(current_step, total_steps, message) | deliberate | backend-docstring | Simulation |
| 1514 | backend/app/services/simulation_config_generator.py | 270 | SimulationParameters: 完整的模拟参数 | deliberate | backend-docstring | Simulation |
| 1515 | backend/app/services/simulation_config_generator.py | 274 | # 计算总步骤数 | deliberate | backend-comment | Simulation |
| 1516 | backend/app/services/simulation_config_generator.py | 276 | total_steps = 3 + num_batches # 时间配置 + 事件配置 + N批Agent + 平台配置 | deliberate | backend-docstring | Simulation |
| 1517 | backend/app/services/simulation_config_generator.py | 286 | # 1. 构建基础上下文信息 | deliberate | backend-comment | Simulation |
| 1518 | backend/app/services/simulation_config_generator.py | 295 | # ========== 步骤1: 生成时间配置 ========== | deliberate | backend-comment | Simulation |
| 1519 | backend/app/services/simulation_config_generator.py | 302 | # ========== 步骤2: 生成事件配置 ========== | deliberate | backend-comment | Simulation |
| 1520 | backend/app/services/simulation_config_generator.py | 308 | # ========== 步骤3-N: 分批生成Agent配置 ========== | deliberate | backend-comment | Simulation |
| 1521 | backend/app/services/simulation_config_generator.py | 330 | # ========== 为初始帖子分配发布者 Agent ========== | deliberate | backend-comment | Simulation |
| 1522 | backend/app/services/simulation_config_generator.py | 336 | # ========== 最后一步: 生成平台配置 ========== | deliberate | backend-comment | Simulation |
| 1523 | backend/app/services/simulation_config_generator.py | 361 | # 构建最终参数 | deliberate | backend-comment | Simulation |
| 1524 | backend/app/services/simulation_config_generator.py | 387 | """构建LLM上下文,截断到最大长度""" | deliberate | backend-docstring | Simulation |
| 1525 | backend/app/services/simulation_config_generator.py | 389 | # 实体摘要 | deliberate | backend-comment | Simulation |
| 1526 | backend/app/services/simulation_config_generator.py | 392 | # 构建上下文 | deliberate | backend-comment | Simulation |
| 1527 | backend/app/services/simulation_config_generator.py | 399 | remaining_length = self.MAX_CONTEXT_LENGTH - current_length - 500 # 留500字符余量 | deliberate | backend-docstring | Simulation |
| 1528 | backend/app/services/simulation_config_generator.py | 410 | """生成实体摘要""" | deliberate | backend-docstring | Simulation |
| 1529 | backend/app/services/simulation_config_generator.py | 413 | # 按类型分组 | deliberate | backend-comment | Simulation |
| 1530 | backend/app/services/simulation_config_generator.py | 423 | # 使用配置的显示数量和摘要长度 | deliberate | backend-comment | Simulation |
| 1531 | backend/app/services/simulation_config_generator.py | 435 | """带重试的LLM调用,包含JSON修复逻辑""" | deliberate | backend-docstring | Simulation |
| 1532 | backend/app/services/simulation_config_generator.py | 450 | temperature=0.7 - (attempt * 0.1) # 每次重试降低温度 | deliberate | backend-docstring | Simulation |
| 1533 | backend/app/services/simulation_config_generator.py | 451 | # 不设置max_tokens,让LLM自由发挥 | deliberate | backend-comment | Simulation |
| 1534 | backend/app/services/simulation_config_generator.py | 457 | # 检查是否被截断 | deliberate | backend-comment | Simulation |
| 1535 | backend/app/services/simulation_config_generator.py | 462 | # 尝试解析JSON | deliberate | backend-comment | Simulation |
| 1536 | backend/app/services/simulation_config_generator.py | 468 | # 尝试修复JSON | deliberate | backend-comment | Simulation |
| 1537 | backend/app/services/simulation_config_generator.py | 481 | raise last_error or Exception("LLM调用失败") | gap | backend-prompt-label | Simulation |
| 1538 | backend/app/services/simulation_config_generator.py | 484 | """修复被截断的JSON""" | deliberate | backend-docstring | Simulation |
| 1539 | backend/app/services/simulation_config_generator.py | 487 | # 计算未闭合的括号 | deliberate | backend-comment | Simulation |
| 1540 | backend/app/services/simulation_config_generator.py | 491 | # 检查是否有未闭合的字符串 | deliberate | backend-comment | Simulation |
| 1541 | backend/app/services/simulation_config_generator.py | 495 | # 闭合括号 | deliberate | backend-comment | Simulation |
| 1542 | backend/app/services/simulation_config_generator.py | 502 | """尝试修复配置JSON""" | deliberate | backend-docstring | Simulation |
| 1543 | backend/app/services/simulation_config_generator.py | 505 | # 修复被截断的情况 | deliberate | backend-comment | Simulation |
| 1544 | backend/app/services/simulation_config_generator.py | 508 | # 提取JSON部分 | deliberate | backend-comment | Simulation |
| 1545 | backend/app/services/simulation_config_generator.py | 513 | # 移除字符串中的换行符 | deliberate | backend-comment | Simulation |
| 1546 | backend/app/services/simulation_config_generator.py | 525 | # 尝试移除所有控制字符 | deliberate | backend-comment | Simulation |
| 1547 | backend/app/services/simulation_config_generator.py | 536 | """生成时间配置""" | deliberate | backend-docstring | Simulation |
| 1548 | backend/app/services/simulation_config_generator.py | 537 | # 使用配置的上下文截断长度 | deliberate | backend-comment | Simulation |
| 1549 | backend/app/services/simulation_config_generator.py | 540 | # 计算最大允许值(80%的agent数) | deliberate | backend-comment | Simulation |
| 1550 | backend/app/services/simulation_config_generator.py | 598 | """获取默认时间配置(中国人作息)""" | deliberate | backend-docstring | Simulation |
| 1551 | backend/app/services/simulation_config_generator.py | 601 | "minutes_per_round": 60, # 每轮1小时,加快时间流速 | gap | backend-prompt-label | Simulation |
| 1552 | backend/app/services/simulation_config_generator.py | 612 | """解析时间配置结果,并验证agents_per_hour值不超过总agent数""" | deliberate | backend-docstring | Simulation |
| 1553 | backend/app/services/simulation_config_generator.py | 613 | # 获取原始值 | deliberate | backend-comment | Simulation |
| 1554 | backend/app/services/simulation_config_generator.py | 617 | # 验证并修正:确保不超过总agent数 | deliberate | backend-comment | Simulation |
| 1555 | backend/app/services/simulation_config_generator.py | 626 | # 确保 min < max | deliberate | backend-comment | Simulation |
| 1556 | backend/app/services/simulation_config_generator.py | 633 | minutes_per_round=result.get("minutes_per_round", 60), # 默认每轮1小时 | gap | backend-prompt-label | Simulation |
| 1557 | backend/app/services/simulation_config_generator.py | 638 | off_peak_activity_multiplier=0.05, # 凌晨几乎无人 | deliberate | backend-docstring | Simulation |
| 1558 | backend/app/services/simulation_config_generator.py | 652 | """生成事件配置""" | deliberate | backend-docstring | Simulation |
| 1559 | backend/app/services/simulation_config_generator.py | 654 | # 获取可用的实体类型列表,供 LLM 参考 | deliberate | backend-comment | Simulation |
| 1560 | backend/app/services/simulation_config_generator.py | 659 | # 为每种类型列出代表性实体名称 | deliberate | backend-comment | Simulation |
| 1561 | backend/app/services/simulation_config_generator.py | 673 | # 使用配置的上下文截断长度 | deliberate | backend-comment | Simulation |
| 1562 | backend/app/services/simulation_config_generator.py | 720 | """解析事件配置结果""" | deliberate | backend-docstring | Simulation |
| 1563 | backend/app/services/simulation_config_generator.py | 734 | 为初始帖子分配合适的发布者 Agent | deliberate | backend-docstring | Simulation |
| 1564 | backend/app/services/simulation_config_generator.py | 736 | 根据每个帖子的 poster_type 匹配最合适的 agent_id | deliberate | backend-docstring | Simulation |
| 1565 | backend/app/services/simulation_config_generator.py | 741 | # 按实体类型建立 agent 索引 | deliberate | backend-comment | Simulation |
| 1566 | backend/app/services/simulation_config_generator.py | 749 | # 类型映射表(处理 LLM 可能输出的不同格式) | deliberate | backend-comment | Simulation |
| 1567 | backend/app/services/simulation_config_generator.py | 761 | # 记录每种类型已使用的 agent 索引,避免重复使用同一个 agent | deliberate | backend-comment | Simulation |
| 1568 | backend/app/services/simulation_config_generator.py | 769 | # 尝试找到匹配的 agent | deliberate | backend-comment | Simulation |
| 1569 | backend/app/services/simulation_config_generator.py | 772 | # 1. 直接匹配 | deliberate | backend-comment | Simulation |
| 1570 | backend/app/services/simulation_config_generator.py | 779 | # 2. 使用别名匹配 | deliberate | backend-comment | Simulation |
| 1571 | backend/app/services/simulation_config_generator.py | 792 | # 3. 如果仍未找到,使用影响力最高的 agent | deliberate | backend-comment | Simulation |
| 1572 | backend/app/services/simulation_config_generator.py | 796 | # 按影响力排序,选择影响力最高的 | deliberate | backend-comment | Simulation |
| 1573 | backend/app/services/simulation_config_generator.py | 820 | """分批生成Agent配置""" | deliberate | backend-docstring | Simulation |
| 1574 | backend/app/services/simulation_config_generator.py | 822 | # 构建实体信息(使用配置的摘要长度) | deliberate | backend-comment | Simulation |
| 1575 | backend/app/services/simulation_config_generator.py | 879 | # 构建AgentActivityConfig对象 | deliberate | backend-comment | Simulation |
| 1576 | backend/app/services/simulation_config_generator.py | 885 | # 如果LLM没有生成,使用规则生成 | deliberate | backend-comment | Simulation |
| 1577 | backend/app/services/simulation_config_generator.py | 909 | """基于规则生成单个Agent配置(中国人作息)""" | deliberate | backend-docstring | Simulation |
| 1578 | backend/app/services/simulation_config_generator.py | 913 | # 官方机构:工作时间活动,低频率,高影响力 | deliberate | backend-comment | Simulation |
| 1579 | backend/app/services/simulation_config_generator.py | 926 | # 媒体:全天活动,中等频率,高影响力 | deliberate | backend-comment | Simulation |
| 1580 | backend/app/services/simulation_config_generator.py | 939 | # 专家/教授:工作+晚间活动,中等频率 | deliberate | backend-comment | Simulation |
| 1581 | backend/app/services/simulation_config_generator.py | 952 | # 学生:晚间为主,高频率 | deliberate | backend-comment | Simulation |
| 1582 | backend/app/services/simulation_config_generator.py | 957 | "active_hours": [8, 9, 10, 11, 12, 13, 18, 19, 20, 21, 22, 23], # 上午+晚间 | gap | backend-prompt-label | Simulation |
| 1583 | backend/app/services/simulation_config_generator.py | 965 | # 校友:晚间为主 | deliberate | backend-comment | Simulation |
| 1584 | backend/app/services/simulation_config_generator.py | 970 | "active_hours": [12, 13, 19, 20, 21, 22, 23], # 午休+晚间 | gap | backend-prompt-label | Simulation |
| 1585 | backend/app/services/simulation_config_generator.py | 978 | # 普通人:晚间高峰 | deliberate | backend-comment | Simulation |
| 1586 | backend/app/services/simulation_config_generator.py | 983 | "active_hours": [9, 10, 11, 12, 13, 18, 19, 20, 21, 22, 23], # 白天+晚间 | gap | backend-prompt-label | Simulation |
| 1587 | backend/app/services/simulation_ipc.py | 2 | 模拟IPC通信模块 | deliberate | backend-docstring | Simulation |
| 1588 | backend/app/services/simulation_ipc.py | 3 | 用于Flask后端和模拟脚本之间的进程间通信 | deliberate | backend-docstring | Simulation |
| 1589 | backend/app/services/simulation_ipc.py | 5 | 通过文件系统实现简单的命令/响应模式: | deliberate | backend-docstring | Simulation |
| 1590 | backend/app/services/simulation_ipc.py | 6 | 1. Flask写入命令到 commands/ 目录 | deliberate | backend-docstring | Simulation |
| 1591 | backend/app/services/simulation_ipc.py | 7 | 2. 模拟脚本轮询命令目录,执行命令并写入响应到 responses/ 目录 | deliberate | backend-docstring | Simulation |
| 1592 | backend/app/services/simulation_ipc.py | 8 | 3. Flask轮询响应目录获取结果 | deliberate | backend-docstring | Simulation |
| 1593 | backend/app/services/simulation_ipc.py | 27 | """命令类型""" | deliberate | backend-docstring | Simulation |
| 1594 | backend/app/services/simulation_ipc.py | 28 | INTERVIEW = "interview" # 单个Agent采访 | review-needed | backend-string | Simulation |
| 1595 | backend/app/services/simulation_ipc.py | 29 | BATCH_INTERVIEW = "batch_interview" # 批量采访 | review-needed | backend-string | Simulation |
| 1596 | backend/app/services/simulation_ipc.py | 30 | CLOSE_ENV = "close_env" # 关闭环境 | review-needed | backend-string | Simulation |
| 1597 | backend/app/services/simulation_ipc.py | 34 | """命令状态""" | deliberate | backend-docstring | Simulation |
| 1598 | backend/app/services/simulation_ipc.py | 43 | """IPC命令""" | deliberate | backend-docstring | Simulation |
| 1599 | backend/app/services/simulation_ipc.py | 69 | """IPC响应""" | deliberate | backend-docstring | Simulation |
| 1600 | backend/app/services/simulation_ipc.py | 98 | 模拟IPC客户端(Flask端使用) | deliberate | backend-docstring | Simulation |
| 1601 | backend/app/services/simulation_ipc.py | 100 | 用于向模拟进程发送命令并等待响应 | deliberate | backend-docstring | Simulation |
| 1602 | backend/app/services/simulation_ipc.py | 105 | 初始化IPC客户端 | deliberate | backend-docstring | Simulation |
| 1603 | backend/app/services/simulation_ipc.py | 108 | simulation_dir: 模拟数据目录 | deliberate | backend-docstring | Simulation |
| 1604 | backend/app/services/simulation_ipc.py | 114 | # 确保目录存在 | deliberate | backend-comment | Simulation |
| 1605 | backend/app/services/simulation_ipc.py | 126 | 发送命令并等待响应 | deliberate | backend-docstring | Simulation |
| 1606 | backend/app/services/simulation_ipc.py | 129 | command_type: 命令类型 | deliberate | backend-docstring | Simulation |
| 1607 | backend/app/services/simulation_ipc.py | 130 | args: 命令参数 | deliberate | backend-docstring | Simulation |
| 1608 | backend/app/services/simulation_ipc.py | 131 | timeout: 超时时间(秒) | deliberate | backend-docstring | Simulation |
| 1609 | backend/app/services/simulation_ipc.py | 132 | poll_interval: 轮询间隔(秒) | deliberate | backend-docstring | Simulation |
| 1610 | backend/app/services/simulation_ipc.py | 138 | TimeoutError: 等待响应超时 | deliberate | backend-docstring | Simulation |
| 1611 | backend/app/services/simulation_ipc.py | 147 | # 写入命令文件 | deliberate | backend-comment | Simulation |
| 1612 | backend/app/services/simulation_ipc.py | 154 | # 等待响应 | deliberate | backend-comment | Simulation |
| 1613 | backend/app/services/simulation_ipc.py | 165 | # 清理命令和响应文件 | deliberate | backend-comment | Simulation |
| 1614 | backend/app/services/simulation_ipc.py | 179 | # 超时 | deliberate | backend-comment | Simulation |
| 1615 | backend/app/services/simulation_ipc.py | 182 | # 清理命令文件 | deliberate | backend-comment | Simulation |
| 1616 | backend/app/services/simulation_ipc.py | 188 | raise TimeoutError(f"等待命令响应超时 ({timeout}秒)") | review-needed | backend-string | Simulation |
| 1617 | backend/app/services/simulation_ipc.py | 198 | 发送单个Agent采访命令 | deliberate | backend-docstring | Simulation |
| 1618 | backend/app/services/simulation_ipc.py | 202 | prompt: 采访问题 | deliberate | backend-docstring | Simulation |
| 1619 | backend/app/services/simulation_ipc.py | 203 | platform: 指定平台(可选) | deliberate | backend-docstring | Simulation |
| 1620 | backend/app/services/simulation_ipc.py | 204 | - "twitter": 只采访Twitter平台 | review-needed | backend-string | Simulation |
| 1621 | backend/app/services/simulation_ipc.py | 205 | - "reddit": 只采访Reddit平台 | review-needed | backend-string | Simulation |
| 1622 | backend/app/services/simulation_ipc.py | 206 | - None: 双平台模拟时同时采访两个平台,单平台模拟时采访该平台 | deliberate | backend-docstring | Simulation |
| 1623 | backend/app/services/simulation_ipc.py | 207 | timeout: 超时时间 | deliberate | backend-docstring | Simulation |
| 1624 | backend/app/services/simulation_ipc.py | 210 | IPCResponse,result字段包含采访结果 | deliberate | backend-docstring | Simulation |
| 1625 | backend/app/services/simulation_ipc.py | 232 | 发送批量采访命令 | deliberate | backend-docstring | Simulation |
| 1626 | backend/app/services/simulation_ipc.py | 235 | interviews: 采访列表,每个元素包含 {"agent_id": int, "prompt": str, "platform": str(可选)} | review-needed | backend-string | Simulation |
| 1627 | backend/app/services/simulation_ipc.py | 236 | platform: 默认平台(可选,会被每个采访项的platform覆盖) | deliberate | backend-docstring | Simulation |
| 1628 | backend/app/services/simulation_ipc.py | 237 | - "twitter": 默认只采访Twitter平台 | review-needed | backend-string | Simulation |
| 1629 | backend/app/services/simulation_ipc.py | 238 | - "reddit": 默认只采访Reddit平台 | review-needed | backend-string | Simulation |
| 1630 | backend/app/services/simulation_ipc.py | 239 | - None: 双平台模拟时每个Agent同时采访两个平台 | deliberate | backend-docstring | Simulation |
| 1631 | backend/app/services/simulation_ipc.py | 240 | timeout: 超时时间 | deliberate | backend-docstring | Simulation |
| 1632 | backend/app/services/simulation_ipc.py | 243 | IPCResponse,result字段包含所有采访结果 | deliberate | backend-docstring | Simulation |
| 1633 | backend/app/services/simulation_ipc.py | 257 | 发送关闭环境命令 | deliberate | backend-docstring | Simulation |
| 1634 | backend/app/services/simulation_ipc.py | 260 | timeout: 超时时间 | deliberate | backend-docstring | Simulation |
| 1635 | backend/app/services/simulation_ipc.py | 273 | 检查模拟环境是否存活 | deliberate | backend-docstring | Simulation |
| 1636 | backend/app/services/simulation_ipc.py | 275 | 通过检查 env_status.json 文件来判断 | deliberate | backend-docstring | Simulation |
| 1637 | backend/app/services/simulation_ipc.py | 291 | 模拟IPC服务器(模拟脚本端使用) | deliberate | backend-docstring | Simulation |
| 1638 | backend/app/services/simulation_ipc.py | 293 | 轮询命令目录,执行命令并返回响应 | deliberate | backend-docstring | Simulation |
| 1639 | backend/app/services/simulation_ipc.py | 298 | 初始化IPC服务器 | deliberate | backend-docstring | Simulation |
| 1640 | backend/app/services/simulation_ipc.py | 301 | simulation_dir: 模拟数据目录 | deliberate | backend-docstring | Simulation |
| 1641 | backend/app/services/simulation_ipc.py | 307 | # 确保目录存在 | deliberate | backend-comment | Simulation |
| 1642 | backend/app/services/simulation_ipc.py | 311 | # 环境状态 | deliberate | backend-comment | Simulation |
| 1643 | backend/app/services/simulation_ipc.py | 315 | """标记服务器为运行状态""" | deliberate | backend-docstring | Simulation |
| 1644 | backend/app/services/simulation_ipc.py | 320 | """标记服务器为停止状态""" | deliberate | backend-docstring | Simulation |
| 1645 | backend/app/services/simulation_ipc.py | 325 | """更新环境状态文件""" | deliberate | backend-docstring | Simulation |
| 1646 | backend/app/services/simulation_ipc.py | 335 | 轮询命令目录,返回第一个待处理的命令 | deliberate | backend-docstring | Simulation |
| 1647 | backend/app/services/simulation_ipc.py | 338 | IPCCommand 或 None | deliberate | backend-docstring | Simulation |
| 1648 | backend/app/services/simulation_ipc.py | 343 | # 按时间排序获取命令文件 | deliberate | backend-comment | Simulation |
| 1649 | backend/app/services/simulation_ipc.py | 365 | 发送响应 | deliberate | backend-docstring | Simulation |
| 1650 | backend/app/services/simulation_ipc.py | 368 | response: IPC响应 | deliberate | backend-docstring | Simulation |
| 1651 | backend/app/services/simulation_ipc.py | 374 | # 删除命令文件 | deliberate | backend-comment | Simulation |
| 1652 | backend/app/services/simulation_ipc.py | 382 | """发送成功响应""" | deliberate | backend-docstring | Simulation |
| 1653 | backend/app/services/simulation_ipc.py | 390 | """发送错误响应""" | deliberate | backend-docstring | Simulation |
| 1654 | backend/app/services/simulation_manager.py | 2 | OASIS模拟管理器 | deliberate | backend-docstring | Simulation |
| 1655 | backend/app/services/simulation_manager.py | 3 | 管理Twitter和Reddit双平台并行模拟 | deliberate | backend-docstring | Simulation |
| 1656 | backend/app/services/simulation_manager.py | 4 | 使用预设脚本 + LLM智能生成配置参数 | deliberate | backend-docstring | Simulation |
| 1657 | backend/app/services/simulation_manager.py | 26 | """模拟状态""" | deliberate | backend-docstring | Simulation |
| 1658 | backend/app/services/simulation_manager.py | 32 | STOPPED = "stopped" # 模拟被手动停止 | review-needed | backend-string | Simulation |
| 1659 | backend/app/services/simulation_manager.py | 33 | COMPLETED = "completed" # 模拟自然完成 | review-needed | backend-string | Simulation |
| 1660 | backend/app/services/simulation_manager.py | 38 | """平台类型""" | deliberate | backend-docstring | Simulation |
| 1661 | backend/app/services/simulation_manager.py | 45 | """模拟状态""" | deliberate | backend-docstring | Simulation |
| 1662 | backend/app/services/simulation_manager.py | 50 | # 平台启用状态 | deliberate | backend-comment | Simulation |
| 1663 | backend/app/services/simulation_manager.py | 54 | # 状态 | deliberate | backend-comment | Simulation |
| 1664 | backend/app/services/simulation_manager.py | 57 | # 准备阶段数据 | deliberate | backend-comment | Simulation |
| 1665 | backend/app/services/simulation_manager.py | 62 | # 配置生成信息 | deliberate | backend-comment | Simulation |
| 1666 | backend/app/services/simulation_manager.py | 66 | # 运行时数据 | deliberate | backend-comment | Simulation |
| 1667 | backend/app/services/simulation_manager.py | 71 | # 时间戳 | deliberate | backend-comment | Simulation |
| 1668 | backend/app/services/simulation_manager.py | 75 | # 错误信息 | deliberate | backend-comment | Simulation |
| 1669 | backend/app/services/simulation_manager.py | 79 | """完整状态字典(内部使用)""" | deliberate | backend-docstring | Simulation |
| 1670 | backend/app/services/simulation_manager.py | 101 | """简化状态字典(API返回使用)""" | deliberate | backend-docstring | Simulation |
| 1671 | backend/app/services/simulation_manager.py | 117 | 模拟管理器 | deliberate | backend-docstring | Simulation |
| 1672 | backend/app/services/simulation_manager.py | 119 | 核心功能: | deliberate | backend-docstring | Simulation |
| 1673 | backend/app/services/simulation_manager.py | 120 | 1. 从Zep图谱读取实体并过滤 | deliberate | backend-docstring | Simulation |
| 1674 | backend/app/services/simulation_manager.py | 121 | 2. 生成OASIS Agent Profile | deliberate | backend-docstring | Simulation |
| 1675 | backend/app/services/simulation_manager.py | 122 | 3. 使用LLM智能生成模拟配置参数 | deliberate | backend-docstring | Simulation |
| 1676 | backend/app/services/simulation_manager.py | 123 | 4. 准备预设脚本所需的所有文件 | deliberate | backend-docstring | Simulation |
| 1677 | backend/app/services/simulation_manager.py | 126 | # 模拟数据存储目录 | deliberate | backend-comment | Simulation |
| 1678 | backend/app/services/simulation_manager.py | 133 | # 确保目录存在 | deliberate | backend-comment | Simulation |
| 1679 | backend/app/services/simulation_manager.py | 136 | # 内存中的模拟状态缓存 | deliberate | backend-comment | Simulation |
| 1680 | backend/app/services/simulation_manager.py | 140 | """获取模拟数据目录""" | deliberate | backend-docstring | Simulation |
| 1681 | backend/app/services/simulation_manager.py | 146 | """保存模拟状态到文件""" | deliberate | backend-docstring | Simulation |
| 1682 | backend/app/services/simulation_manager.py | 158 | """从文件加载模拟状态""" | deliberate | backend-docstring | Simulation |
| 1683 | backend/app/services/simulation_manager.py | 202 | 创建新的模拟 | deliberate | backend-docstring | Simulation |
| 1684 | backend/app/services/simulation_manager.py | 205 | project_id: 项目ID | deliberate | backend-docstring | Simulation |
| 1685 | backend/app/services/simulation_manager.py | 206 | graph_id: Zep图谱ID | deliberate | backend-docstring | Simulation |
| 1686 | backend/app/services/simulation_manager.py | 207 | enable_twitter: 是否启用Twitter模拟 | deliberate | backend-docstring | Simulation |
| 1687 | backend/app/services/simulation_manager.py | 208 | enable_reddit: 是否启用Reddit模拟 | deliberate | backend-docstring | Simulation |
| 1688 | backend/app/services/simulation_manager.py | 241 | 准备模拟环境(全程自动化) | deliberate | backend-docstring | Simulation |
| 1689 | backend/app/services/simulation_manager.py | 243 | 步骤: | deliberate | backend-docstring | Simulation |
| 1690 | backend/app/services/simulation_manager.py | 244 | 1. 从Zep图谱读取并过滤实体 | deliberate | backend-docstring | Simulation |
| 1691 | backend/app/services/simulation_manager.py | 245 | 2. 为每个实体生成OASIS Agent Profile(可选LLM增强,支持并行) | deliberate | backend-docstring | Simulation |
| 1692 | backend/app/services/simulation_manager.py | 246 | 3. 使用LLM智能生成模拟配置参数(时间、活跃度、发言频率等) | deliberate | backend-docstring | Simulation |
| 1693 | backend/app/services/simulation_manager.py | 247 | 4. 保存配置文件和Profile文件 | deliberate | backend-docstring | Simulation |
| 1694 | backend/app/services/simulation_manager.py | 248 | 5. 复制预设脚本到模拟目录 | deliberate | backend-docstring | Simulation |
| 1695 | backend/app/services/simulation_manager.py | 251 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1696 | backend/app/services/simulation_manager.py | 252 | simulation_requirement: 模拟需求描述(用于LLM生成配置) | deliberate | backend-docstring | Simulation |
| 1697 | backend/app/services/simulation_manager.py | 253 | document_text: 原始文档内容(用于LLM理解背景) | deliberate | backend-docstring | Simulation |
| 1698 | backend/app/services/simulation_manager.py | 254 | defined_entity_types: 预定义的实体类型(可选) | deliberate | backend-docstring | Simulation |
| 1699 | backend/app/services/simulation_manager.py | 255 | use_llm_for_profiles: 是否使用LLM生成详细人设 | deliberate | backend-docstring | Simulation |
| 1700 | backend/app/services/simulation_manager.py | 256 | progress_callback: 进度回调函数 (stage, progress, message) | deliberate | backend-docstring | Simulation |
| 1701 | backend/app/services/simulation_manager.py | 257 | parallel_profile_count: 并行生成人设的数量,默认3 | deliberate | backend-docstring | Simulation |
| 1702 | backend/app/services/simulation_manager.py | 264 | raise ValueError(f"模拟不存在: {simulation_id}") | review-needed | backend-string | Simulation |
| 1703 | backend/app/services/simulation_manager.py | 272 | # ========== 阶段1: 读取并过滤实体 ========== | deliberate | backend-comment | Simulation |
| 1704 | backend/app/services/simulation_manager.py | 300 | state.error = "没有找到符合条件的实体,请检查图谱是否正确构建" | review-needed | backend-string | Simulation |
| 1705 | backend/app/services/simulation_manager.py | 304 | # ========== 阶段2: 生成Agent Profile ========== | deliberate | backend-comment | Simulation |
| 1706 | backend/app/services/simulation_manager.py | 315 | # 传入graph_id以启用Zep检索功能,获取更丰富的上下文 | deliberate | backend-comment | Simulation |
| 1707 | backend/app/services/simulation_manager.py | 329 | # 设置实时保存的文件路径(优先使用 Reddit JSON 格式) | deliberate | backend-comment | Simulation |
| 1708 | backend/app/services/simulation_manager.py | 343 | graph_id=state.graph_id, # 传入graph_id用于Zep检索 | deliberate | backend-docstring | Simulation |
| 1709 | backend/app/services/simulation_manager.py | 344 | parallel_count=parallel_profile_count, # 并行生成数量 | deliberate | backend-docstring | Simulation |
| 1710 | backend/app/services/simulation_manager.py | 345 | realtime_output_path=realtime_output_path, # 实时保存路径 | deliberate | backend-docstring | Simulation |
| 1711 | backend/app/services/simulation_manager.py | 346 | output_platform=realtime_platform # 输出格式 | deliberate | backend-docstring | Simulation |
| 1712 | backend/app/services/simulation_manager.py | 351 | # 保存Profile文件(注意:Twitter使用CSV格式,Reddit使用JSON格式) | deliberate | backend-comment | Simulation |
| 1713 | backend/app/services/simulation_manager.py | 352 | # Reddit 已经在生成过程中实时保存了,这里再保存一次确保完整性 | deliberate | backend-comment | Simulation |
| 1714 | backend/app/services/simulation_manager.py | 369 | # Twitter使用CSV格式!这是OASIS的要求 | deliberate | backend-comment | Simulation |
| 1715 | backend/app/services/simulation_manager.py | 384 | # ========== 阶段3: LLM智能生成模拟配置 ========== | deliberate | backend-comment | Simulation |
| 1716 | backend/app/services/simulation_manager.py | 422 | # 保存配置文件 | deliberate | backend-comment | Simulation |
| 1717 | backend/app/services/simulation_manager.py | 438 | # 注意:运行脚本保留在 backend/scripts/ 目录,不再复制到模拟目录 | deliberate | backend-comment | Simulation |
| 1718 | backend/app/services/simulation_manager.py | 439 | # 启动模拟时,simulation_runner 会从 scripts/ 目录运行脚本 | deliberate | backend-comment | Simulation |
| 1719 | backend/app/services/simulation_manager.py | 441 | # 更新状态 | deliberate | backend-comment | Simulation |
| 1720 | backend/app/services/simulation_manager.py | 459 | """获取模拟状态""" | deliberate | backend-docstring | Simulation |
| 1721 | backend/app/services/simulation_manager.py | 463 | """列出所有模拟""" | deliberate | backend-docstring | Simulation |
| 1722 | backend/app/services/simulation_manager.py | 468 | # 跳过隐藏文件(如 .DS_Store)和非目录文件 | deliberate | backend-comment | Simulation |
| 1723 | backend/app/services/simulation_manager.py | 481 | """获取模拟的Agent Profile""" | deliberate | backend-docstring | Simulation |
| 1724 | backend/app/services/simulation_manager.py | 484 | raise ValueError(f"模拟不存在: {simulation_id}") | review-needed | backend-string | Simulation |
| 1725 | backend/app/services/simulation_manager.py | 496 | """获取模拟配置""" | deliberate | backend-docstring | Simulation |
| 1726 | backend/app/services/simulation_manager.py | 507 | """获取运行说明""" | deliberate | backend-docstring | Simulation |
| 1727 | backend/app/services/simulation_manager.py | 522 | f"1. 激活conda环境: conda activate MiroFish\n" | review-needed | backend-string | Simulation |
| 1728 | backend/app/services/simulation_manager.py | 523 | f"2. 运行模拟 (脚本位于 {scripts_dir}):\n" | review-needed | backend-string | Simulation |
| 1729 | backend/app/services/simulation_manager.py | 524 | f" - 单独运行Twitter: python {scripts_dir}/run_twitter_simulation.py --config {config_path}\n" | review-needed | backend-string | Simulation |
| 1730 | backend/app/services/simulation_manager.py | 525 | f" - 单独运行Reddit: python {scripts_dir}/run_reddit_simulation.py --config {config_path}\n" | review-needed | backend-string | Simulation |
| 1731 | backend/app/services/simulation_manager.py | 526 | f" - 并行运行双平台: python {scripts_dir}/run_parallel_simulation.py --config {config_path}" | review-needed | backend-string | Simulation |
| 1732 | backend/app/services/simulation_runner.py | 2 | OASIS模拟运行器 | deliberate | backend-docstring | Simulation |
| 1733 | backend/app/services/simulation_runner.py | 3 | 在后台运行模拟并记录每个Agent的动作,支持实时状态监控 | deliberate | backend-docstring | Simulation |
| 1734 | backend/app/services/simulation_runner.py | 29 | # 标记是否已注册清理函数 | deliberate | backend-comment | Simulation |
| 1735 | backend/app/services/simulation_runner.py | 32 | # 平台检测 | deliberate | backend-comment | Simulation |
| 1736 | backend/app/services/simulation_runner.py | 37 | """运行器状态""" | deliberate | backend-docstring | Simulation |
| 1737 | backend/app/services/simulation_runner.py | 50 | """Agent动作记录""" | deliberate | backend-docstring | Simulation |
| 1738 | backend/app/services/simulation_runner.py | 77 | """每轮摘要""" | deliberate | backend-docstring | Simulation |
| 1739 | backend/app/services/simulation_runner.py | 103 | """模拟运行状态(实时)""" | deliberate | backend-docstring | Simulation |
| 1740 | backend/app/services/simulation_runner.py | 107 | # 进度信息 | deliberate | backend-comment | Simulation |
| 1741 | backend/app/services/simulation_runner.py | 113 | # 各平台独立轮次和模拟时间(用于双平台并行显示) | deliberate | backend-comment | Simulation |
| 1742 | backend/app/services/simulation_runner.py | 119 | # 平台状态 | deliberate | backend-comment | Simulation |
| 1743 | backend/app/services/simulation_runner.py | 125 | # 平台完成状态(通过检测 actions.jsonl 中的 simulation_end 事件) | deliberate | backend-comment | Simulation |
| 1744 | backend/app/services/simulation_runner.py | 129 | # 每轮摘要 | deliberate | backend-comment | Simulation |
| 1745 | backend/app/services/simulation_runner.py | 132 | # 最近动作(用于前端实时展示) | deliberate | backend-comment | Simulation |
| 1746 | backend/app/services/simulation_runner.py | 136 | # 时间戳 | deliberate | backend-comment | Simulation |
| 1747 | backend/app/services/simulation_runner.py | 141 | # 错误信息 | deliberate | backend-comment | Simulation |
| 1748 | backend/app/services/simulation_runner.py | 144 | # 进程ID(用于停止) | deliberate | backend-comment | Simulation |
| 1749 | backend/app/services/simulation_runner.py | 148 | """添加动作到最近动作列表""" | deliberate | backend-docstring | Simulation |
| 1750 | backend/app/services/simulation_runner.py | 169 | # 各平台独立轮次和时间 | deliberate | backend-comment | Simulation |
| 1751 | backend/app/services/simulation_runner.py | 189 | """包含最近动作的详细信息""" | deliberate | backend-docstring | Simulation |
| 1752 | backend/app/services/simulation_runner.py | 198 | 模拟运行器 | deliberate | backend-docstring | Simulation |
| 1753 | backend/app/services/simulation_runner.py | 200 | 负责: | deliberate | backend-docstring | Simulation |
| 1754 | backend/app/services/simulation_runner.py | 201 | 1. 在后台进程中运行OASIS模拟 | deliberate | backend-docstring | Simulation |
| 1755 | backend/app/services/simulation_runner.py | 202 | 2. 解析运行日志,记录每个Agent的动作 | deliberate | backend-docstring | Simulation |
| 1756 | backend/app/services/simulation_runner.py | 203 | 3. 提供实时状态查询接口 | deliberate | backend-docstring | Simulation |
| 1757 | backend/app/services/simulation_runner.py | 204 | 4. 支持暂停/停止/恢复操作 | deliberate | backend-docstring | Simulation |
| 1758 | backend/app/services/simulation_runner.py | 207 | # 运行状态存储目录 | deliberate | backend-comment | Simulation |
| 1759 | backend/app/services/simulation_runner.py | 213 | # 脚本目录 | deliberate | backend-comment | Simulation |
| 1760 | backend/app/services/simulation_runner.py | 219 | # 内存中的运行状态 | deliberate | backend-comment | Simulation |
| 1761 | backend/app/services/simulation_runner.py | 224 | _stdout_files: Dict[str, Any] = {} # 存储 stdout 文件句柄 | deliberate | backend-docstring | Simulation |
| 1762 | backend/app/services/simulation_runner.py | 225 | _stderr_files: Dict[str, Any] = {} # 存储 stderr 文件句柄 | deliberate | backend-docstring | Simulation |
| 1763 | backend/app/services/simulation_runner.py | 227 | # 图谱记忆更新配置 | deliberate | backend-comment | Simulation |
| 1764 | backend/app/services/simulation_runner.py | 232 | """获取运行状态""" | deliberate | backend-docstring | Simulation |
| 1765 | backend/app/services/simulation_runner.py | 236 | # 尝试从文件加载 | deliberate | backend-comment | Simulation |
| 1766 | backend/app/services/simulation_runner.py | 244 | """从文件加载运行状态""" | deliberate | backend-docstring | Simulation |
| 1767 | backend/app/services/simulation_runner.py | 260 | # 各平台独立轮次和时间 | deliberate | backend-comment | Simulation |
| 1768 | backend/app/services/simulation_runner.py | 278 | # 加载最近动作 | deliberate | backend-comment | Simulation |
| 1769 | backend/app/services/simulation_runner.py | 300 | """保存运行状态到文件""" | deliberate | backend-docstring | Simulation |
| 1770 | backend/app/services/simulation_runner.py | 317 | max_rounds: int = None, # 最大模拟轮数(可选,用于截断过长的模拟) | deliberate | backend-docstring | Simulation |
| 1771 | backend/app/services/simulation_runner.py | 318 | enable_graph_memory_update: bool = False, # 是否将活动更新到Zep图谱 | deliberate | backend-docstring | Simulation |
| 1772 | backend/app/services/simulation_runner.py | 319 | graph_id: str = None # Zep图谱ID(启用图谱更新时必需) | deliberate | backend-docstring | Simulation |
| 1773 | backend/app/services/simulation_runner.py | 322 | 启动模拟 | deliberate | backend-docstring | Simulation |
| 1774 | backend/app/services/simulation_runner.py | 325 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1775 | backend/app/services/simulation_runner.py | 326 | platform: 运行平台 (twitter/reddit/parallel) | deliberate | backend-docstring | Simulation |
| 1776 | backend/app/services/simulation_runner.py | 327 | max_rounds: 最大模拟轮数(可选,用于截断过长的模拟) | deliberate | backend-docstring | Simulation |
| 1777 | backend/app/services/simulation_runner.py | 328 | enable_graph_memory_update: 是否将Agent活动动态更新到Zep图谱 | deliberate | backend-docstring | Simulation |
| 1778 | backend/app/services/simulation_runner.py | 329 | graph_id: Zep图谱ID(启用图谱更新时必需) | deliberate | backend-docstring | Simulation |
| 1779 | backend/app/services/simulation_runner.py | 334 | # 检查是否已在运行 | deliberate | backend-comment | Simulation |
| 1780 | backend/app/services/simulation_runner.py | 337 | raise ValueError(f"模拟已在运行中: {simulation_id}") | review-needed | backend-string | Simulation |
| 1781 | backend/app/services/simulation_runner.py | 339 | # 加载模拟配置 | deliberate | backend-comment | Simulation |
| 1782 | backend/app/services/simulation_runner.py | 344 | raise ValueError(f"模拟配置不存在,请先调用 /prepare 接口") | review-needed | backend-string | Simulation |
| 1783 | backend/app/services/simulation_runner.py | 349 | # 初始化运行状态 | deliberate | backend-comment | Simulation |
| 1784 | backend/app/services/simulation_runner.py | 355 | # 如果指定了最大轮数,则截断 | deliberate | backend-comment | Simulation |
| 1785 | backend/app/services/simulation_runner.py | 372 | # 如果启用图谱记忆更新,创建更新器 | deliberate | backend-comment | Simulation |
| 1786 | backend/app/services/simulation_runner.py | 375 | raise ValueError("启用图谱记忆更新时必须提供 graph_id") | review-needed | backend-string | Simulation |
| 1787 | backend/app/services/simulation_runner.py | 387 | # 确定运行哪个脚本(脚本位于 backend/scripts/ 目录) | deliberate | backend-comment | Simulation |
| 1788 | backend/app/services/simulation_runner.py | 402 | raise ValueError(f"脚本不存在: {script_path}") | review-needed | backend-string | Simulation |
| 1789 | backend/app/services/simulation_runner.py | 404 | # 创建动作队列 | deliberate | backend-comment | Simulation |
| 1790 | backend/app/services/simulation_runner.py | 408 | # 启动模拟进程 | deliberate | backend-comment | Simulation |
| 1791 | backend/app/services/simulation_runner.py | 410 | # 构建运行命令,使用完整路径 | deliberate | backend-comment | Simulation |
| 1792 | backend/app/services/simulation_runner.py | 411 | # 新的日志结构: | deliberate | backend-comment | Simulation |
| 1793 | backend/app/services/simulation_runner.py | 412 | # twitter/actions.jsonl - Twitter 动作日志 | deliberate | backend-comment | Simulation |
| 1794 | backend/app/services/simulation_runner.py | 413 | # reddit/actions.jsonl - Reddit 动作日志 | deliberate | backend-comment | Simulation |
| 1795 | backend/app/services/simulation_runner.py | 414 | # simulation.log - 主进程日志 | deliberate | backend-comment | Simulation |
| 1796 | backend/app/services/simulation_runner.py | 417 | sys.executable, # Python解释器 | deliberate | backend-docstring | Simulation |
| 1797 | backend/app/services/simulation_runner.py | 419 | "--config", config_path, # 使用完整配置文件路径 | review-needed | backend-string | Simulation |
| 1798 | backend/app/services/simulation_runner.py | 422 | # 如果指定了最大轮数,添加到命令行参数 | deliberate | backend-comment | Simulation |
| 1799 | backend/app/services/simulation_runner.py | 426 | # 创建主日志文件,避免 stdout/stderr 管道缓冲区满导致进程阻塞 | deliberate | backend-comment | Simulation |
| 1800 | backend/app/services/simulation_runner.py | 430 | # 设置子进程环境变量,确保 Windows 上使用 UTF-8 编码 | deliberate | backend-comment | Simulation |
| 1801 | backend/app/services/simulation_runner.py | 431 | # 这可以修复第三方库(如 OASIS)读取文件时未指定编码的问题 | deliberate | backend-comment | Simulation |
| 1802 | backend/app/services/simulation_runner.py | 433 | env['PYTHONUTF8'] = '1' # Python 3.7+ 支持,让所有 open() 默认使用 UTF-8 | review-needed | backend-string | Simulation |
| 1803 | backend/app/services/simulation_runner.py | 434 | env['PYTHONIOENCODING'] = 'utf-8' # 确保 stdout/stderr 使用 UTF-8 | review-needed | backend-string | Simulation |
| 1804 | backend/app/services/simulation_runner.py | 436 | # 设置工作目录为模拟目录(数据库等文件会生成在此) | deliberate | backend-comment | Simulation |
| 1805 | backend/app/services/simulation_runner.py | 437 | # 使用 start_new_session=True 创建新的进程组,确保可以通过 os.killpg 终止所有子进程 | deliberate | backend-comment | Simulation |
| 1806 | backend/app/services/simulation_runner.py | 442 | stderr=subprocess.STDOUT, # stderr 也写入同一个文件 | deliberate | backend-docstring | Simulation |
| 1807 | backend/app/services/simulation_runner.py | 444 | encoding='utf-8', # 显式指定编码 | review-needed | backend-string | Simulation |
| 1808 | backend/app/services/simulation_runner.py | 446 | env=env, # 传递带有 UTF-8 设置的环境变量 | deliberate | backend-docstring | Simulation |
| 1809 | backend/app/services/simulation_runner.py | 447 | start_new_session=True, # 创建新进程组,确保服务器关闭时能终止所有相关进程 | deliberate | backend-docstring | Simulation |
| 1810 | backend/app/services/simulation_runner.py | 450 | # 保存文件句柄以便后续关闭 | deliberate | backend-comment | Simulation |
| 1811 | backend/app/services/simulation_runner.py | 452 | cls._stderr_files[simulation_id] = None # 不再需要单独的 stderr | deliberate | backend-docstring | Simulation |
| 1812 | backend/app/services/simulation_runner.py | 462 | # 启动监控线程 | deliberate | backend-comment | Simulation |
| 1813 | backend/app/services/simulation_runner.py | 483 | """监控模拟进程,解析动作日志""" | deliberate | backend-docstring | Simulation |
| 1814 | backend/app/services/simulation_runner.py | 487 | # 新的日志结构:分平台的动作日志 | deliberate | backend-comment | Simulation |
| 1815 | backend/app/services/simulation_runner.py | 501 | while process.poll() is None: # 进程仍在运行 | deliberate | backend-docstring | Simulation |
| 1816 | backend/app/services/simulation_runner.py | 502 | # 读取 Twitter 动作日志 | deliberate | backend-comment | Simulation |
| 1817 | backend/app/services/simulation_runner.py | 508 | # 读取 Reddit 动作日志 | deliberate | backend-comment | Simulation |
| 1818 | backend/app/services/simulation_runner.py | 514 | # 更新状态 | deliberate | backend-comment | Simulation |
| 1819 | backend/app/services/simulation_runner.py | 518 | # 进程结束后,最后读取一次日志 | deliberate | backend-comment | Simulation |
| 1820 | backend/app/services/simulation_runner.py | 524 | # 进程结束 | deliberate | backend-comment | Simulation |
| 1821 | backend/app/services/simulation_runner.py | 533 | # 从主日志文件读取错误信息 | deliberate | backend-comment | Simulation |
| 1822 | backend/app/services/simulation_runner.py | 539 | error_info = f.read()[-2000:] # 取最后2000字符 | deliberate | backend-docstring | Simulation |
| 1823 | backend/app/services/simulation_runner.py | 542 | state.error = f"进程退出码: {exit_code}, 错误: {error_info}" | review-needed | backend-string | Simulation |
| 1824 | backend/app/services/simulation_runner.py | 556 | # 停止图谱记忆更新器 | deliberate | backend-comment | Simulation |
| 1825 | backend/app/services/simulation_runner.py | 565 | # 清理进程资源 | deliberate | backend-comment | Simulation |
| 1826 | backend/app/services/simulation_runner.py | 569 | # 关闭日志文件句柄 | deliberate | backend-comment | Simulation |
| 1827 | backend/app/services/simulation_runner.py | 592 | 读取动作日志文件 | deliberate | backend-docstring | Simulation |
| 1828 | backend/app/services/simulation_runner.py | 595 | log_path: 日志文件路径 | deliberate | backend-docstring | Simulation |
| 1829 | backend/app/services/simulation_runner.py | 596 | position: 上次读取位置 | deliberate | backend-docstring | Simulation |
| 1830 | backend/app/services/simulation_runner.py | 597 | state: 运行状态对象 | deliberate | backend-docstring | Simulation |
| 1831 | backend/app/services/simulation_runner.py | 598 | platform: 平台名称 (twitter/reddit) | deliberate | backend-docstring | Simulation |
| 1832 | backend/app/services/simulation_runner.py | 601 | 新的读取位置 | deliberate | backend-docstring | Simulation |
| 1833 | backend/app/services/simulation_runner.py | 603 | # 检查是否启用了图谱记忆更新 | deliberate | backend-comment | Simulation |
| 1834 | backend/app/services/simulation_runner.py | 618 | # 处理事件类型的条目 | deliberate | backend-comment | Simulation |
| 1835 | backend/app/services/simulation_runner.py | 622 | # 检测 simulation_end 事件,标记平台已完成 | deliberate | backend-comment | Simulation |
| 1836 | backend/app/services/simulation_runner.py | 633 | # 检查是否所有启用的平台都已完成 | deliberate | backend-comment | Simulation |
| 1837 | backend/app/services/simulation_runner.py | 634 | # 如果只运行了一个平台,只检查那个平台 | deliberate | backend-comment | Simulation |
| 1838 | backend/app/services/simulation_runner.py | 635 | # 如果运行了两个平台,需要两个都完成 | deliberate | backend-comment | Simulation |
| 1839 | backend/app/services/simulation_runner.py | 642 | # 更新轮次信息(从 round_end 事件) | deliberate | backend-comment | Simulation |
| 1840 | backend/app/services/simulation_runner.py | 647 | # 更新各平台独立的轮次和时间 | deliberate | backend-comment | Simulation |
| 1841 | backend/app/services/simulation_runner.py | 657 | # 总体轮次取两个平台的最大值 | deliberate | backend-comment | Simulation |
| 1842 | backend/app/services/simulation_runner.py | 660 | # 总体时间取两个平台的最大值 | deliberate | backend-comment | Simulation |
| 1843 | backend/app/services/simulation_runner.py | 678 | # 更新轮次 | deliberate | backend-comment | Simulation |
| 1844 | backend/app/services/simulation_runner.py | 682 | # 如果启用了图谱记忆更新,将活动发送到Zep | deliberate | backend-comment | Simulation |
| 1845 | backend/app/services/simulation_runner.py | 696 | 检查所有启用的平台是否都已完成模拟 | deliberate | backend-docstring | Simulation |
| 1846 | backend/app/services/simulation_runner.py | 698 | 通过检查对应的 actions.jsonl 文件是否存在来判断平台是否被启用 | deliberate | backend-docstring | Simulation |
| 1847 | backend/app/services/simulation_runner.py | 701 | True 如果所有启用的平台都已完成 | deliberate | backend-docstring | Simulation |
| 1848 | backend/app/services/simulation_runner.py | 707 | # 检查哪些平台被启用(通过文件是否存在判断) | deliberate | backend-comment | Simulation |
| 1849 | backend/app/services/simulation_runner.py | 711 | # 如果平台被启用但未完成,则返回 False | deliberate | backend-comment | Simulation |
| 1850 | backend/app/services/simulation_runner.py | 717 | # 至少有一个平台被启用且已完成 | deliberate | backend-comment | Simulation |
| 1851 | backend/app/services/simulation_runner.py | 723 | 跨平台终止进程及其子进程 | deliberate | backend-docstring | Simulation |
| 1852 | backend/app/services/simulation_runner.py | 726 | process: 要终止的进程 | deliberate | backend-docstring | Simulation |
| 1853 | backend/app/services/simulation_runner.py | 727 | simulation_id: 模拟ID(用于日志) | deliberate | backend-docstring | Simulation |
| 1854 | backend/app/services/simulation_runner.py | 728 | timeout: 等待进程退出的超时时间(秒) | deliberate | backend-docstring | Simulation |
| 1855 | backend/app/services/simulation_runner.py | 731 | # Windows: 使用 taskkill 命令终止进程树 | deliberate | backend-comment | Simulation |
| 1856 | backend/app/services/simulation_runner.py | 732 | # /F = 强制终止, /T = 终止进程树(包括子进程) | deliberate | backend-comment | Simulation |
| 1857 | backend/app/services/simulation_runner.py | 735 | # 先尝试优雅终止 | deliberate | backend-comment | Simulation |
| 1858 | backend/app/services/simulation_runner.py | 744 | # 强制终止 | deliberate | backend-comment | Simulation |
| 1859 | backend/app/services/simulation_runner.py | 760 | # Unix: 使用进程组终止 | deliberate | backend-comment | Simulation |
| 1860 | backend/app/services/simulation_runner.py | 761 | # 由于使用了 start_new_session=True,进程组 ID 等于主进程 PID | deliberate | backend-comment | Simulation |
| 1861 | backend/app/services/simulation_runner.py | 765 | # 先发送 SIGTERM 给整个进程组 | deliberate | backend-comment | Simulation |
| 1862 | backend/app/services/simulation_runner.py | 771 | # 如果超时后还没结束,强制发送 SIGKILL | deliberate | backend-comment | Simulation |
| 1863 | backend/app/services/simulation_runner.py | 778 | """停止模拟""" | deliberate | backend-docstring | Simulation |
| 1864 | backend/app/services/simulation_runner.py | 781 | raise ValueError(f"模拟不存在: {simulation_id}") | review-needed | backend-string | Simulation |
| 1865 | backend/app/services/simulation_runner.py | 784 | raise ValueError(f"模拟未在运行: {simulation_id}, status={state.runner_status}") | review-needed | backend-string | Simulation |
| 1866 | backend/app/services/simulation_runner.py | 789 | # 终止进程 | deliberate | backend-comment | Simulation |
| 1867 | backend/app/services/simulation_runner.py | 795 | # 进程已经不存在 | deliberate | backend-comment | Simulation |
| 1868 | backend/app/services/simulation_runner.py | 799 | # 回退到直接终止进程 | deliberate | backend-comment | Simulation |
| 1869 | backend/app/services/simulation_runner.py | 812 | # 停止图谱记忆更新器 | deliberate | backend-comment | Simulation |
| 1870 | backend/app/services/simulation_runner.py | 834 | 从单个动作文件中读取动作 | deliberate | backend-docstring | Simulation |
| 1871 | backend/app/services/simulation_runner.py | 837 | file_path: 动作日志文件路径 | deliberate | backend-docstring | Simulation |
| 1872 | backend/app/services/simulation_runner.py | 838 | default_platform: 默认平台(当动作记录中没有 platform 字段时使用) | deliberate | backend-docstring | Simulation |
| 1873 | backend/app/services/simulation_runner.py | 839 | platform_filter: 过滤平台 | deliberate | backend-docstring | Simulation |
| 1874 | backend/app/services/simulation_runner.py | 840 | agent_id: 过滤 Agent ID | deliberate | backend-docstring | Simulation |
| 1875 | backend/app/services/simulation_runner.py | 841 | round_num: 过滤轮次 | deliberate | backend-docstring | Simulation |
| 1876 | backend/app/services/simulation_runner.py | 857 | # 跳过非动作记录(如 simulation_start, round_start, round_end 等事件) | deliberate | backend-comment | Simulation |
| 1877 | backend/app/services/simulation_runner.py | 861 | # 跳过没有 agent_id 的记录(非 Agent 动作) | deliberate | backend-comment | Simulation |
| 1878 | backend/app/services/simulation_runner.py | 865 | # 获取平台:优先使用记录中的 platform,否则使用默认平台 | deliberate | backend-comment | Simulation |
| 1879 | backend/app/services/simulation_runner.py | 868 | # 过滤 | deliberate | backend-comment | Simulation |
| 1880 | backend/app/services/simulation_runner.py | 902 | 获取所有平台的完整动作历史(无分页限制) | deliberate | backend-docstring | Simulation |
| 1881 | backend/app/services/simulation_runner.py | 905 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1882 | backend/app/services/simulation_runner.py | 906 | platform: 过滤平台(twitter/reddit) | deliberate | backend-docstring | Simulation |
| 1883 | backend/app/services/simulation_runner.py | 907 | agent_id: 过滤Agent | deliberate | backend-docstring | Simulation |
| 1884 | backend/app/services/simulation_runner.py | 908 | round_num: 过滤轮次 | deliberate | backend-docstring | Simulation |
| 1885 | backend/app/services/simulation_runner.py | 911 | 完整的动作列表(按时间戳排序,新的在前) | deliberate | backend-docstring | Simulation |
| 1886 | backend/app/services/simulation_runner.py | 916 | # 读取 Twitter 动作文件(根据文件路径自动设置 platform 为 twitter) | deliberate | backend-comment | Simulation |
| 1887 | backend/app/services/simulation_runner.py | 921 | default_platform="twitter", # 自动填充 platform 字段 | review-needed | backend-string | Simulation |
| 1888 | backend/app/services/simulation_runner.py | 927 | # 读取 Reddit 动作文件(根据文件路径自动设置 platform 为 reddit) | deliberate | backend-comment | Simulation |
| 1889 | backend/app/services/simulation_runner.py | 932 | default_platform="reddit", # 自动填充 platform 字段 | review-needed | backend-string | Simulation |
| 1890 | backend/app/services/simulation_runner.py | 938 | # 如果分平台文件不存在,尝试读取旧的单一文件格式 | deliberate | backend-comment | Simulation |
| 1891 | backend/app/services/simulation_runner.py | 943 | default_platform=None, # 旧格式文件中应该有 platform 字段 | deliberate | backend-docstring | Simulation |
| 1892 | backend/app/services/simulation_runner.py | 949 | # 按时间戳排序(新的在前) | deliberate | backend-comment | Simulation |
| 1893 | backend/app/services/simulation_runner.py | 965 | 获取动作历史(带分页) | deliberate | backend-docstring | Simulation |
| 1894 | backend/app/services/simulation_runner.py | 968 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1895 | backend/app/services/simulation_runner.py | 969 | limit: 返回数量限制 | deliberate | backend-docstring | Simulation |
| 1896 | backend/app/services/simulation_runner.py | 970 | offset: 偏移量 | deliberate | backend-docstring | Simulation |
| 1897 | backend/app/services/simulation_runner.py | 971 | platform: 过滤平台 | deliberate | backend-docstring | Simulation |
| 1898 | backend/app/services/simulation_runner.py | 972 | agent_id: 过滤Agent | deliberate | backend-docstring | Simulation |
| 1899 | backend/app/services/simulation_runner.py | 973 | round_num: 过滤轮次 | deliberate | backend-docstring | Simulation |
| 1900 | backend/app/services/simulation_runner.py | 976 | 动作列表 | deliberate | backend-docstring | Simulation |
| 1901 | backend/app/services/simulation_runner.py | 985 | # 分页 | deliberate | backend-comment | Simulation |
| 1902 | backend/app/services/simulation_runner.py | 996 | 获取模拟时间线(按轮次汇总) | deliberate | backend-docstring | Simulation |
| 1903 | backend/app/services/simulation_runner.py | 999 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1904 | backend/app/services/simulation_runner.py | 1000 | start_round: 起始轮次 | deliberate | backend-docstring | Simulation |
| 1905 | backend/app/services/simulation_runner.py | 1001 | end_round: 结束轮次 | deliberate | backend-docstring | Simulation |
| 1906 | backend/app/services/simulation_runner.py | 1004 | 每轮的汇总信息 | deliberate | backend-docstring | Simulation |
| 1907 | backend/app/services/simulation_runner.py | 1008 | # 按轮次分组 | deliberate | backend-comment | Simulation |
| 1908 | backend/app/services/simulation_runner.py | 1041 | # 转换为列表 | deliberate | backend-comment | Simulation |
| 1909 | backend/app/services/simulation_runner.py | 1062 | 获取每个Agent的统计信息 | deliberate | backend-docstring | Simulation |
| 1910 | backend/app/services/simulation_runner.py | 1065 | Agent统计列表 | deliberate | backend-docstring | Simulation |
| 1911 | backend/app/services/simulation_runner.py | 1097 | # 按总动作数排序 | deliberate | backend-comment | Simulation |
| 1912 | backend/app/services/simulation_runner.py | 1105 | 清理模拟的运行日志(用于强制重新开始模拟) | deliberate | backend-docstring | Simulation |
| 1913 | backend/app/services/simulation_runner.py | 1107 | 会删除以下文件: | deliberate | backend-docstring | Simulation |
| 1914 | backend/app/services/simulation_runner.py | 1113 | - twitter_simulation.db(模拟数据库) | deliberate | backend-docstring | Simulation |
| 1915 | backend/app/services/simulation_runner.py | 1114 | - reddit_simulation.db(模拟数据库) | deliberate | backend-docstring | Simulation |
| 1916 | backend/app/services/simulation_runner.py | 1115 | - env_status.json(环境状态) | deliberate | backend-docstring | Simulation |
| 1917 | backend/app/services/simulation_runner.py | 1117 | 注意:不会删除配置文件(simulation_config.json)和 profile 文件 | deliberate | backend-docstring | Simulation |
| 1918 | backend/app/services/simulation_runner.py | 1120 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1919 | backend/app/services/simulation_runner.py | 1123 | 清理结果信息 | deliberate | backend-docstring | Simulation |
| 1920 | backend/app/services/simulation_runner.py | 1130 | return {"success": True, "message": "模拟目录不存在,无需清理"} | review-needed | backend-string | Simulation |
| 1921 | backend/app/services/simulation_runner.py | 1135 | # 要删除的文件列表(包括数据库文件) | deliberate | backend-comment | Simulation |
| 1922 | backend/app/services/simulation_runner.py | 1141 | "twitter_simulation.db", # Twitter 平台数据库 | review-needed | backend-string | Simulation |
| 1923 | backend/app/services/simulation_runner.py | 1142 | "reddit_simulation.db", # Reddit 平台数据库 | review-needed | backend-string | Simulation |
| 1924 | backend/app/services/simulation_runner.py | 1143 | "env_status.json", # 环境状态文件 | review-needed | backend-string | Simulation |
| 1925 | backend/app/services/simulation_runner.py | 1146 | # 要删除的目录列表(包含动作日志) | deliberate | backend-comment | Simulation |
| 1926 | backend/app/services/simulation_runner.py | 1149 | # 删除文件 | deliberate | backend-comment | Simulation |
| 1927 | backend/app/services/simulation_runner.py | 1157 | errors.append(f"删除 {filename} 失败: {str(e)}") | review-needed | backend-string | Simulation |
| 1928 | backend/app/services/simulation_runner.py | 1159 | # 清理平台目录中的动作日志 | deliberate | backend-comment | Simulation |
| 1929 | backend/app/services/simulation_runner.py | 1169 | errors.append(f"删除 {dir_name}/actions.jsonl 失败: {str(e)}") | review-needed | backend-string | Simulation |
| 1930 | backend/app/services/simulation_runner.py | 1171 | # 清理内存中的运行状态 | deliberate | backend-comment | Simulation |
| 1931 | backend/app/services/simulation_runner.py | 1183 | # 防止重复清理的标志 | deliberate | backend-comment | Simulation |
| 1932 | backend/app/services/simulation_runner.py | 1189 | 清理所有运行中的模拟进程 | deliberate | backend-docstring | Simulation |
| 1933 | backend/app/services/simulation_runner.py | 1191 | 在服务器关闭时调用,确保所有子进程被终止 | deliberate | backend-docstring | Simulation |
| 1934 | backend/app/services/simulation_runner.py | 1193 | # 防止重复清理 | deliberate | backend-comment | Simulation |
| 1935 | backend/app/services/simulation_runner.py | 1198 | # 检查是否有内容需要清理(避免空进程的进程打印无用日志) | deliberate | backend-comment | Simulation |
| 1936 | backend/app/services/simulation_runner.py | 1203 | return # 没有需要清理的内容,静默返回 | deliberate | backend-docstring | Simulation |
| 1937 | backend/app/services/simulation_runner.py | 1207 | # 首先停止所有图谱记忆更新器(stop_all 内部会打印日志) | deliberate | backend-comment | Simulation |
| 1938 | backend/app/services/simulation_runner.py | 1214 | # 复制字典以避免在迭代时修改 | deliberate | backend-comment | Simulation |
| 1939 | backend/app/services/simulation_runner.py | 1219 | if process.poll() is None: # 进程仍在运行 | deliberate | backend-docstring | Simulation |
| 1940 | backend/app/services/simulation_runner.py | 1223 | # 使用跨平台的进程终止方法 | deliberate | backend-comment | Simulation |
| 1941 | backend/app/services/simulation_runner.py | 1226 | # 进程可能已经不存在,尝试直接终止 | deliberate | backend-comment | Simulation |
| 1942 | backend/app/services/simulation_runner.py | 1233 | # 更新 run_state.json | deliberate | backend-comment | Simulation |
| 1943 | backend/app/services/simulation_runner.py | 1240 | state.error = "服务器关闭,模拟被终止" | review-needed | backend-string | Simulation |
| 1944 | backend/app/services/simulation_runner.py | 1243 | # 同时更新 state.json,将状态设为 stopped | deliberate | backend-comment | Simulation |
| 1945 | backend/app/services/simulation_runner.py | 1264 | # 清理文件句柄 | deliberate | backend-comment | Simulation |
| 1946 | backend/app/services/simulation_runner.py | 1281 | # 清理内存中的状态 | deliberate | backend-comment | Simulation |
| 1947 | backend/app/services/simulation_runner.py | 1290 | 注册清理函数 | deliberate | backend-docstring | Simulation |
| 1948 | backend/app/services/simulation_runner.py | 1292 | 在 Flask 应用启动时调用,确保服务器关闭时清理所有模拟进程 | deliberate | backend-docstring | Simulation |
| 1949 | backend/app/services/simulation_runner.py | 1299 | # Flask debug 模式下,只在 reloader 子进程中注册清理(实际运行应用的进程) | deliberate | backend-comment | Simulation |
| 1950 | backend/app/services/simulation_runner.py | 1300 | # WERKZEUG_RUN_MAIN=true 表示是 reloader 子进程 | deliberate | backend-comment | Simulation |
| 1951 | backend/app/services/simulation_runner.py | 1301 | # 如果不是 debug 模式,则没有这个环境变量,也需要注册 | deliberate | backend-comment | Simulation |
| 1952 | backend/app/services/simulation_runner.py | 1305 | # 在 debug 模式下,只在 reloader 子进程中注册;非 debug 模式下始终注册 | deliberate | backend-comment | Simulation |
| 1953 | backend/app/services/simulation_runner.py | 1307 | _cleanup_registered = True # 标记已注册,防止子进程再次尝试 | deliberate | backend-docstring | Simulation |
| 1954 | backend/app/services/simulation_runner.py | 1310 | # 保存原有的信号处理器 | deliberate | backend-comment | Simulation |
| 1955 | backend/app/services/simulation_runner.py | 1313 | # SIGHUP 只在 Unix 系统存在(macOS/Linux),Windows 没有 | deliberate | backend-comment | Simulation |
| 1956 | backend/app/services/simulation_runner.py | 1320 | """信号处理器:先清理模拟进程,再调用原处理器""" | deliberate | backend-docstring | Simulation |
| 1957 | backend/app/services/simulation_runner.py | 1321 | # 只有在有进程需要清理时才打印日志 | deliberate | backend-comment | Simulation |
| 1958 | backend/app/services/simulation_runner.py | 1326 | # 调用原有的信号处理器,让 Flask 正常退出 | deliberate | backend-comment | Simulation |
| 1959 | backend/app/services/simulation_runner.py | 1332 | # SIGHUP: 终端关闭时发送 | deliberate | backend-comment | Simulation |
| 1960 | backend/app/services/simulation_runner.py | 1336 | # 默认行为:正常退出 | deliberate | backend-comment | Simulation |
| 1961 | backend/app/services/simulation_runner.py | 1339 | # 如果原处理器不可调用(如 SIG_DFL),则使用默认行为 | deliberate | backend-comment | Simulation |
| 1962 | backend/app/services/simulation_runner.py | 1342 | # 注册 atexit 处理器(作为备用) | deliberate | backend-comment | Simulation |
| 1963 | backend/app/services/simulation_runner.py | 1345 | # 注册信号处理器(仅在主线程中) | deliberate | backend-comment | Simulation |
| 1964 | backend/app/services/simulation_runner.py | 1347 | # SIGTERM: kill 命令默认信号 | deliberate | backend-comment | Simulation |
| 1965 | backend/app/services/simulation_runner.py | 1351 | # SIGHUP: 终端关闭(仅 Unix 系统) | deliberate | backend-comment | Simulation |
| 1966 | backend/app/services/simulation_runner.py | 1355 | # 不在主线程中,只能使用 atexit | deliberate | backend-comment | Simulation |
| 1967 | backend/app/services/simulation_runner.py | 1363 | 获取所有正在运行的模拟ID列表 | deliberate | backend-docstring | Simulation |
| 1968 | backend/app/services/simulation_runner.py | 1371 | # ============== Interview 功能 ============== | deliberate | backend-comment | Simulation |
| 1969 | backend/app/services/simulation_runner.py | 1376 | 检查模拟环境是否存活(可以接收Interview命令) | deliberate | backend-docstring | Simulation |
| 1970 | backend/app/services/simulation_runner.py | 1379 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1971 | backend/app/services/simulation_runner.py | 1382 | True 表示环境存活,False 表示环境已关闭 | deliberate | backend-docstring | Simulation |
| 1972 | backend/app/services/simulation_runner.py | 1394 | 获取模拟环境的详细状态信息 | deliberate | backend-docstring | Simulation |
| 1973 | backend/app/services/simulation_runner.py | 1397 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1974 | backend/app/services/simulation_runner.py | 1400 | 状态详情字典,包含 status, twitter_available, reddit_available, timestamp | deliberate | backend-docstring | Simulation |
| 1975 | backend/app/services/simulation_runner.py | 1437 | 采访单个Agent | deliberate | backend-docstring | Simulation |
| 1976 | backend/app/services/simulation_runner.py | 1440 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1977 | backend/app/services/simulation_runner.py | 1442 | prompt: 采访问题 | deliberate | backend-docstring | Simulation |
| 1978 | backend/app/services/simulation_runner.py | 1443 | platform: 指定平台(可选) | deliberate | backend-docstring | Simulation |
| 1979 | backend/app/services/simulation_runner.py | 1444 | - "twitter": 只采访Twitter平台 | review-needed | backend-string | Simulation |
| 1980 | backend/app/services/simulation_runner.py | 1445 | - "reddit": 只采访Reddit平台 | review-needed | backend-string | Simulation |
| 1981 | backend/app/services/simulation_runner.py | 1446 | - None: 双平台模拟时同时采访两个平台,返回整合结果 | deliberate | backend-docstring | Simulation |
| 1982 | backend/app/services/simulation_runner.py | 1447 | timeout: 超时时间(秒) | deliberate | backend-docstring | Simulation |
| 1983 | backend/app/services/simulation_runner.py | 1450 | 采访结果字典 | deliberate | backend-docstring | Simulation |
| 1984 | backend/app/services/simulation_runner.py | 1453 | ValueError: 模拟不存在或环境未运行 | deliberate | backend-docstring | Simulation |
| 1985 | backend/app/services/simulation_runner.py | 1454 | TimeoutError: 等待响应超时 | deliberate | backend-docstring | Simulation |
| 1986 | backend/app/services/simulation_runner.py | 1458 | raise ValueError(f"模拟不存在: {simulation_id}") | review-needed | backend-string | Simulation |
| 1987 | backend/app/services/simulation_runner.py | 1463 | raise ValueError(f"模拟环境未运行或已关闭,无法执行Interview: {simulation_id}") | review-needed | backend-string | Simulation |
| 1988 | backend/app/services/simulation_runner.py | 1500 | 批量采访多个Agent | deliberate | backend-docstring | Simulation |
| 1989 | backend/app/services/simulation_runner.py | 1503 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 1990 | backend/app/services/simulation_runner.py | 1504 | interviews: 采访列表,每个元素包含 {"agent_id": int, "prompt": str, "platform": str(可选)} | review-needed | backend-string | Simulation |
| 1991 | backend/app/services/simulation_runner.py | 1505 | platform: 默认平台(可选,会被每个采访项的platform覆盖) | deliberate | backend-docstring | Simulation |
| 1992 | backend/app/services/simulation_runner.py | 1506 | - "twitter": 默认只采访Twitter平台 | review-needed | backend-string | Simulation |
| 1993 | backend/app/services/simulation_runner.py | 1507 | - "reddit": 默认只采访Reddit平台 | review-needed | backend-string | Simulation |
| 1994 | backend/app/services/simulation_runner.py | 1508 | - None: 双平台模拟时每个Agent同时采访两个平台 | deliberate | backend-docstring | Simulation |
| 1995 | backend/app/services/simulation_runner.py | 1509 | timeout: 超时时间(秒) | deliberate | backend-docstring | Simulation |
| 1996 | backend/app/services/simulation_runner.py | 1512 | 批量采访结果字典 | deliberate | backend-docstring | Simulation |
| 1997 | backend/app/services/simulation_runner.py | 1515 | ValueError: 模拟不存在或环境未运行 | deliberate | backend-docstring | Simulation |
| 1998 | backend/app/services/simulation_runner.py | 1516 | TimeoutError: 等待响应超时 | deliberate | backend-docstring | Simulation |
| 1999 | backend/app/services/simulation_runner.py | 1520 | raise ValueError(f"模拟不存在: {simulation_id}") | review-needed | backend-string | Simulation |
| 2000 | backend/app/services/simulation_runner.py | 1525 | raise ValueError(f"模拟环境未运行或已关闭,无法执行Interview: {simulation_id}") | review-needed | backend-string | Simulation |
| 2001 | backend/app/services/simulation_runner.py | 1559 | 采访所有Agent(全局采访) | deliberate | backend-docstring | Simulation |
| 2002 | backend/app/services/simulation_runner.py | 1561 | 使用相同的问题采访模拟中的所有Agent | deliberate | backend-docstring | Simulation |
| 2003 | backend/app/services/simulation_runner.py | 1564 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 2004 | backend/app/services/simulation_runner.py | 1565 | prompt: 采访问题(所有Agent使用相同问题) | deliberate | backend-docstring | Simulation |
| 2005 | backend/app/services/simulation_runner.py | 1566 | platform: 指定平台(可选) | deliberate | backend-docstring | Simulation |
| 2006 | backend/app/services/simulation_runner.py | 1567 | - "twitter": 只采访Twitter平台 | review-needed | backend-string | Simulation |
| 2007 | backend/app/services/simulation_runner.py | 1568 | - "reddit": 只采访Reddit平台 | review-needed | backend-string | Simulation |
| 2008 | backend/app/services/simulation_runner.py | 1569 | - None: 双平台模拟时每个Agent同时采访两个平台 | deliberate | backend-docstring | Simulation |
| 2009 | backend/app/services/simulation_runner.py | 1570 | timeout: 超时时间(秒) | deliberate | backend-docstring | Simulation |
| 2010 | backend/app/services/simulation_runner.py | 1573 | 全局采访结果字典 | deliberate | backend-docstring | Simulation |
| 2011 | backend/app/services/simulation_runner.py | 1577 | raise ValueError(f"模拟不存在: {simulation_id}") | review-needed | backend-string | Simulation |
| 2012 | backend/app/services/simulation_runner.py | 1579 | # 从配置文件获取所有Agent信息 | deliberate | backend-comment | Simulation |
| 2013 | backend/app/services/simulation_runner.py | 1582 | raise ValueError(f"模拟配置不存在: {simulation_id}") | review-needed | backend-string | Simulation |
| 2014 | backend/app/services/simulation_runner.py | 1589 | raise ValueError(f"模拟配置中没有Agent: {simulation_id}") | review-needed | backend-string | Simulation |
| 2015 | backend/app/services/simulation_runner.py | 1591 | # 构建批量采访列表 | deliberate | backend-comment | Simulation |
| 2016 | backend/app/services/simulation_runner.py | 1617 | 关闭模拟环境(而不是停止模拟进程) | deliberate | backend-docstring | Simulation |
| 2017 | backend/app/services/simulation_runner.py | 1619 | 向模拟发送关闭环境命令,使其优雅退出等待命令模式 | deliberate | backend-docstring | Simulation |
| 2018 | backend/app/services/simulation_runner.py | 1622 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 2019 | backend/app/services/simulation_runner.py | 1623 | timeout: 超时时间(秒) | deliberate | backend-docstring | Simulation |
| 2020 | backend/app/services/simulation_runner.py | 1626 | 操作结果字典 | deliberate | backend-docstring | Simulation |
| 2021 | backend/app/services/simulation_runner.py | 1630 | raise ValueError(f"模拟不存在: {simulation_id}") | review-needed | backend-string | Simulation |
| 2022 | backend/app/services/simulation_runner.py | 1637 | "message": "环境已经关闭" | review-needed | backend-string | Simulation |
| 2023 | backend/app/services/simulation_runner.py | 1647 | "message": "环境关闭命令已发送", | review-needed | backend-string | Simulation |
| 2024 | backend/app/services/simulation_runner.py | 1652 | # 超时可能是因为环境正在关闭 | deliberate | backend-comment | Simulation |
| 2025 | backend/app/services/simulation_runner.py | 1655 | "message": "环境关闭命令已发送(等待响应超时,环境可能正在关闭)" | review-needed | backend-string | Simulation |
| 2026 | backend/app/services/simulation_runner.py | 1666 | """从单个数据库获取Interview历史""" | deliberate | backend-docstring | Simulation |
| 2027 | backend/app/services/simulation_runner.py | 1725 | 获取Interview历史记录(从数据库读取) | deliberate | backend-docstring | Simulation |
| 2028 | backend/app/services/simulation_runner.py | 1728 | simulation_id: 模拟ID | deliberate | backend-docstring | Simulation |
| 2029 | backend/app/services/simulation_runner.py | 1729 | platform: 平台类型(reddit/twitter/None) | deliberate | backend-docstring | Simulation |
| 2030 | backend/app/services/simulation_runner.py | 1730 | - "reddit": 只获取Reddit平台的历史 | review-needed | backend-string | Simulation |
| 2031 | backend/app/services/simulation_runner.py | 1731 | - "twitter": 只获取Twitter平台的历史 | review-needed | backend-string | Simulation |
| 2032 | backend/app/services/simulation_runner.py | 1732 | - None: 获取两个平台的所有历史 | deliberate | backend-docstring | Simulation |
| 2033 | backend/app/services/simulation_runner.py | 1733 | agent_id: 指定Agent ID(可选,只获取该Agent的历史) | deliberate | backend-docstring | Simulation |
| 2034 | backend/app/services/simulation_runner.py | 1734 | limit: 每个平台返回数量限制 | deliberate | backend-docstring | Simulation |
| 2035 | backend/app/services/simulation_runner.py | 1737 | Interview历史记录列表 | deliberate | backend-docstring | Simulation |
| 2036 | backend/app/services/simulation_runner.py | 1743 | # 确定要查询的平台 | deliberate | backend-comment | Simulation |
| 2037 | backend/app/services/simulation_runner.py | 1747 | # 不指定platform时,查询两个平台 | deliberate | backend-comment | Simulation |
| 2038 | backend/app/services/simulation_runner.py | 1760 | # 按时间降序排序 | deliberate | backend-comment | Simulation |
| 2039 | backend/app/services/simulation_runner.py | 1763 | # 如果查询了多个平台,限制总数 | deliberate | backend-comment | Simulation |
| 2040 | backend/app/services/text_processor.py | 2 | 文本处理服务 | deliberate | backend-docstring | n/a |
| 2041 | backend/app/services/text_processor.py | 10 | """文本处理器""" | deliberate | backend-docstring | n/a |
| 2042 | backend/app/services/text_processor.py | 14 | """从多个文件提取文本""" | deliberate | backend-docstring | n/a |
| 2043 | backend/app/services/text_processor.py | 24 | 分割文本 | deliberate | backend-docstring | n/a |
| 2044 | backend/app/services/text_processor.py | 27 | text: 原始文本 | deliberate | backend-docstring | n/a |
| 2045 | backend/app/services/text_processor.py | 28 | chunk_size: 块大小 | deliberate | backend-docstring | n/a |
| 2046 | backend/app/services/text_processor.py | 29 | overlap: 重叠大小 | deliberate | backend-docstring | n/a |
| 2047 | backend/app/services/text_processor.py | 32 | 文本块列表 | deliberate | backend-docstring | n/a |
| 2048 | backend/app/services/text_processor.py | 39 | 预处理文本 | deliberate | backend-docstring | n/a |
| 2049 | backend/app/services/text_processor.py | 40 | - 移除多余空白 | deliberate | backend-docstring | n/a |
| 2050 | backend/app/services/text_processor.py | 41 | - 标准化换行 | deliberate | backend-docstring | n/a |
| 2051 | backend/app/services/text_processor.py | 44 | text: 原始文本 | deliberate | backend-docstring | n/a |
| 2052 | backend/app/services/text_processor.py | 47 | 处理后的文本 | deliberate | backend-docstring | n/a |
| 2053 | backend/app/services/text_processor.py | 51 | # 标准化换行 | deliberate | backend-comment | n/a |
| 2054 | backend/app/services/text_processor.py | 54 | # 移除连续空行(保留最多两个换行) | deliberate | backend-comment | n/a |
| 2055 | backend/app/services/text_processor.py | 57 | # 移除行首行尾空白 | deliberate | backend-comment | n/a |
| 2056 | backend/app/services/text_processor.py | 65 | """获取文本统计信息""" | deliberate | backend-docstring | n/a |
| 2057 | backend/app/services/zep_entity_reader.py | 2 | Zep实体读取与过滤服务 | deliberate | backend-docstring | n/a |
| 2058 | backend/app/services/zep_entity_reader.py | 3 | 从Zep图谱中读取节点,筛选出符合预定义实体类型的节点 | deliberate | backend-docstring | n/a |
| 2059 | backend/app/services/zep_entity_reader.py | 19 | # 用于泛型返回类型 | deliberate | backend-comment | n/a |
| 2060 | backend/app/services/zep_entity_reader.py | 25 | """实体节点数据结构""" | deliberate | backend-docstring | n/a |
| 2061 | backend/app/services/zep_entity_reader.py | 31 | # 相关的边信息 | deliberate | backend-comment | n/a |
| 2062 | backend/app/services/zep_entity_reader.py | 33 | # 相关的其他节点信息 | deliberate | backend-comment | n/a |
| 2063 | backend/app/services/zep_entity_reader.py | 48 | """获取实体类型(排除默认的Entity标签)""" | deliberate | backend-docstring | n/a |
| 2064 | backend/app/services/zep_entity_reader.py | 57 | """过滤后的实体集合""" | deliberate | backend-docstring | n/a |
| 2065 | backend/app/services/zep_entity_reader.py | 74 | Zep实体读取与过滤服务 | deliberate | backend-docstring | n/a |
| 2066 | backend/app/services/zep_entity_reader.py | 76 | 主要功能: | deliberate | backend-docstring | n/a |
| 2067 | backend/app/services/zep_entity_reader.py | 77 | 1. 从Zep图谱读取所有节点 | deliberate | backend-docstring | n/a |
| 2068 | backend/app/services/zep_entity_reader.py | 78 | 2. 筛选出符合预定义实体类型的节点(Labels不只是Entity的节点) | deliberate | backend-docstring | n/a |
| 2069 | backend/app/services/zep_entity_reader.py | 79 | 3. 获取每个实体的相关边和关联节点信息 | deliberate | backend-docstring | n/a |
| 2070 | backend/app/services/zep_entity_reader.py | 93 | 带重试机制的Zep API调用 | deliberate | backend-docstring | n/a |
| 2071 | backend/app/services/zep_entity_reader.py | 96 | func: 要执行的函数(无参数的lambda或callable) | deliberate | backend-docstring | n/a |
| 2072 | backend/app/services/zep_entity_reader.py | 97 | operation_name: 操作名称,用于日志 | deliberate | backend-docstring | n/a |
| 2073 | backend/app/services/zep_entity_reader.py | 98 | max_retries: 最大重试次数(默认3次,即最多尝试3次) | deliberate | backend-docstring | n/a |
| 2074 | backend/app/services/zep_entity_reader.py | 99 | initial_delay: 初始延迟秒数 | deliberate | backend-docstring | n/a |
| 2075 | backend/app/services/zep_entity_reader.py | 102 | API调用结果 | deliberate | backend-docstring | n/a |
| 2076 | backend/app/services/zep_entity_reader.py | 117 | delay *= 2 # 指数退避 | deliberate | backend-docstring | n/a |
| 2077 | backend/app/services/zep_entity_reader.py | 125 | 获取图谱的所有节点(分页获取) | deliberate | backend-docstring | n/a |
| 2078 | backend/app/services/zep_entity_reader.py | 128 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2079 | backend/app/services/zep_entity_reader.py | 131 | 节点列表 | deliberate | backend-docstring | n/a |
| 2080 | backend/app/services/zep_entity_reader.py | 152 | 获取图谱的所有边(分页获取) | deliberate | backend-docstring | n/a |
| 2081 | backend/app/services/zep_entity_reader.py | 155 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2082 | backend/app/services/zep_entity_reader.py | 158 | 边列表 | deliberate | backend-docstring | n/a |
| 2083 | backend/app/services/zep_entity_reader.py | 180 | 获取指定节点的所有相关边(带重试机制) | deliberate | backend-docstring | n/a |
| 2084 | backend/app/services/zep_entity_reader.py | 183 | node_uuid: 节点UUID | deliberate | backend-docstring | n/a |
| 2085 | backend/app/services/zep_entity_reader.py | 186 | 边列表 | deliberate | backend-docstring | n/a |
| 2086 | backend/app/services/zep_entity_reader.py | 189 | # 使用重试机制调用Zep API | deliberate | backend-comment | n/a |
| 2087 | backend/app/services/zep_entity_reader.py | 192 | operation_name=f"获取节点边(node={node_uuid[:8]}...)" | review-needed | backend-string | n/a |
| 2088 | backend/app/services/zep_entity_reader.py | 218 | 筛选出符合预定义实体类型的节点 | deliberate | backend-docstring | n/a |
| 2089 | backend/app/services/zep_entity_reader.py | 220 | 筛选逻辑: | deliberate | backend-docstring | n/a |
| 2090 | backend/app/services/zep_entity_reader.py | 221 | - 如果节点的Labels只有一个"Entity",说明这个实体不符合我们预定义的类型,跳过 | review-needed | backend-string | n/a |
| 2091 | backend/app/services/zep_entity_reader.py | 222 | - 如果节点的Labels包含除"Entity"和"Node"之外的标签,说明符合预定义类型,保留 | review-needed | backend-string | n/a |
| 2092 | backend/app/services/zep_entity_reader.py | 225 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2093 | backend/app/services/zep_entity_reader.py | 226 | defined_entity_types: 预定义的实体类型列表(可选,如果提供则只保留这些类型) | deliberate | backend-docstring | n/a |
| 2094 | backend/app/services/zep_entity_reader.py | 227 | enrich_with_edges: 是否获取每个实体的相关边信息 | deliberate | backend-docstring | n/a |
| 2095 | backend/app/services/zep_entity_reader.py | 230 | FilteredEntities: 过滤后的实体集合 | deliberate | backend-docstring | n/a |
| 2096 | backend/app/services/zep_entity_reader.py | 246 | # 获取所有节点 | deliberate | backend-comment | n/a |
| 2097 | backend/app/services/zep_entity_reader.py | 262 | # 获取所有边(用于后续关联查找) | deliberate | backend-comment | n/a |
| 2098 | backend/app/services/zep_entity_reader.py | 265 | # 构建节点UUID到节点数据的映射 | deliberate | backend-comment | n/a |
| 2099 | backend/app/services/zep_entity_reader.py | 268 | # 筛选符合条件的实体 | deliberate | backend-comment | n/a |
| 2100 | backend/app/services/zep_entity_reader.py | 275 | # 筛选逻辑:Labels必须包含除"Entity"和"Node"之外的标签 | deliberate | backend-comment | n/a |
| 2101 | backend/app/services/zep_entity_reader.py | 279 | # 只有默认标签,跳过 | deliberate | backend-comment | n/a |
| 2102 | backend/app/services/zep_entity_reader.py | 282 | # 如果指定了预定义类型,检查是否匹配 | deliberate | backend-comment | n/a |
| 2103 | backend/app/services/zep_entity_reader.py | 293 | # 创建实体节点对象 | deliberate | backend-comment | n/a |
| 2104 | backend/app/services/zep_entity_reader.py | 302 | # 获取相关边和节点 | deliberate | backend-comment | n/a |
| 2105 | backend/app/services/zep_entity_reader.py | 327 | # 获取关联节点的基本信息 | deliberate | backend-comment | n/a |
| 2106 | backend/app/services/zep_entity_reader.py | 358 | 获取单个实体及其完整上下文(边和关联节点,带重试机制) | deliberate | backend-docstring | n/a |
| 2107 | backend/app/services/zep_entity_reader.py | 361 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2108 | backend/app/services/zep_entity_reader.py | 362 | entity_uuid: 实体UUID | deliberate | backend-docstring | n/a |
| 2109 | backend/app/services/zep_entity_reader.py | 365 | EntityNode或None | deliberate | backend-docstring | n/a |
| 2110 | backend/app/services/zep_entity_reader.py | 368 | # 使用重试机制获取节点 | deliberate | backend-comment | n/a |
| 2111 | backend/app/services/zep_entity_reader.py | 371 | operation_name=f"获取节点详情(uuid={entity_uuid[:8]}...)" | review-needed | backend-string | n/a |
| 2112 | backend/app/services/zep_entity_reader.py | 377 | # 获取节点的边 | deliberate | backend-comment | n/a |
| 2113 | backend/app/services/zep_entity_reader.py | 380 | # 获取所有节点用于关联查找 | deliberate | backend-comment | n/a |
| 2114 | backend/app/services/zep_entity_reader.py | 384 | # 处理相关边和节点 | deliberate | backend-comment | n/a |
| 2115 | backend/app/services/zep_entity_reader.py | 406 | # 获取关联节点信息 | deliberate | backend-comment | n/a |
| 2116 | backend/app/services/zep_entity_reader.py | 439 | 获取指定类型的所有实体 | deliberate | backend-docstring | n/a |
| 2117 | backend/app/services/zep_entity_reader.py | 442 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2118 | backend/app/services/zep_entity_reader.py | 443 | entity_type: 实体类型(如 "Student", "PublicFigure" 等) | review-needed | backend-string | n/a |
| 2119 | backend/app/services/zep_entity_reader.py | 444 | enrich_with_edges: 是否获取相关边信息 | deliberate | backend-docstring | n/a |
| 2120 | backend/app/services/zep_entity_reader.py | 447 | 实体列表 | deliberate | backend-docstring | n/a |
| 2121 | backend/app/services/zep_graph_memory_updater.py | 2 | Zep图谱记忆更新服务 | deliberate | backend-docstring | n/a |
| 2122 | backend/app/services/zep_graph_memory_updater.py | 3 | 将模拟中的Agent活动动态更新到Zep图谱中 | deliberate | backend-docstring | n/a |
| 2123 | backend/app/services/zep_graph_memory_updater.py | 26 | """Agent活动记录""" | deliberate | backend-docstring | n/a |
| 2124 | backend/app/services/zep_graph_memory_updater.py | 37 | 将活动转换为可以发送给Zep的文本描述 | deliberate | backend-docstring | n/a |
| 2125 | backend/app/services/zep_graph_memory_updater.py | 39 | 采用自然语言描述格式,让Zep能够从中提取实体和关系 | deliberate | backend-docstring | n/a |
| 2126 | backend/app/services/zep_graph_memory_updater.py | 40 | 不添加模拟相关的前缀,避免误导图谱更新 | deliberate | backend-docstring | n/a |
| 2127 | backend/app/services/zep_graph_memory_updater.py | 42 | # 根据不同的动作类型生成不同的描述 | deliberate | backend-comment | n/a |
| 2128 | backend/app/services/zep_graph_memory_updater.py | 61 | # 直接返回 "agent名称: 活动描述" 格式,不添加模拟前缀 | deliberate | backend-comment | n/a |
| 2129 | backend/app/services/zep_graph_memory_updater.py | 67 | return f"发布了一条帖子:「{content}」" | gap | backend-prompt-label | n/a |
| 2130 | backend/app/services/zep_graph_memory_updater.py | 68 | return "发布了一条帖子" | gap | backend-prompt-label | n/a |
| 2131 | backend/app/services/zep_graph_memory_updater.py | 71 | """点赞帖子 - 包含帖子原文和作者信息""" | deliberate | backend-docstring | n/a |
| 2132 | backend/app/services/zep_graph_memory_updater.py | 76 | return f"点赞了{post_author}的帖子:「{post_content}」" | gap | backend-prompt-label | n/a |
| 2133 | backend/app/services/zep_graph_memory_updater.py | 78 | return f"点赞了一条帖子:「{post_content}」" | gap | backend-prompt-label | n/a |
| 2134 | backend/app/services/zep_graph_memory_updater.py | 80 | return f"点赞了{post_author}的一条帖子" | gap | backend-prompt-label | n/a |
| 2135 | backend/app/services/zep_graph_memory_updater.py | 81 | return "点赞了一条帖子" | gap | backend-prompt-label | n/a |
| 2136 | backend/app/services/zep_graph_memory_updater.py | 84 | """踩帖子 - 包含帖子原文和作者信息""" | deliberate | backend-docstring | n/a |
| 2137 | backend/app/services/zep_graph_memory_updater.py | 89 | return f"踩了{post_author}的帖子:「{post_content}」" | gap | backend-prompt-label | n/a |
| 2138 | backend/app/services/zep_graph_memory_updater.py | 91 | return f"踩了一条帖子:「{post_content}」" | gap | backend-prompt-label | n/a |
| 2139 | backend/app/services/zep_graph_memory_updater.py | 93 | return f"踩了{post_author}的一条帖子" | gap | backend-prompt-label | n/a |
| 2140 | backend/app/services/zep_graph_memory_updater.py | 94 | return "踩了一条帖子" | gap | backend-prompt-label | n/a |
| 2141 | backend/app/services/zep_graph_memory_updater.py | 97 | """转发帖子 - 包含原帖内容和作者信息""" | deliberate | backend-docstring | n/a |
| 2142 | backend/app/services/zep_graph_memory_updater.py | 102 | return f"转发了{original_author}的帖子:「{original_content}」" | gap | backend-prompt-label | n/a |
| 2143 | backend/app/services/zep_graph_memory_updater.py | 104 | return f"转发了一条帖子:「{original_content}」" | gap | backend-prompt-label | n/a |
| 2144 | backend/app/services/zep_graph_memory_updater.py | 106 | return f"转发了{original_author}的一条帖子" | gap | backend-prompt-label | n/a |
| 2145 | backend/app/services/zep_graph_memory_updater.py | 107 | return "转发了一条帖子" | gap | backend-prompt-label | n/a |
| 2146 | backend/app/services/zep_graph_memory_updater.py | 110 | """引用帖子 - 包含原帖内容、作者信息和引用评论""" | deliberate | backend-docstring | n/a |
| 2147 | backend/app/services/zep_graph_memory_updater.py | 117 | base = f"引用了{original_author}的帖子「{original_content}」" | gap | backend-prompt-label | n/a |
| 2148 | backend/app/services/zep_graph_memory_updater.py | 119 | base = f"引用了一条帖子「{original_content}」" | gap | backend-prompt-label | n/a |
| 2149 | backend/app/services/zep_graph_memory_updater.py | 121 | base = f"引用了{original_author}的一条帖子" | gap | backend-prompt-label | n/a |
| 2150 | backend/app/services/zep_graph_memory_updater.py | 123 | base = "引用了一条帖子" | gap | backend-prompt-label | n/a |
| 2151 | backend/app/services/zep_graph_memory_updater.py | 126 | base += f",并评论道:「{quote_content}」" | gap | backend-prompt-label | n/a |
| 2152 | backend/app/services/zep_graph_memory_updater.py | 130 | """关注用户 - 包含被关注用户的名称""" | deliberate | backend-docstring | n/a |
| 2153 | backend/app/services/zep_graph_memory_updater.py | 134 | return f"关注了用户「{target_user_name}」" | gap | backend-prompt-label | n/a |
| 2154 | backend/app/services/zep_graph_memory_updater.py | 135 | return "关注了一个用户" | gap | backend-prompt-label | n/a |
| 2155 | backend/app/services/zep_graph_memory_updater.py | 138 | """发表评论 - 包含评论内容和所评论的帖子信息""" | deliberate | backend-docstring | n/a |
| 2156 | backend/app/services/zep_graph_memory_updater.py | 145 | return f"在{post_author}的帖子「{post_content}」下评论道:「{content}」" | gap | backend-prompt-label | n/a |
| 2157 | backend/app/services/zep_graph_memory_updater.py | 147 | return f"在帖子「{post_content}」下评论道:「{content}」" | gap | backend-prompt-label | n/a |
| 2158 | backend/app/services/zep_graph_memory_updater.py | 149 | return f"在{post_author}的帖子下评论道:「{content}」" | gap | backend-prompt-label | n/a |
| 2159 | backend/app/services/zep_graph_memory_updater.py | 150 | return f"评论道:「{content}」" | gap | backend-prompt-label | n/a |
| 2160 | backend/app/services/zep_graph_memory_updater.py | 151 | return "发表了评论" | gap | backend-prompt-label | n/a |
| 2161 | backend/app/services/zep_graph_memory_updater.py | 154 | """点赞评论 - 包含评论内容和作者信息""" | deliberate | backend-docstring | n/a |
| 2162 | backend/app/services/zep_graph_memory_updater.py | 159 | return f"点赞了{comment_author}的评论:「{comment_content}」" | gap | backend-prompt-label | n/a |
| 2163 | backend/app/services/zep_graph_memory_updater.py | 161 | return f"点赞了一条评论:「{comment_content}」" | gap | backend-prompt-label | n/a |
| 2164 | backend/app/services/zep_graph_memory_updater.py | 163 | return f"点赞了{comment_author}的一条评论" | gap | backend-prompt-label | n/a |
| 2165 | backend/app/services/zep_graph_memory_updater.py | 164 | return "点赞了一条评论" | gap | backend-prompt-label | n/a |
| 2166 | backend/app/services/zep_graph_memory_updater.py | 167 | """踩评论 - 包含评论内容和作者信息""" | deliberate | backend-docstring | n/a |
| 2167 | backend/app/services/zep_graph_memory_updater.py | 172 | return f"踩了{comment_author}的评论:「{comment_content}」" | gap | backend-prompt-label | n/a |
| 2168 | backend/app/services/zep_graph_memory_updater.py | 174 | return f"踩了一条评论:「{comment_content}」" | gap | backend-prompt-label | n/a |
| 2169 | backend/app/services/zep_graph_memory_updater.py | 176 | return f"踩了{comment_author}的一条评论" | gap | backend-prompt-label | n/a |
| 2170 | backend/app/services/zep_graph_memory_updater.py | 177 | return "踩了一条评论" | gap | backend-prompt-label | n/a |
| 2171 | backend/app/services/zep_graph_memory_updater.py | 180 | """搜索帖子 - 包含搜索关键词""" | deliberate | backend-docstring | n/a |
| 2172 | backend/app/services/zep_graph_memory_updater.py | 182 | return f"搜索了「{query}」" if query else "进行了搜索" | gap | backend-prompt-label | n/a |
| 2173 | backend/app/services/zep_graph_memory_updater.py | 185 | """搜索用户 - 包含搜索关键词""" | deliberate | backend-docstring | n/a |
| 2174 | backend/app/services/zep_graph_memory_updater.py | 187 | return f"搜索了用户「{query}」" if query else "搜索了用户" | gap | backend-prompt-label | n/a |
| 2175 | backend/app/services/zep_graph_memory_updater.py | 190 | """屏蔽用户 - 包含被屏蔽用户的名称""" | deliberate | backend-docstring | n/a |
| 2176 | backend/app/services/zep_graph_memory_updater.py | 194 | return f"屏蔽了用户「{target_user_name}」" | gap | backend-prompt-label | n/a |
| 2177 | backend/app/services/zep_graph_memory_updater.py | 195 | return "屏蔽了一个用户" | gap | backend-prompt-label | n/a |
| 2178 | backend/app/services/zep_graph_memory_updater.py | 198 | # 对于未知的动作类型,生成通用描述 | deliberate | backend-comment | n/a |
| 2179 | backend/app/services/zep_graph_memory_updater.py | 199 | return f"执行了{self.action_type}操作" | gap | backend-prompt-label | n/a |
| 2180 | backend/app/services/zep_graph_memory_updater.py | 204 | Zep图谱记忆更新器 | deliberate | backend-docstring | n/a |
| 2181 | backend/app/services/zep_graph_memory_updater.py | 206 | 监控模拟的actions日志文件,将新的agent活动实时更新到Zep图谱中。 | deliberate | backend-docstring | n/a |
| 2182 | backend/app/services/zep_graph_memory_updater.py | 207 | 按平台分组,每累积BATCH_SIZE条活动后批量发送到Zep。 | deliberate | backend-docstring | n/a |
| 2183 | backend/app/services/zep_graph_memory_updater.py | 209 | 所有有意义的行为都会被更新到Zep,action_args中会包含完整的上下文信息: | deliberate | backend-docstring | n/a |
| 2184 | backend/app/services/zep_graph_memory_updater.py | 210 | - 点赞/踩的帖子原文 | deliberate | backend-docstring | n/a |
| 2185 | backend/app/services/zep_graph_memory_updater.py | 211 | - 转发/引用的帖子原文 | deliberate | backend-docstring | n/a |
| 2186 | backend/app/services/zep_graph_memory_updater.py | 212 | - 关注/屏蔽的用户名 | deliberate | backend-docstring | n/a |
| 2187 | backend/app/services/zep_graph_memory_updater.py | 213 | - 点赞/踩的评论原文 | deliberate | backend-docstring | n/a |
| 2188 | backend/app/services/zep_graph_memory_updater.py | 216 | # 批量发送大小(每个平台累积多少条后发送) | deliberate | backend-comment | n/a |
| 2189 | backend/app/services/zep_graph_memory_updater.py | 219 | # 平台名称映射(用于控制台显示) | deliberate | backend-comment | n/a |
| 2190 | backend/app/services/zep_graph_memory_updater.py | 221 | 'twitter': '世界1', | gap | backend-prompt-label | n/a |
| 2191 | backend/app/services/zep_graph_memory_updater.py | 222 | 'reddit': '世界2', | gap | backend-prompt-label | n/a |
| 2192 | backend/app/services/zep_graph_memory_updater.py | 225 | # 发送间隔(秒),避免请求过快 | deliberate | backend-comment | n/a |
| 2193 | backend/app/services/zep_graph_memory_updater.py | 228 | # 重试配置 | deliberate | backend-comment | n/a |
| 2194 | backend/app/services/zep_graph_memory_updater.py | 230 | RETRY_DELAY = 2 # 秒 | deliberate | backend-docstring | n/a |
| 2195 | backend/app/services/zep_graph_memory_updater.py | 234 | 初始化更新器 | deliberate | backend-docstring | n/a |
| 2196 | backend/app/services/zep_graph_memory_updater.py | 237 | graph_id: Zep图谱ID | deliberate | backend-docstring | n/a |
| 2197 | backend/app/services/zep_graph_memory_updater.py | 238 | api_key: Zep API Key(可选,默认从配置读取) | deliberate | backend-docstring | n/a |
| 2198 | backend/app/services/zep_graph_memory_updater.py | 243 | # 活动队列 | deliberate | backend-comment | n/a |
| 2199 | backend/app/services/zep_graph_memory_updater.py | 246 | # 按平台分组的活动缓冲区(每个平台各自累积到BATCH_SIZE后批量发送) | deliberate | backend-comment | n/a |
| 2200 | backend/app/services/zep_graph_memory_updater.py | 253 | # 控制标志 | deliberate | backend-comment | n/a |
| 2201 | backend/app/services/zep_graph_memory_updater.py | 257 | # 统计 | deliberate | backend-comment | n/a |
| 2202 | backend/app/services/zep_graph_memory_updater.py | 258 | self._total_activities = 0 # 实际添加到队列的活动数 | deliberate | backend-docstring | n/a |
| 2203 | backend/app/services/zep_graph_memory_updater.py | 259 | self._total_sent = 0 # 成功发送到Zep的批次数 | deliberate | backend-docstring | n/a |
| 2204 | backend/app/services/zep_graph_memory_updater.py | 260 | self._total_items_sent = 0 # 成功发送到Zep的活动条数 | deliberate | backend-docstring | n/a |
| 2205 | backend/app/services/zep_graph_memory_updater.py | 261 | self._failed_count = 0 # 发送失败的批次数 | deliberate | backend-docstring | n/a |
| 2206 | backend/app/services/zep_graph_memory_updater.py | 262 | self._skipped_count = 0 # 被过滤跳过的活动数(DO_NOTHING) | deliberate | backend-docstring | n/a |
| 2207 | backend/app/services/zep_graph_memory_updater.py | 267 | """获取平台的显示名称""" | deliberate | backend-docstring | n/a |
| 2208 | backend/app/services/zep_graph_memory_updater.py | 271 | """启动后台工作线程""" | deliberate | backend-docstring | n/a |
| 2209 | backend/app/services/zep_graph_memory_updater.py | 289 | """停止后台工作线程""" | deliberate | backend-docstring | n/a |
| 2210 | backend/app/services/zep_graph_memory_updater.py | 292 | # 发送剩余的活动 | deliberate | backend-comment | n/a |
| 2211 | backend/app/services/zep_graph_memory_updater.py | 302 | 添加一个agent活动到队列 | deliberate | backend-docstring | n/a |
| 2212 | backend/app/services/zep_graph_memory_updater.py | 304 | 所有有意义的行为都会被添加到队列,包括: | deliberate | backend-docstring | n/a |
| 2213 | backend/app/services/zep_graph_memory_updater.py | 305 | - CREATE_POST(发帖) | deliberate | backend-docstring | n/a |
| 2214 | backend/app/services/zep_graph_memory_updater.py | 306 | - CREATE_COMMENT(评论) | deliberate | backend-docstring | n/a |
| 2215 | backend/app/services/zep_graph_memory_updater.py | 307 | - QUOTE_POST(引用帖子) | deliberate | backend-docstring | n/a |
| 2216 | backend/app/services/zep_graph_memory_updater.py | 308 | - SEARCH_POSTS(搜索帖子) | deliberate | backend-docstring | n/a |
| 2217 | backend/app/services/zep_graph_memory_updater.py | 309 | - SEARCH_USER(搜索用户) | deliberate | backend-docstring | n/a |
| 2218 | backend/app/services/zep_graph_memory_updater.py | 310 | - LIKE_POST/DISLIKE_POST(点赞/踩帖子) | deliberate | backend-docstring | n/a |
| 2219 | backend/app/services/zep_graph_memory_updater.py | 311 | - REPOST(转发) | deliberate | backend-docstring | n/a |
| 2220 | backend/app/services/zep_graph_memory_updater.py | 312 | - FOLLOW(关注) | deliberate | backend-docstring | n/a |
| 2221 | backend/app/services/zep_graph_memory_updater.py | 313 | - MUTE(屏蔽) | deliberate | backend-docstring | n/a |
| 2222 | backend/app/services/zep_graph_memory_updater.py | 314 | - LIKE_COMMENT/DISLIKE_COMMENT(点赞/踩评论) | deliberate | backend-docstring | n/a |
| 2223 | backend/app/services/zep_graph_memory_updater.py | 316 | action_args中会包含完整的上下文信息(如帖子原文、用户名等)。 | deliberate | backend-docstring | n/a |
| 2224 | backend/app/services/zep_graph_memory_updater.py | 319 | activity: Agent活动记录 | deliberate | backend-docstring | n/a |
| 2225 | backend/app/services/zep_graph_memory_updater.py | 321 | # 跳过DO_NOTHING类型的活动 | deliberate | backend-comment | n/a |
| 2226 | backend/app/services/zep_graph_memory_updater.py | 332 | 从字典数据添加活动 | deliberate | backend-docstring | n/a |
| 2227 | backend/app/services/zep_graph_memory_updater.py | 335 | data: 从actions.jsonl解析的字典数据 | deliberate | backend-docstring | n/a |
| 2228 | backend/app/services/zep_graph_memory_updater.py | 336 | platform: 平台名称 (twitter/reddit) | deliberate | backend-docstring | n/a |
| 2229 | backend/app/services/zep_graph_memory_updater.py | 338 | # 跳过事件类型的条目 | deliberate | backend-comment | n/a |
| 2230 | backend/app/services/zep_graph_memory_updater.py | 355 | """后台工作循环 - 按平台批量发送活动到Zep""" | deliberate | backend-docstring | n/a |
| 2231 | backend/app/services/zep_graph_memory_updater.py | 359 | # 尝试从队列获取活动(超时1秒) | deliberate | backend-comment | n/a |
| 2232 | backend/app/services/zep_graph_memory_updater.py | 363 | # 将活动添加到对应平台的缓冲区 | deliberate | backend-comment | n/a |
| 2233 | backend/app/services/zep_graph_memory_updater.py | 370 | # 检查该平台是否达到批量大小 | deliberate | backend-comment | n/a |
| 2234 | backend/app/services/zep_graph_memory_updater.py | 374 | # 释放锁后再发送 | deliberate | backend-comment | n/a |
| 2235 | backend/app/services/zep_graph_memory_updater.py | 376 | # 发送间隔,避免请求过快 | deliberate | backend-comment | n/a |
| 2236 | backend/app/services/zep_graph_memory_updater.py | 388 | 批量发送活动到Zep图谱(合并为一条文本) | deliberate | backend-docstring | n/a |
| 2237 | backend/app/services/zep_graph_memory_updater.py | 391 | activities: Agent活动列表 | deliberate | backend-docstring | n/a |
| 2238 | backend/app/services/zep_graph_memory_updater.py | 392 | platform: 平台名称 | deliberate | backend-docstring | n/a |
| 2239 | backend/app/services/zep_graph_memory_updater.py | 397 | # 将多条活动合并为一条文本,用换行分隔 | deliberate | backend-comment | n/a |
| 2240 | backend/app/services/zep_graph_memory_updater.py | 401 | # 带重试的发送 | deliberate | backend-comment | n/a |
| 2241 | backend/app/services/zep_graph_memory_updater.py | 426 | """发送队列和缓冲区中剩余的活动""" | deliberate | backend-docstring | n/a |
| 2242 | backend/app/services/zep_graph_memory_updater.py | 427 | # 首先处理队列中剩余的活动,添加到缓冲区 | deliberate | backend-comment | n/a |
| 2243 | backend/app/services/zep_graph_memory_updater.py | 439 | # 然后发送各平台缓冲区中剩余的活动(即使不足BATCH_SIZE条) | deliberate | backend-comment | n/a |
| 2244 | backend/app/services/zep_graph_memory_updater.py | 446 | # 清空所有缓冲区 | deliberate | backend-comment | n/a |
| 2245 | backend/app/services/zep_graph_memory_updater.py | 451 | """获取统计信息""" | deliberate | backend-docstring | n/a |
| 2246 | backend/app/services/zep_graph_memory_updater.py | 458 | "total_activities": self._total_activities, # 添加到队列的活动总数 | gap | backend-prompt-label | n/a |
| 2247 | backend/app/services/zep_graph_memory_updater.py | 459 | "batches_sent": self._total_sent, # 成功发送的批次数 | gap | backend-prompt-label | n/a |
| 2248 | backend/app/services/zep_graph_memory_updater.py | 460 | "items_sent": self._total_items_sent, # 成功发送的活动条数 | gap | backend-prompt-label | n/a |
| 2249 | backend/app/services/zep_graph_memory_updater.py | 461 | "failed_count": self._failed_count, # 发送失败的批次数 | gap | backend-prompt-label | n/a |
| 2250 | backend/app/services/zep_graph_memory_updater.py | 462 | "skipped_count": self._skipped_count, # 被过滤跳过的活动数(DO_NOTHING) | gap | backend-prompt-label | n/a |
| 2251 | backend/app/services/zep_graph_memory_updater.py | 464 | "buffer_sizes": buffer_sizes, # 各平台缓冲区大小 | gap | backend-prompt-label | n/a |
| 2252 | backend/app/services/zep_graph_memory_updater.py | 471 | 管理多个模拟的Zep图谱记忆更新器 | deliberate | backend-docstring | n/a |
| 2253 | backend/app/services/zep_graph_memory_updater.py | 473 | 每个模拟可以有自己的更新器实例 | deliberate | backend-docstring | n/a |
| 2254 | backend/app/services/zep_graph_memory_updater.py | 482 | 为模拟创建图谱记忆更新器 | deliberate | backend-docstring | n/a |
| 2255 | backend/app/services/zep_graph_memory_updater.py | 485 | simulation_id: 模拟ID | deliberate | backend-docstring | n/a |
| 2256 | backend/app/services/zep_graph_memory_updater.py | 486 | graph_id: Zep图谱ID | deliberate | backend-docstring | n/a |
| 2257 | backend/app/services/zep_graph_memory_updater.py | 489 | ZepGraphMemoryUpdater实例 | deliberate | backend-docstring | n/a |
| 2258 | backend/app/services/zep_graph_memory_updater.py | 492 | # 如果已存在,先停止旧的 | deliberate | backend-comment | n/a |
| 2259 | backend/app/services/zep_graph_memory_updater.py | 505 | """获取模拟的更新器""" | deliberate | backend-docstring | n/a |
| 2260 | backend/app/services/zep_graph_memory_updater.py | 510 | """停止并移除模拟的更新器""" | deliberate | backend-docstring | n/a |
| 2261 | backend/app/services/zep_graph_memory_updater.py | 517 | # 防止 stop_all 重复调用的标志 | deliberate | backend-comment | n/a |
| 2262 | backend/app/services/zep_graph_memory_updater.py | 522 | """停止所有更新器""" | deliberate | backend-docstring | n/a |
| 2263 | backend/app/services/zep_graph_memory_updater.py | 523 | # 防止重复调用 | deliberate | backend-comment | n/a |
| 2264 | backend/app/services/zep_graph_memory_updater.py | 540 | """获取所有更新器的统计信息""" | deliberate | backend-docstring | n/a |
| 2265 | backend/app/services/zep_tools.py | 2 | Zep检索工具服务 | deliberate | backend-docstring | n/a |
| 2266 | backend/app/services/zep_tools.py | 3 | 封装图谱搜索、节点读取、边查询等工具,供Report Agent使用 | deliberate | backend-docstring | n/a |
| 2267 | backend/app/services/zep_tools.py | 5 | 核心检索工具(优化后): | deliberate | backend-docstring | n/a |
| 2268 | backend/app/services/zep_tools.py | 6 | 1. InsightForge(深度洞察检索)- 最强大的混合检索,自动生成子问题并多维度检索 | deliberate | backend-docstring | n/a |
| 2269 | backend/app/services/zep_tools.py | 7 | 2. PanoramaSearch(广度搜索)- 获取全貌,包括过期内容 | deliberate | backend-docstring | n/a |
| 2270 | backend/app/services/zep_tools.py | 8 | 3. QuickSearch(简单搜索)- 快速检索 | deliberate | backend-docstring | n/a |
| 2271 | backend/app/services/zep_tools.py | 29 | """搜索结果""" | deliberate | backend-docstring | n/a |
| 2272 | backend/app/services/zep_tools.py | 46 | """转换为文本格式,供LLM理解""" | deliberate | backend-docstring | n/a |
| 2273 | backend/app/services/zep_tools.py | 47 | text_parts = [f"搜索查询: {self.query}", f"找到 {self.total_count} 条相关信息"] | review-needed | backend-string | n/a |
| 2274 | backend/app/services/zep_tools.py | 50 | text_parts.append("\n### 相关事实:") | review-needed | backend-string | n/a |
| 2275 | backend/app/services/zep_tools.py | 59 | """节点信息""" | deliberate | backend-docstring | n/a |
| 2276 | backend/app/services/zep_tools.py | 76 | """转换为文本格式""" | deliberate | backend-docstring | n/a |
| 2277 | backend/app/services/zep_tools.py | 77 | entity_type = next((l for l in self.labels if l not in ["Entity", "Node"]), "未知类型") | review-needed | backend-string | n/a |
| 2278 | backend/app/services/zep_tools.py | 78 | return f"实体: {self.name} (类型: {entity_type})\n摘要: {self.summary}" | review-needed | backend-string | n/a |
| 2279 | backend/app/services/zep_tools.py | 83 | """边信息""" | deliberate | backend-docstring | n/a |
| 2280 | backend/app/services/zep_tools.py | 91 | # 时间信息 | deliberate | backend-comment | n/a |
| 2281 | backend/app/services/zep_tools.py | 113 | """转换为文本格式""" | deliberate | backend-docstring | n/a |
| 2282 | backend/app/services/zep_tools.py | 116 | base_text = f"关系: {source} --[{self.name}]--> {target}\n事实: {self.fact}" | review-needed | backend-string | n/a |
| 2283 | backend/app/services/zep_tools.py | 119 | valid_at = self.valid_at or "未知" | review-needed | backend-string | n/a |
| 2284 | backend/app/services/zep_tools.py | 120 | invalid_at = self.invalid_at or "至今" | review-needed | backend-string | n/a |
| 2285 | backend/app/services/zep_tools.py | 121 | base_text += f"\n时效: {valid_at} - {invalid_at}" | review-needed | backend-string | n/a |
| 2286 | backend/app/services/zep_tools.py | 123 | base_text += f" (已过期: {self.expired_at})" | review-needed | backend-string | n/a |
| 2287 | backend/app/services/zep_tools.py | 129 | """是否已过期""" | deliberate | backend-docstring | n/a |
| 2288 | backend/app/services/zep_tools.py | 134 | """是否已失效""" | deliberate | backend-docstring | n/a |
| 2289 | backend/app/services/zep_tools.py | 141 | 深度洞察检索结果 (InsightForge) | deliberate | backend-docstring | n/a |
| 2290 | backend/app/services/zep_tools.py | 142 | 包含多个子问题的检索结果,以及综合分析 | deliberate | backend-docstring | n/a |
| 2291 | backend/app/services/zep_tools.py | 148 | # 各维度检索结果 | deliberate | backend-comment | n/a |
| 2292 | backend/app/services/zep_tools.py | 149 | semantic_facts: List[str] = field(default_factory=list) # 语义搜索结果 | deliberate | backend-docstring | n/a |
| 2293 | backend/app/services/zep_tools.py | 150 | entity_insights: List[Dict[str, Any]] = field(default_factory=list) # 实体洞察 | deliberate | backend-docstring | n/a |
| 2294 | backend/app/services/zep_tools.py | 151 | relationship_chains: List[str] = field(default_factory=list) # 关系链 | deliberate | backend-docstring | n/a |
| 2295 | backend/app/services/zep_tools.py | 153 | # 统计信息 | deliberate | backend-comment | n/a |
| 2296 | backend/app/services/zep_tools.py | 172 | """转换为详细的文本格式,供LLM理解""" | deliberate | backend-docstring | n/a |
| 2297 | backend/app/services/zep_tools.py | 174 | f"## 未来预测深度分析", | review-needed | backend-string | n/a |
| 2298 | backend/app/services/zep_tools.py | 175 | f"分析问题: {self.query}", | review-needed | backend-string | n/a |
| 2299 | backend/app/services/zep_tools.py | 176 | f"预测场景: {self.simulation_requirement}", | review-needed | backend-string | n/a |
| 2300 | backend/app/services/zep_tools.py | 177 | f"\n### 预测数据统计", | review-needed | backend-string | n/a |
| 2301 | backend/app/services/zep_tools.py | 178 | f"- 相关预测事实: {self.total_facts}条", | review-needed | backend-string | n/a |
| 2302 | backend/app/services/zep_tools.py | 179 | f"- 涉及实体: {self.total_entities}个", | review-needed | backend-string | n/a |
| 2303 | backend/app/services/zep_tools.py | 180 | f"- 关系链: {self.total_relationships}条" | review-needed | backend-string | n/a |
| 2304 | backend/app/services/zep_tools.py | 183 | # 子问题 | deliberate | backend-comment | n/a |
| 2305 | backend/app/services/zep_tools.py | 185 | text_parts.append(f"\n### 分析的子问题") | review-needed | backend-string | n/a |
| 2306 | backend/app/services/zep_tools.py | 189 | # 语义搜索结果 | deliberate | backend-comment | n/a |
| 2307 | backend/app/services/zep_tools.py | 191 | text_parts.append(f"\n### 【关键事实】(请在报告中引用这些原文)") | review-needed | backend-string | n/a |
| 2308 | backend/app/services/zep_tools.py | 195 | # 实体洞察 | deliberate | backend-comment | n/a |
| 2309 | backend/app/services/zep_tools.py | 197 | text_parts.append(f"\n### 【核心实体】") | review-needed | backend-string | n/a |
| 2310 | backend/app/services/zep_tools.py | 199 | text_parts.append(f"- **{entity.get('name', '未知')}** ({entity.get('type', '实体')})") | review-needed | backend-string | n/a |
| 2311 | backend/app/services/zep_tools.py | 201 | text_parts.append(f" 摘要: \"{entity.get('summary')}\"") | review-needed | backend-string | n/a |
| 2312 | backend/app/services/zep_tools.py | 203 | text_parts.append(f" 相关事实: {len(entity.get('related_facts', []))}条") | review-needed | backend-string | n/a |
| 2313 | backend/app/services/zep_tools.py | 205 | # 关系链 | deliberate | backend-comment | n/a |
| 2314 | backend/app/services/zep_tools.py | 207 | text_parts.append(f"\n### 【关系链】") | review-needed | backend-string | n/a |
| 2315 | backend/app/services/zep_tools.py | 217 | 广度搜索结果 (Panorama) | deliberate | backend-docstring | n/a |
| 2316 | backend/app/services/zep_tools.py | 218 | 包含所有相关信息,包括过期内容 | deliberate | backend-docstring | n/a |
| 2317 | backend/app/services/zep_tools.py | 222 | # 全部节点 | deliberate | backend-comment | n/a |
| 2318 | backend/app/services/zep_tools.py | 224 | # 全部边(包括过期的) | deliberate | backend-comment | n/a |
| 2319 | backend/app/services/zep_tools.py | 226 | # 当前有效的事实 | deliberate | backend-comment | n/a |
| 2320 | backend/app/services/zep_tools.py | 228 | # 已过期/失效的事实(历史记录) | deliberate | backend-comment | n/a |
| 2321 | backend/app/services/zep_tools.py | 231 | # 统计 | deliberate | backend-comment | n/a |
| 2322 | backend/app/services/zep_tools.py | 251 | """转换为文本格式(完整版本,不截断)""" | deliberate | backend-docstring | n/a |
| 2323 | backend/app/services/zep_tools.py | 253 | f"## 广度搜索结果(未来全景视图)", | review-needed | backend-string | n/a |
| 2324 | backend/app/services/zep_tools.py | 254 | f"查询: {self.query}", | review-needed | backend-string | n/a |
| 2325 | backend/app/services/zep_tools.py | 255 | f"\n### 统计信息", | review-needed | backend-string | n/a |
| 2326 | backend/app/services/zep_tools.py | 256 | f"- 总节点数: {self.total_nodes}", | review-needed | backend-string | n/a |
| 2327 | backend/app/services/zep_tools.py | 257 | f"- 总边数: {self.total_edges}", | review-needed | backend-string | n/a |
| 2328 | backend/app/services/zep_tools.py | 258 | f"- 当前有效事实: {self.active_count}条", | review-needed | backend-string | n/a |
| 2329 | backend/app/services/zep_tools.py | 259 | f"- 历史/过期事实: {self.historical_count}条" | review-needed | backend-string | n/a |
| 2330 | backend/app/services/zep_tools.py | 262 | # 当前有效的事实(完整输出,不截断) | deliberate | backend-comment | n/a |
| 2331 | backend/app/services/zep_tools.py | 264 | text_parts.append(f"\n### 【当前有效事实】(模拟结果原文)") | review-needed | backend-string | n/a |
| 2332 | backend/app/services/zep_tools.py | 268 | # 历史/过期事实(完整输出,不截断) | deliberate | backend-comment | n/a |
| 2333 | backend/app/services/zep_tools.py | 270 | text_parts.append(f"\n### 【历史/过期事实】(演变过程记录)") | review-needed | backend-string | n/a |
| 2334 | backend/app/services/zep_tools.py | 274 | # 关键实体(完整输出,不截断) | deliberate | backend-comment | n/a |
| 2335 | backend/app/services/zep_tools.py | 276 | text_parts.append(f"\n### 【涉及实体】") | review-needed | backend-string | n/a |
| 2336 | backend/app/services/zep_tools.py | 278 | entity_type = next((l for l in node.labels if l not in ["Entity", "Node"]), "实体") | review-needed | backend-string | n/a |
| 2337 | backend/app/services/zep_tools.py | 286 | """单个Agent的采访结果""" | deliberate | backend-docstring | n/a |
| 2338 | backend/app/services/zep_tools.py | 288 | agent_role: str # 角色类型(如:学生、教师、媒体等) | deliberate | backend-docstring | n/a |
| 2339 | backend/app/services/zep_tools.py | 289 | agent_bio: str # 简介 | deliberate | backend-docstring | n/a |
| 2340 | backend/app/services/zep_tools.py | 290 | question: str # 采访问题 | deliberate | backend-docstring | n/a |
| 2341 | backend/app/services/zep_tools.py | 291 | response: str # 采访回答 | deliberate | backend-docstring | n/a |
| 2342 | backend/app/services/zep_tools.py | 292 | key_quotes: List[str] = field(default_factory=list) # 关键引言 | deliberate | backend-docstring | n/a |
| 2343 | backend/app/services/zep_tools.py | 306 | # 显示完整的agent_bio,不截断 | deliberate | backend-comment | n/a |
| 2344 | backend/app/services/zep_tools.py | 307 | text += f"_简介: {self.agent_bio}_\n\n" | review-needed | backend-string | n/a |
| 2345 | backend/app/services/zep_tools.py | 311 | text += "\n**关键引言:**\n" | review-needed | backend-string | n/a |
| 2346 | backend/app/services/zep_tools.py | 313 | # 清理各种引号 | deliberate | backend-comment | n/a |
| 2347 | backend/app/services/zep_tools.py | 317 | # 去掉开头的标点 | deliberate | backend-comment | n/a |
| 2348 | backend/app/services/zep_tools.py | 320 | # 过滤包含问题编号的垃圾内容(问题1-9) | deliberate | backend-comment | n/a |
| 2349 | backend/app/services/zep_tools.py | 328 | # 截断过长内容(按句号截断,而非硬截断) | deliberate | backend-comment | n/a |
| 2350 | backend/app/services/zep_tools.py | 343 | 采访结果 (Interview) | deliberate | backend-docstring | n/a |
| 2351 | backend/app/services/zep_tools.py | 344 | 包含多个模拟Agent的采访回答 | deliberate | backend-docstring | n/a |
| 2352 | backend/app/services/zep_tools.py | 346 | interview_topic: str # 采访主题 | deliberate | backend-docstring | n/a |
| 2353 | backend/app/services/zep_tools.py | 347 | interview_questions: List[str] # 采访问题列表 | deliberate | backend-docstring | n/a |
| 2354 | backend/app/services/zep_tools.py | 349 | # 采访选择的Agent | deliberate | backend-comment | n/a |
| 2355 | backend/app/services/zep_tools.py | 351 | # 各Agent的采访回答 | deliberate | backend-comment | n/a |
| 2356 | backend/app/services/zep_tools.py | 354 | # 选择Agent的理由 | deliberate | backend-comment | n/a |
| 2357 | backend/app/services/zep_tools.py | 356 | # 整合后的采访摘要 | deliberate | backend-comment | n/a |
| 2358 | backend/app/services/zep_tools.py | 359 | # 统计 | deliberate | backend-comment | n/a |
| 2359 | backend/app/services/zep_tools.py | 376 | """转换为详细的文本格式,供LLM理解和报告引用""" | deliberate | backend-docstring | n/a |
| 2360 | backend/app/services/zep_tools.py | 378 | "## 深度采访报告", | review-needed | backend-string | n/a |
| 2361 | backend/app/services/zep_tools.py | 379 | f"**采访主题:** {self.interview_topic}", | review-needed | backend-string | n/a |
| 2362 | backend/app/services/zep_tools.py | 380 | f"**采访人数:** {self.interviewed_count} / {self.total_agents} 位模拟Agent", | review-needed | backend-string | n/a |
| 2363 | backend/app/services/zep_tools.py | 381 | "\n### 采访对象选择理由", | review-needed | backend-string | n/a |
| 2364 | backend/app/services/zep_tools.py | 382 | self.selection_reasoning or "(自动选择)", | review-needed | backend-string | n/a |
| 2365 | backend/app/services/zep_tools.py | 384 | "\n### 采访实录", | review-needed | backend-string | n/a |
| 2366 | backend/app/services/zep_tools.py | 389 | text_parts.append(f"\n#### 采访 #{i}: {interview.agent_name}") | review-needed | backend-string | n/a |
| 2367 | backend/app/services/zep_tools.py | 393 | text_parts.append("(无采访记录)\n\n---") | review-needed | backend-string | n/a |
| 2368 | backend/app/services/zep_tools.py | 395 | text_parts.append("\n### 采访摘要与核心观点") | review-needed | backend-string | n/a |
| 2369 | backend/app/services/zep_tools.py | 396 | text_parts.append(self.summary or "(无摘要)") | review-needed | backend-string | n/a |
| 2370 | backend/app/services/zep_tools.py | 403 | Zep检索工具服务 | deliberate | backend-docstring | n/a |
| 2371 | backend/app/services/zep_tools.py | 405 | 【核心检索工具 - 优化后】 | deliberate | backend-docstring | n/a |
| 2372 | backend/app/services/zep_tools.py | 406 | 1. insight_forge - 深度洞察检索(最强大,自动生成子问题,多维度检索) | deliberate | backend-docstring | n/a |
| 2373 | backend/app/services/zep_tools.py | 407 | 2. panorama_search - 广度搜索(获取全貌,包括过期内容) | deliberate | backend-docstring | n/a |
| 2374 | backend/app/services/zep_tools.py | 408 | 3. quick_search - 简单搜索(快速检索) | deliberate | backend-docstring | n/a |
| 2375 | backend/app/services/zep_tools.py | 409 | 4. interview_agents - 深度采访(采访模拟Agent,获取多视角观点) | deliberate | backend-docstring | n/a |
| 2376 | backend/app/services/zep_tools.py | 411 | 【基础工具】 | deliberate | backend-docstring | n/a |
| 2377 | backend/app/services/zep_tools.py | 412 | - search_graph - 图谱语义搜索 | deliberate | backend-docstring | n/a |
| 2378 | backend/app/services/zep_tools.py | 413 | - get_all_nodes - 获取图谱所有节点 | deliberate | backend-docstring | n/a |
| 2379 | backend/app/services/zep_tools.py | 414 | - get_all_edges - 获取图谱所有边(含时间信息) | deliberate | backend-docstring | n/a |
| 2380 | backend/app/services/zep_tools.py | 415 | - get_node_detail - 获取节点详细信息 | deliberate | backend-docstring | n/a |
| 2381 | backend/app/services/zep_tools.py | 416 | - get_node_edges - 获取节点相关的边 | deliberate | backend-docstring | n/a |
| 2382 | backend/app/services/zep_tools.py | 417 | - get_entities_by_type - 按类型获取实体 | deliberate | backend-docstring | n/a |
| 2383 | backend/app/services/zep_tools.py | 418 | - get_entity_summary - 获取实体的关系摘要 | deliberate | backend-docstring | n/a |
| 2384 | backend/app/services/zep_tools.py | 421 | # 重试配置 | deliberate | backend-comment | n/a |
| 2385 | backend/app/services/zep_tools.py | 427 | # LLM客户端用于InsightForge生成子问题 | deliberate | backend-comment | n/a |
| 2386 | backend/app/services/zep_tools.py | 433 | """延迟初始化LLM客户端""" | deliberate | backend-docstring | n/a |
| 2387 | backend/app/services/zep_tools.py | 439 | """带重试机制的API调用(自动处理429限速)""" | deliberate | backend-docstring | n/a |
| 2388 | backend/app/services/zep_tools.py | 450 | # 检测429限速错误,使用retry-after头部的等待时间 | deliberate | backend-comment | n/a |
| 2389 | backend/app/services/zep_tools.py | 479 | 图谱语义搜索 | deliberate | backend-docstring | n/a |
| 2390 | backend/app/services/zep_tools.py | 481 | 使用混合搜索(语义+BM25)在图谱中搜索相关信息。 | deliberate | backend-docstring | n/a |
| 2391 | backend/app/services/zep_tools.py | 482 | 如果Zep Cloud的search API不可用,则降级为本地关键词匹配。 | deliberate | backend-docstring | n/a |
| 2392 | backend/app/services/zep_tools.py | 485 | graph_id: 图谱ID (Standalone Graph) | deliberate | backend-docstring | n/a |
| 2393 | backend/app/services/zep_tools.py | 486 | query: 搜索查询 | deliberate | backend-docstring | n/a |
| 2394 | backend/app/services/zep_tools.py | 487 | limit: 返回结果数量 | deliberate | backend-docstring | n/a |
| 2395 | backend/app/services/zep_tools.py | 488 | scope: 搜索范围,"edges" 或 "nodes" | review-needed | backend-string | n/a |
| 2396 | backend/app/services/zep_tools.py | 491 | SearchResult: 搜索结果 | deliberate | backend-docstring | n/a |
| 2397 | backend/app/services/zep_tools.py | 495 | # 尝试使用Zep Cloud Search API | deliberate | backend-comment | n/a |
| 2398 | backend/app/services/zep_tools.py | 504 | operation_name=f"图谱搜索(graph={graph_id})" | review-needed | backend-string | n/a |
| 2399 | backend/app/services/zep_tools.py | 511 | # 解析边搜索结果 | deliberate | backend-comment | n/a |
| 2400 | backend/app/services/zep_tools.py | 524 | # 解析节点搜索结果 | deliberate | backend-comment | n/a |
| 2401 | backend/app/services/zep_tools.py | 533 | # 节点摘要也算作事实 | deliberate | backend-comment | n/a |
| 2402 | backend/app/services/zep_tools.py | 549 | # 降级:使用本地关键词匹配搜索 | deliberate | backend-comment | n/a |
| 2403 | backend/app/services/zep_tools.py | 560 | 本地关键词匹配搜索(作为Zep Search API的降级方案) | deliberate | backend-docstring | n/a |
| 2404 | backend/app/services/zep_tools.py | 562 | 获取所有边/节点,然后在本地进行关键词匹配 | deliberate | backend-docstring | n/a |
| 2405 | backend/app/services/zep_tools.py | 565 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2406 | backend/app/services/zep_tools.py | 566 | query: 搜索查询 | deliberate | backend-docstring | n/a |
| 2407 | backend/app/services/zep_tools.py | 567 | limit: 返回结果数量 | deliberate | backend-docstring | n/a |
| 2408 | backend/app/services/zep_tools.py | 568 | scope: 搜索范围 | deliberate | backend-docstring | n/a |
| 2409 | backend/app/services/zep_tools.py | 571 | SearchResult: 搜索结果 | deliberate | backend-docstring | n/a |
| 2410 | backend/app/services/zep_tools.py | 579 | # 提取查询关键词(简单分词) | deliberate | backend-comment | n/a |
| 2411 | backend/app/services/zep_tools.py | 584 | """计算文本与查询的匹配分数""" | deliberate | backend-docstring | n/a |
| 2412 | backend/app/services/zep_tools.py | 588 | # 完全匹配查询 | deliberate | backend-comment | n/a |
| 2413 | backend/app/services/zep_tools.py | 591 | # 关键词匹配 | deliberate | backend-comment | n/a |
| 2414 | backend/app/services/zep_tools.py | 600 | # 获取所有边并匹配 | deliberate | backend-comment | n/a |
| 2415 | backend/app/services/zep_tools.py | 608 | # 按分数排序 | deliberate | backend-comment | n/a |
| 2416 | backend/app/services/zep_tools.py | 623 | # 获取所有节点并匹配 | deliberate | backend-comment | n/a |
| 2417 | backend/app/services/zep_tools.py | 658 | 获取图谱的所有节点(分页获取) | deliberate | backend-docstring | n/a |
| 2418 | backend/app/services/zep_tools.py | 661 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2419 | backend/app/services/zep_tools.py | 664 | 节点列表 | deliberate | backend-docstring | n/a |
| 2420 | backend/app/services/zep_tools.py | 686 | 获取图谱的所有边(分页获取,包含时间信息) | deliberate | backend-docstring | n/a |
| 2421 | backend/app/services/zep_tools.py | 689 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2422 | backend/app/services/zep_tools.py | 690 | include_temporal: 是否包含时间信息(默认True) | deliberate | backend-docstring | n/a |
| 2423 | backend/app/services/zep_tools.py | 693 | 边列表(包含created_at, valid_at, invalid_at, expired_at) | deliberate | backend-docstring | n/a |
| 2424 | backend/app/services/zep_tools.py | 710 | # 添加时间信息 | deliberate | backend-comment | n/a |
| 2425 | backend/app/services/zep_tools.py | 724 | 获取单个节点的详细信息 | deliberate | backend-docstring | n/a |
| 2426 | backend/app/services/zep_tools.py | 727 | node_uuid: 节点UUID | deliberate | backend-docstring | n/a |
| 2427 | backend/app/services/zep_tools.py | 730 | 节点信息或None | deliberate | backend-docstring | n/a |
| 2428 | backend/app/services/zep_tools.py | 737 | operation_name=f"获取节点详情(uuid={node_uuid[:8]}...)" | review-needed | backend-string | n/a |
| 2429 | backend/app/services/zep_tools.py | 756 | 获取节点相关的所有边 | deliberate | backend-docstring | n/a |
| 2430 | backend/app/services/zep_tools.py | 758 | 通过获取图谱所有边,然后过滤出与指定节点相关的边 | deliberate | backend-docstring | n/a |
| 2431 | backend/app/services/zep_tools.py | 761 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2432 | backend/app/services/zep_tools.py | 762 | node_uuid: 节点UUID | deliberate | backend-docstring | n/a |
| 2433 | backend/app/services/zep_tools.py | 765 | 边列表 | deliberate | backend-docstring | n/a |
| 2434 | backend/app/services/zep_tools.py | 770 | # 获取图谱所有边,然后过滤 | deliberate | backend-comment | n/a |
| 2435 | backend/app/services/zep_tools.py | 775 | # 检查边是否与指定节点相关(作为源或目标) | deliberate | backend-comment | n/a |
| 2436 | backend/app/services/zep_tools.py | 792 | 按类型获取实体 | deliberate | backend-docstring | n/a |
| 2437 | backend/app/services/zep_tools.py | 795 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2438 | backend/app/services/zep_tools.py | 796 | entity_type: 实体类型(如 Student, PublicFigure 等) | deliberate | backend-docstring | n/a |
| 2439 | backend/app/services/zep_tools.py | 799 | 符合类型的实体列表 | deliberate | backend-docstring | n/a |
| 2440 | backend/app/services/zep_tools.py | 807 | # 检查labels是否包含指定类型 | deliberate | backend-comment | n/a |
| 2441 | backend/app/services/zep_tools.py | 820 | 获取指定实体的关系摘要 | deliberate | backend-docstring | n/a |
| 2442 | backend/app/services/zep_tools.py | 822 | 搜索与该实体相关的所有信息,并生成摘要 | deliberate | backend-docstring | n/a |
| 2443 | backend/app/services/zep_tools.py | 825 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2444 | backend/app/services/zep_tools.py | 826 | entity_name: 实体名称 | deliberate | backend-docstring | n/a |
| 2445 | backend/app/services/zep_tools.py | 829 | 实体摘要信息 | deliberate | backend-docstring | n/a |
| 2446 | backend/app/services/zep_tools.py | 833 | # 先搜索该实体相关的信息 | deliberate | backend-comment | n/a |
| 2447 | backend/app/services/zep_tools.py | 840 | # 尝试在所有节点中找到该实体 | deliberate | backend-comment | n/a |
| 2448 | backend/app/services/zep_tools.py | 850 | # 传入graph_id参数 | deliberate | backend-comment | n/a |
| 2449 | backend/app/services/zep_tools.py | 863 | 获取图谱的统计信息 | deliberate | backend-docstring | n/a |
| 2450 | backend/app/services/zep_tools.py | 866 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2451 | backend/app/services/zep_tools.py | 869 | 统计信息 | deliberate | backend-docstring | n/a |
| 2452 | backend/app/services/zep_tools.py | 876 | # 统计实体类型分布 | deliberate | backend-comment | n/a |
| 2453 | backend/app/services/zep_tools.py | 883 | # 统计关系类型分布 | deliberate | backend-comment | n/a |
| 2454 | backend/app/services/zep_tools.py | 903 | 获取模拟相关的上下文信息 | deliberate | backend-docstring | n/a |
| 2455 | backend/app/services/zep_tools.py | 905 | 综合搜索与模拟需求相关的所有信息 | deliberate | backend-docstring | n/a |
| 2456 | backend/app/services/zep_tools.py | 908 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2457 | backend/app/services/zep_tools.py | 909 | simulation_requirement: 模拟需求描述 | deliberate | backend-docstring | n/a |
| 2458 | backend/app/services/zep_tools.py | 910 | limit: 每类信息的数量限制 | deliberate | backend-docstring | n/a |
| 2459 | backend/app/services/zep_tools.py | 913 | 模拟上下文信息 | deliberate | backend-docstring | n/a |
| 2460 | backend/app/services/zep_tools.py | 917 | # 搜索与模拟需求相关的信息 | deliberate | backend-comment | n/a |
| 2461 | backend/app/services/zep_tools.py | 924 | # 获取图谱统计 | deliberate | backend-comment | n/a |
| 2462 | backend/app/services/zep_tools.py | 927 | # 获取所有实体节点 | deliberate | backend-comment | n/a |
| 2463 | backend/app/services/zep_tools.py | 930 | # 筛选有实际类型的实体(非纯Entity节点) | deliberate | backend-comment | n/a |
| 2464 | backend/app/services/zep_tools.py | 945 | "entities": entities[:limit], # 限制数量 | review-needed | backend-string | n/a |
| 2465 | backend/app/services/zep_tools.py | 949 | # ========== 核心检索工具(优化后) ========== | deliberate | backend-comment | n/a |
| 2466 | backend/app/services/zep_tools.py | 960 | 【InsightForge - 深度洞察检索】 | deliberate | backend-docstring | n/a |
| 2467 | backend/app/services/zep_tools.py | 962 | 最强大的混合检索函数,自动分解问题并多维度检索: | deliberate | backend-docstring | n/a |
| 2468 | backend/app/services/zep_tools.py | 963 | 1. 使用LLM将问题分解为多个子问题 | deliberate | backend-docstring | n/a |
| 2469 | backend/app/services/zep_tools.py | 964 | 2. 对每个子问题进行语义搜索 | deliberate | backend-docstring | n/a |
| 2470 | backend/app/services/zep_tools.py | 965 | 3. 提取相关实体并获取其详细信息 | deliberate | backend-docstring | n/a |
| 2471 | backend/app/services/zep_tools.py | 966 | 4. 追踪关系链 | deliberate | backend-docstring | n/a |
| 2472 | backend/app/services/zep_tools.py | 967 | 5. 整合所有结果,生成深度洞察 | deliberate | backend-docstring | n/a |
| 2473 | backend/app/services/zep_tools.py | 970 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2474 | backend/app/services/zep_tools.py | 971 | query: 用户问题 | deliberate | backend-docstring | n/a |
| 2475 | backend/app/services/zep_tools.py | 972 | simulation_requirement: 模拟需求描述 | deliberate | backend-docstring | n/a |
| 2476 | backend/app/services/zep_tools.py | 973 | report_context: 报告上下文(可选,用于更精准的子问题生成) | deliberate | backend-docstring | n/a |
| 2477 | backend/app/services/zep_tools.py | 974 | max_sub_queries: 最大子问题数量 | deliberate | backend-docstring | n/a |
| 2478 | backend/app/services/zep_tools.py | 977 | InsightForgeResult: 深度洞察检索结果 | deliberate | backend-docstring | n/a |
| 2479 | backend/app/services/zep_tools.py | 987 | # Step 1: 使用LLM生成子问题 | deliberate | backend-comment | n/a |
| 2480 | backend/app/services/zep_tools.py | 997 | # Step 2: 对每个子问题进行语义搜索 | deliberate | backend-comment | n/a |
| 2481 | backend/app/services/zep_tools.py | 1017 | # 对原始问题也进行搜索 | deliberate | backend-comment | n/a |
| 2482 | backend/app/services/zep_tools.py | 1032 | # Step 3: 从边中提取相关实体UUID,只获取这些实体的信息(不获取全部节点) | deliberate | backend-comment | n/a |
| 2483 | backend/app/services/zep_tools.py | 1043 | # 获取所有相关实体的详情(不限制数量,完整输出) | deliberate | backend-comment | n/a |
| 2484 | backend/app/services/zep_tools.py | 1045 | node_map = {} # 用于后续关系链构建 | deliberate | backend-docstring | n/a |
| 2485 | backend/app/services/zep_tools.py | 1047 | for uuid in list(entity_uuids): # 处理所有实体,不截断 | deliberate | backend-docstring | n/a |
| 2486 | backend/app/services/zep_tools.py | 1051 | # 单独获取每个相关节点的信息 | deliberate | backend-comment | n/a |
| 2487 | backend/app/services/zep_tools.py | 1055 | entity_type = next((l for l in node.labels if l not in ["Entity", "Node"]), "实体") | review-needed | backend-string | n/a |
| 2488 | backend/app/services/zep_tools.py | 1057 | # 获取该实体相关的所有事实(不截断) | deliberate | backend-comment | n/a |
| 2489 | backend/app/services/zep_tools.py | 1068 | "related_facts": related_facts # 完整输出,不截断 | review-needed | backend-string | n/a |
| 2490 | backend/app/services/zep_tools.py | 1077 | # Step 4: 构建所有关系链(不限制数量) | deliberate | backend-comment | n/a |
| 2491 | backend/app/services/zep_tools.py | 1079 | for edge_data in all_edges: # 处理所有边,不截断 | deliberate | backend-docstring | n/a |
| 2492 | backend/app/services/zep_tools.py | 1106 | 使用LLM生成子问题 | deliberate | backend-docstring | n/a |
| 2493 | backend/app/services/zep_tools.py | 1108 | 将复杂问题分解为多个可以独立检索的子问题 | deliberate | backend-docstring | n/a |
| 2494 | backend/app/services/zep_tools.py | 1110 | system_prompt = """你是一个专业的问题分析专家。你的任务是将一个复杂问题分解为多个可以在模拟世界中独立观察的子问题。 | review-needed | backend-string | n/a |
| 2495 | backend/app/services/zep_tools.py | 1112 | 要求: | deliberate | backend-docstring | n/a |
| 2496 | backend/app/services/zep_tools.py | 1113 | 1. 每个子问题应该足够具体,可以在模拟世界中找到相关的Agent行为或事件 | deliberate | backend-docstring | n/a |
| 2497 | backend/app/services/zep_tools.py | 1114 | 2. 子问题应该覆盖原问题的不同维度(如:谁、什么、为什么、怎么样、何时、何地) | deliberate | backend-docstring | n/a |
| 2498 | backend/app/services/zep_tools.py | 1115 | 3. 子问题应该与模拟场景相关 | deliberate | backend-docstring | n/a |
| 2499 | backend/app/services/zep_tools.py | 1116 | 4. 返回JSON格式:{"sub_queries": ["子问题1", "子问题2", ...]}""" | review-needed | backend-string | n/a |
| 2500 | backend/app/services/zep_tools.py | 1118 | user_prompt = f"""模拟需求背景: | review-needed | backend-string | n/a |
| 2501 | backend/app/services/zep_tools.py | 1121 | {f"报告上下文:{report_context[:500]}" if report_context else ""} | review-needed | backend-string | n/a |
| 2502 | backend/app/services/zep_tools.py | 1123 | 请将以下问题分解为{max_queries}个子问题: | deliberate | backend-docstring | n/a |
| 2503 | backend/app/services/zep_tools.py | 1126 | 返回JSON格式的子问题列表。""" | review-needed | backend-string | n/a |
| 2504 | backend/app/services/zep_tools.py | 1138 | # 确保是字符串列表 | deliberate | backend-comment | n/a |
| 2505 | backend/app/services/zep_tools.py | 1143 | # 降级:返回基于原问题的变体 | deliberate | backend-comment | n/a |
| 2506 | backend/app/services/zep_tools.py | 1146 | f"{query} 的主要参与者", | review-needed | backend-string | n/a |
| 2507 | backend/app/services/zep_tools.py | 1147 | f"{query} 的原因和影响", | review-needed | backend-string | n/a |
| 2508 | backend/app/services/zep_tools.py | 1148 | f"{query} 的发展过程" | review-needed | backend-string | n/a |
| 2509 | backend/app/services/zep_tools.py | 1159 | 【PanoramaSearch - 广度搜索】 | deliberate | backend-docstring | n/a |
| 2510 | backend/app/services/zep_tools.py | 1161 | 获取全貌视图,包括所有相关内容和历史/过期信息: | deliberate | backend-docstring | n/a |
| 2511 | backend/app/services/zep_tools.py | 1162 | 1. 获取所有相关节点 | deliberate | backend-docstring | n/a |
| 2512 | backend/app/services/zep_tools.py | 1163 | 2. 获取所有边(包括已过期/失效的) | deliberate | backend-docstring | n/a |
| 2513 | backend/app/services/zep_tools.py | 1164 | 3. 分类整理当前有效和历史信息 | deliberate | backend-docstring | n/a |
| 2514 | backend/app/services/zep_tools.py | 1166 | 这个工具适用于需要了解事件全貌、追踪演变过程的场景。 | deliberate | backend-docstring | n/a |
| 2515 | backend/app/services/zep_tools.py | 1169 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2516 | backend/app/services/zep_tools.py | 1170 | query: 搜索查询(用于相关性排序) | deliberate | backend-docstring | n/a |
| 2517 | backend/app/services/zep_tools.py | 1171 | include_expired: 是否包含过期内容(默认True) | deliberate | backend-docstring | n/a |
| 2518 | backend/app/services/zep_tools.py | 1172 | limit: 返回结果数量限制 | deliberate | backend-docstring | n/a |
| 2519 | backend/app/services/zep_tools.py | 1175 | PanoramaResult: 广度搜索结果 | deliberate | backend-docstring | n/a |
| 2520 | backend/app/services/zep_tools.py | 1181 | # 获取所有节点 | deliberate | backend-comment | n/a |
| 2521 | backend/app/services/zep_tools.py | 1187 | # 获取所有边(包含时间信息) | deliberate | backend-comment | n/a |
| 2522 | backend/app/services/zep_tools.py | 1192 | # 分类事实 | deliberate | backend-comment | n/a |
| 2523 | backend/app/services/zep_tools.py | 1200 | # 为事实添加实体名称 | deliberate | backend-comment | n/a |
| 2524 | backend/app/services/zep_tools.py | 1204 | # 判断是否过期/失效 | deliberate | backend-comment | n/a |
| 2525 | backend/app/services/zep_tools.py | 1208 | # 历史/过期事实,添加时间标记 | deliberate | backend-comment | n/a |
| 2526 | backend/app/services/zep_tools.py | 1209 | valid_at = edge.valid_at or "未知" | review-needed | backend-string | n/a |
| 2527 | backend/app/services/zep_tools.py | 1210 | invalid_at = edge.invalid_at or edge.expired_at or "未知" | review-needed | backend-string | n/a |
| 2528 | backend/app/services/zep_tools.py | 1214 | # 当前有效事实 | deliberate | backend-comment | n/a |
| 2529 | backend/app/services/zep_tools.py | 1217 | # 基于查询进行相关性排序 | deliberate | backend-comment | n/a |
| 2530 | backend/app/services/zep_tools.py | 1231 | # 排序并限制数量 | deliberate | backend-comment | n/a |
| 2531 | backend/app/services/zep_tools.py | 1250 | 【QuickSearch - 简单搜索】 | deliberate | backend-docstring | n/a |
| 2532 | backend/app/services/zep_tools.py | 1252 | 快速、轻量级的检索工具: | deliberate | backend-docstring | n/a |
| 2533 | backend/app/services/zep_tools.py | 1253 | 1. 直接调用Zep语义搜索 | deliberate | backend-docstring | n/a |
| 2534 | backend/app/services/zep_tools.py | 1254 | 2. 返回最相关的结果 | deliberate | backend-docstring | n/a |
| 2535 | backend/app/services/zep_tools.py | 1255 | 3. 适用于简单、直接的检索需求 | deliberate | backend-docstring | n/a |
| 2536 | backend/app/services/zep_tools.py | 1258 | graph_id: 图谱ID | deliberate | backend-docstring | n/a |
| 2537 | backend/app/services/zep_tools.py | 1259 | query: 搜索查询 | deliberate | backend-docstring | n/a |
| 2538 | backend/app/services/zep_tools.py | 1260 | limit: 返回结果数量 | deliberate | backend-docstring | n/a |
| 2539 | backend/app/services/zep_tools.py | 1263 | SearchResult: 搜索结果 | deliberate | backend-docstring | n/a |
| 2540 | backend/app/services/zep_tools.py | 1267 | # 直接调用现有的search_graph方法 | deliberate | backend-comment | n/a |
| 2541 | backend/app/services/zep_tools.py | 1287 | 【InterviewAgents - 深度采访】 | deliberate | backend-docstring | n/a |
| 2542 | backend/app/services/zep_tools.py | 1289 | 调用真实的OASIS采访API,采访模拟中正在运行的Agent: | deliberate | backend-docstring | n/a |
| 2543 | backend/app/services/zep_tools.py | 1290 | 1. 自动读取人设文件,了解所有模拟Agent | deliberate | backend-docstring | n/a |
| 2544 | backend/app/services/zep_tools.py | 1291 | 2. 使用LLM分析采访需求,智能选择最相关的Agent | deliberate | backend-docstring | n/a |
| 2545 | backend/app/services/zep_tools.py | 1292 | 3. 使用LLM生成采访问题 | deliberate | backend-docstring | n/a |
| 2546 | backend/app/services/zep_tools.py | 1293 | 4. 调用 /api/simulation/interview/batch 接口进行真实采访(双平台同时采访) | deliberate | backend-docstring | n/a |
| 2547 | backend/app/services/zep_tools.py | 1294 | 5. 整合所有采访结果,生成采访报告 | deliberate | backend-docstring | n/a |
| 2548 | backend/app/services/zep_tools.py | 1296 | 【重要】此功能需要模拟环境处于运行状态(OASIS环境未关闭) | deliberate | backend-docstring | n/a |
| 2549 | backend/app/services/zep_tools.py | 1298 | 【使用场景】 | deliberate | backend-docstring | n/a |
| 2550 | backend/app/services/zep_tools.py | 1299 | - 需要从不同角色视角了解事件看法 | deliberate | backend-docstring | n/a |
| 2551 | backend/app/services/zep_tools.py | 1300 | - 需要收集多方意见和观点 | deliberate | backend-docstring | n/a |
| 2552 | backend/app/services/zep_tools.py | 1301 | - 需要获取模拟Agent的真实回答(非LLM模拟) | deliberate | backend-docstring | n/a |
| 2553 | backend/app/services/zep_tools.py | 1304 | simulation_id: 模拟ID(用于定位人设文件和调用采访API) | deliberate | backend-docstring | n/a |
| 2554 | backend/app/services/zep_tools.py | 1305 | interview_requirement: 采访需求描述(非结构化,如"了解学生对事件的看法") | review-needed | backend-string | n/a |
| 2555 | backend/app/services/zep_tools.py | 1306 | simulation_requirement: 模拟需求背景(可选) | deliberate | backend-docstring | n/a |
| 2556 | backend/app/services/zep_tools.py | 1307 | max_agents: 最多采访的Agent数量 | deliberate | backend-docstring | n/a |
| 2557 | backend/app/services/zep_tools.py | 1308 | custom_questions: 自定义采访问题(可选,若不提供则自动生成) | deliberate | backend-docstring | n/a |
| 2558 | backend/app/services/zep_tools.py | 1311 | InterviewResult: 采访结果 | deliberate | backend-docstring | n/a |
| 2559 | backend/app/services/zep_tools.py | 1322 | # Step 1: 读取人设文件 | deliberate | backend-comment | n/a |
| 2560 | backend/app/services/zep_tools.py | 1327 | result.summary = "未找到可采访的Agent人设文件" | review-needed | backend-string | n/a |
| 2561 | backend/app/services/zep_tools.py | 1333 | # Step 2: 使用LLM选择要采访的Agent(返回agent_id列表) | deliberate | backend-comment | n/a |
| 2562 | backend/app/services/zep_tools.py | 1345 | # Step 3: 生成采访问题(如果没有提供) | deliberate | backend-comment | n/a |
| 2563 | backend/app/services/zep_tools.py | 1354 | # 将问题合并为一个采访prompt | deliberate | backend-comment | n/a |
| 2564 | backend/app/services/zep_tools.py | 1357 | # 添加优化前缀,约束Agent回复格式 | deliberate | backend-comment | n/a |
| 2565 | backend/app/services/zep_tools.py | 1359 | "你正在接受一次采访。请结合你的人设、所有的过往记忆与行动," | review-needed | backend-string | n/a |
| 2566 | backend/app/services/zep_tools.py | 1360 | "以纯文本方式直接回答以下问题。\n" | review-needed | backend-string | n/a |
| 2567 | backend/app/services/zep_tools.py | 1361 | "回复要求:\n" | review-needed | backend-string | n/a |
| 2568 | backend/app/services/zep_tools.py | 1362 | "1. 直接用自然语言回答,不要调用任何工具\n" | review-needed | backend-string | n/a |
| 2569 | backend/app/services/zep_tools.py | 1363 | "2. 不要返回JSON格式或工具调用格式\n" | review-needed | backend-string | n/a |
| 2570 | backend/app/services/zep_tools.py | 1364 | "3. 不要使用Markdown标题(如#、##、###)\n" | review-needed | backend-string | n/a |
| 2571 | backend/app/services/zep_tools.py | 1365 | "4. 按问题编号逐一回答,每个回答以「问题X:」开头(X为问题编号)\n" | review-needed | backend-string | n/a |
| 2572 | backend/app/services/zep_tools.py | 1366 | "5. 每个问题的回答之间用空行分隔\n" | review-needed | backend-string | n/a |
| 2573 | backend/app/services/zep_tools.py | 1367 | "6. 回答要有实质内容,每个问题至少回答2-3句话\n\n" | review-needed | backend-string | n/a |
| 2574 | backend/app/services/zep_tools.py | 1371 | # Step 4: 调用真实的采访API(不指定platform,默认双平台同时采访) | deliberate | backend-comment | n/a |
| 2575 | backend/app/services/zep_tools.py | 1373 | # 构建批量采访列表(不指定platform,双平台采访) | deliberate | backend-comment | n/a |
| 2576 | backend/app/services/zep_tools.py | 1378 | "prompt": optimized_prompt # 使用优化后的prompt | review-needed | backend-string | n/a |
| 2577 | backend/app/services/zep_tools.py | 1379 | # 不指定platform,API会在twitter和reddit两个平台都采访 | deliberate | backend-comment | n/a |
| 2578 | backend/app/services/zep_tools.py | 1384 | # 调用 SimulationRunner 的批量采访方法(不传platform,双平台采访) | deliberate | backend-comment | n/a |
| 2579 | backend/app/services/zep_tools.py | 1388 | platform=None, # 不指定platform,双平台采访 | deliberate | backend-docstring | n/a |
| 2580 | backend/app/services/zep_tools.py | 1389 | timeout=180.0 # 双平台需要更长超时 | deliberate | backend-docstring | n/a |
| 2581 | backend/app/services/zep_tools.py | 1394 | # 检查API调用是否成功 | deliberate | backend-comment | n/a |
| 2582 | backend/app/services/zep_tools.py | 1396 | error_msg = api_result.get("error", "未知错误") | review-needed | backend-string | n/a |
| 2583 | backend/app/services/zep_tools.py | 1398 | result.summary = f"采访API调用失败:{error_msg}。请检查OASIS模拟环境状态。" | review-needed | backend-string | n/a |
| 2584 | backend/app/services/zep_tools.py | 1401 | # Step 5: 解析API返回结果,构建AgentInterview对象 | deliberate | backend-comment | n/a |
| 2585 | backend/app/services/zep_tools.py | 1402 | # 双平台模式返回格式: {"twitter_0": {...}, "reddit_0": {...}, "twitter_1": {...}, ...} | deliberate | backend-comment | n/a |
| 2586 | backend/app/services/zep_tools.py | 1409 | agent_role = agent.get("profession", "未知") | review-needed | backend-string | n/a |
| 2587 | backend/app/services/zep_tools.py | 1412 | # 获取该Agent在两个平台的采访结果 | deliberate | backend-comment | n/a |
| 2588 | backend/app/services/zep_tools.py | 1419 | # 清理可能的工具调用 JSON 包裹 | deliberate | backend-comment | n/a |
| 2589 | backend/app/services/zep_tools.py | 1423 | # 始终输出双平台标记 | deliberate | backend-comment | n/a |
| 2590 | backend/app/services/zep_tools.py | 1424 | twitter_text = twitter_response if twitter_response else "(该平台未获得回复)" | review-needed | backend-string | n/a |
| 2591 | backend/app/services/zep_tools.py | 1425 | reddit_text = reddit_response if reddit_response else "(该平台未获得回复)" | review-needed | backend-string | n/a |
| 2592 | backend/app/services/zep_tools.py | 1426 | response_text = f"【Twitter平台回答】\n{twitter_text}\n\n【Reddit平台回答】\n{reddit_text}" | review-needed | backend-string | n/a |
| 2593 | backend/app/services/zep_tools.py | 1428 | # 提取关键引言(从两个平台的回答中) | deliberate | backend-comment | n/a |
| 2594 | backend/app/services/zep_tools.py | 1432 | # 清理响应文本:去掉标记、编号、Markdown 等干扰 | deliberate | backend-comment | n/a |
| 2595 | backend/app/services/zep_tools.py | 1436 | clean_text = re.sub(r'问题\d+[::]\s*', '', clean_text) | review-needed | backend-string | n/a |
| 2596 | backend/app/services/zep_tools.py | 1439 | # 策略1(主): 提取完整的有实质内容的句子 | deliberate | backend-comment | n/a |
| 2597 | backend/app/services/zep_tools.py | 1445 | and not s.strip().startswith(('{', '问题')) | review-needed | backend-string | n/a |
| 2598 | backend/app/services/zep_tools.py | 1450 | # 策略2(补充): 正确配对的中文引号「」内长文本 | deliberate | backend-comment | n/a |
| 2599 | backend/app/services/zep_tools.py | 1459 | agent_bio=agent_bio[:1000], # 扩大bio长度限制 | deliberate | backend-docstring | n/a |
| 2600 | backend/app/services/zep_tools.py | 1469 | # 模拟环境未运行 | deliberate | backend-comment | n/a |
| 2601 | backend/app/services/zep_tools.py | 1471 | result.summary = f"采访失败:{str(e)}。模拟环境可能已关闭,请确保OASIS环境正在运行。" | review-needed | backend-string | n/a |
| 2602 | backend/app/services/zep_tools.py | 1477 | result.summary = f"采访过程发生错误:{str(e)}" | review-needed | backend-string | n/a |
| 2603 | backend/app/services/zep_tools.py | 1480 | # Step 6: 生成采访摘要 | deliberate | backend-comment | n/a |
| 2604 | backend/app/services/zep_tools.py | 1492 | """清理 Agent 回复中的 JSON 工具调用包裹,提取实际内容""" | deliberate | backend-docstring | n/a |
| 2605 | backend/app/services/zep_tools.py | 1512 | """加载模拟的Agent人设文件""" | deliberate | backend-docstring | n/a |
| 2606 | backend/app/services/zep_tools.py | 1516 | # 构建人设文件路径 | deliberate | backend-comment | n/a |
| 2607 | backend/app/services/zep_tools.py | 1524 | # 优先尝试读取Reddit JSON格式 | deliberate | backend-comment | n/a |
| 2608 | backend/app/services/zep_tools.py | 1535 | # 尝试读取Twitter CSV格式 | deliberate | backend-comment | n/a |
| 2609 | backend/app/services/zep_tools.py | 1542 | # CSV格式转换为统一格式 | deliberate | backend-comment | n/a |
| 2610 | backend/app/services/zep_tools.py | 1548 | "profession": "未知" | review-needed | backend-string | n/a |
| 2611 | backend/app/services/zep_tools.py | 1565 | 使用LLM选择要采访的Agent | deliberate | backend-docstring | n/a |
| 2612 | backend/app/services/zep_tools.py | 1569 | - selected_agents: 选中Agent的完整信息列表 | deliberate | backend-docstring | n/a |
| 2613 | backend/app/services/zep_tools.py | 1570 | - selected_indices: 选中Agent的索引列表(用于API调用) | deliberate | backend-docstring | n/a |
| 2614 | backend/app/services/zep_tools.py | 1571 | - reasoning: 选择理由 | deliberate | backend-docstring | n/a |
| 2615 | backend/app/services/zep_tools.py | 1574 | # 构建Agent摘要列表 | deliberate | backend-comment | n/a |
| 2616 | backend/app/services/zep_tools.py | 1580 | "profession": profile.get("profession", "未知"), | review-needed | backend-string | n/a |
| 2617 | backend/app/services/zep_tools.py | 1586 | system_prompt = """你是一个专业的采访策划专家。你的任务是根据采访需求,从模拟Agent列表中选择最适合采访的对象。 | review-needed | backend-string | n/a |
| 2618 | backend/app/services/zep_tools.py | 1588 | 选择标准: | deliberate | backend-docstring | n/a |
| 2619 | backend/app/services/zep_tools.py | 1589 | 1. Agent的身份/职业与采访主题相关 | deliberate | backend-docstring | n/a |
| 2620 | backend/app/services/zep_tools.py | 1590 | 2. Agent可能持有独特或有价值的观点 | deliberate | backend-docstring | n/a |
| 2621 | backend/app/services/zep_tools.py | 1591 | 3. 选择多样化的视角(如:支持方、反对方、中立方、专业人士等) | deliberate | backend-docstring | n/a |
| 2622 | backend/app/services/zep_tools.py | 1592 | 4. 优先选择与事件直接相关的角色 | deliberate | backend-docstring | n/a |
| 2623 | backend/app/services/zep_tools.py | 1594 | 返回JSON格式: | deliberate | backend-docstring | n/a |
| 2624 | backend/app/services/zep_tools.py | 1596 | "selected_indices": [选中Agent的索引列表], | review-needed | backend-string | n/a |
| 2625 | backend/app/services/zep_tools.py | 1597 | "reasoning": "选择理由说明" | review-needed | backend-string | n/a |
| 2626 | backend/app/services/zep_tools.py | 1600 | user_prompt = f"""采访需求: | review-needed | backend-string | n/a |
| 2627 | backend/app/services/zep_tools.py | 1603 | 模拟背景: | deliberate | backend-docstring | n/a |
| 2628 | backend/app/services/zep_tools.py | 1604 | {simulation_requirement if simulation_requirement else "未提供"} | review-needed | backend-string | n/a |
| 2629 | backend/app/services/zep_tools.py | 1606 | 可选择的Agent列表(共{len(agent_summaries)}个): | deliberate | backend-docstring | n/a |
| 2630 | backend/app/services/zep_tools.py | 1609 | 请选择最多{max_agents}个最适合采访的Agent,并说明选择理由。""" | review-needed | backend-string | n/a |
| 2631 | backend/app/services/zep_tools.py | 1621 | reasoning = response.get("reasoning", "基于相关性自动选择") | review-needed | backend-string | n/a |
| 2632 | backend/app/services/zep_tools.py | 1623 | # 获取选中的Agent完整信息 | deliberate | backend-comment | n/a |
| 2633 | backend/app/services/zep_tools.py | 1635 | # 降级:选择前N个 | deliberate | backend-comment | n/a |
| 2634 | backend/app/services/zep_tools.py | 1638 | return selected, indices, "使用默认选择策略" | review-needed | backend-string | n/a |
| 2635 | backend/app/services/zep_tools.py | 1646 | """使用LLM生成采访问题""" | deliberate | backend-docstring | n/a |
| 2636 | backend/app/services/zep_tools.py | 1648 | agent_roles = [a.get("profession", "未知") for a in selected_agents] | review-needed | backend-string | n/a |
| 2637 | backend/app/services/zep_tools.py | 1650 | system_prompt = """你是一个专业的记者/采访者。根据采访需求,生成3-5个深度采访问题。 | review-needed | backend-string | n/a |
| 2638 | backend/app/services/zep_tools.py | 1652 | 问题要求: | deliberate | backend-docstring | n/a |
| 2639 | backend/app/services/zep_tools.py | 1653 | 1. 开放性问题,鼓励详细回答 | deliberate | backend-docstring | n/a |
| 2640 | backend/app/services/zep_tools.py | 1654 | 2. 针对不同角色可能有不同答案 | deliberate | backend-docstring | n/a |
| 2641 | backend/app/services/zep_tools.py | 1655 | 3. 涵盖事实、观点、感受等多个维度 | deliberate | backend-docstring | n/a |
| 2642 | backend/app/services/zep_tools.py | 1656 | 4. 语言自然,像真实采访一样 | deliberate | backend-docstring | n/a |
| 2643 | backend/app/services/zep_tools.py | 1657 | 5. 每个问题控制在50字以内,简洁明了 | deliberate | backend-docstring | n/a |
| 2644 | backend/app/services/zep_tools.py | 1658 | 6. 直接提问,不要包含背景说明或前缀 | deliberate | backend-docstring | n/a |
| 2645 | backend/app/services/zep_tools.py | 1660 | 返回JSON格式:{"questions": ["问题1", "问题2", ...]}""" | review-needed | backend-string | n/a |
| 2646 | backend/app/services/zep_tools.py | 1662 | user_prompt = f"""采访需求:{interview_requirement} | review-needed | backend-string | n/a |
| 2647 | backend/app/services/zep_tools.py | 1664 | 模拟背景:{simulation_requirement if simulation_requirement else "未提供"} | review-needed | backend-string | n/a |
| 2648 | backend/app/services/zep_tools.py | 1666 | 采访对象角色:{', '.join(agent_roles)} | review-needed | backend-string | n/a |
| 2649 | backend/app/services/zep_tools.py | 1668 | 请生成3-5个采访问题。""" | review-needed | backend-string | n/a |
| 2650 | backend/app/services/zep_tools.py | 1679 | return response.get("questions", [f"关于{interview_requirement},您有什么看法?"]) | review-needed | backend-string | n/a |
| 2651 | backend/app/services/zep_tools.py | 1684 | f"关于{interview_requirement},您的观点是什么?", | review-needed | backend-string | n/a |
| 2652 | backend/app/services/zep_tools.py | 1685 | "这件事对您或您所代表的群体有什么影响?", | review-needed | backend-string | n/a |
| 2653 | backend/app/services/zep_tools.py | 1686 | "您认为应该如何解决或改进这个问题?" | review-needed | backend-string | n/a |
| 2654 | backend/app/services/zep_tools.py | 1694 | """生成采访摘要""" | deliberate | backend-docstring | n/a |
| 2655 | backend/app/services/zep_tools.py | 1697 | return "未完成任何采访" | review-needed | backend-string | n/a |
| 2656 | backend/app/services/zep_tools.py | 1699 | # 收集所有采访内容 | deliberate | backend-comment | n/a |
| 2657 | backend/app/services/zep_tools.py | 1704 | system_prompt = """你是一个专业的新闻编辑。请根据多位受访者的回答,生成一份采访摘要。 | review-needed | backend-string | n/a |
| 2658 | backend/app/services/zep_tools.py | 1706 | 摘要要求: | deliberate | backend-docstring | n/a |
| 2659 | backend/app/services/zep_tools.py | 1707 | 1. 提炼各方主要观点 | deliberate | backend-docstring | n/a |
| 2660 | backend/app/services/zep_tools.py | 1708 | 2. 指出观点的共识和分歧 | deliberate | backend-docstring | n/a |
| 2661 | backend/app/services/zep_tools.py | 1709 | 3. 突出有价值的引言 | deliberate | backend-docstring | n/a |
| 2662 | backend/app/services/zep_tools.py | 1710 | 4. 客观中立,不偏袒任何一方 | deliberate | backend-docstring | n/a |
| 2663 | backend/app/services/zep_tools.py | 1711 | 5. 控制在1000字内 | deliberate | backend-docstring | n/a |
| 2664 | backend/app/services/zep_tools.py | 1713 | 格式约束(必须遵守): | deliberate | backend-docstring | n/a |
| 2665 | backend/app/services/zep_tools.py | 1714 | - 使用纯文本段落,用空行分隔不同部分 | deliberate | backend-docstring | n/a |
| 2666 | backend/app/services/zep_tools.py | 1715 | - 不要使用Markdown标题(如#、##、###) | deliberate | backend-docstring | n/a |
| 2667 | backend/app/services/zep_tools.py | 1716 | - 不要使用分割线(如---、***) | deliberate | backend-docstring | n/a |
| 2668 | backend/app/services/zep_tools.py | 1717 | - 引用受访者原话时使用中文引号「」 | deliberate | backend-docstring | n/a |
| 2669 | backend/app/services/zep_tools.py | 1718 | - 可以使用**加粗**标记关键词,但不要使用其他Markdown语法""" | review-needed | backend-string | n/a |
| 2670 | backend/app/services/zep_tools.py | 1720 | user_prompt = f"""采访主题:{interview_requirement} | review-needed | backend-string | n/a |
| 2671 | backend/app/services/zep_tools.py | 1722 | 采访内容: | deliberate | backend-docstring | n/a |
| 2672 | backend/app/services/zep_tools.py | 1725 | 请生成采访摘要。""" | review-needed | backend-string | n/a |
| 2673 | backend/app/services/zep_tools.py | 1740 | # 降级:简单拼接 | deliberate | backend-comment | n/a |
| 2674 | backend/app/services/zep_tools.py | 1741 | return f"共采访了{len(interviews)}位受访者,包括:" + "、".join([i.agent_name for i in interviews]) | review-needed | backend-string | n/a |
| 2675 | backend/app/utils/__init__.py | 2 | 工具模块 | deliberate | backend-docstring | n/a |
| 2676 | backend/app/utils/file_parser.py | 2 | 文件解析工具 | deliberate | backend-docstring | n/a |
| 2677 | backend/app/utils/file_parser.py | 3 | 支持PDF、Markdown、TXT文件的文本提取 | deliberate | backend-docstring | n/a |
| 2678 | backend/app/utils/file_parser.py | 13 | 读取文本文件,UTF-8失败时自动探测编码。 | deliberate | backend-docstring | n/a |
| 2679 | backend/app/utils/file_parser.py | 15 | 采用多级回退策略: | deliberate | backend-docstring | n/a |
| 2680 | backend/app/utils/file_parser.py | 16 | 1. 首先尝试 UTF-8 解码 | deliberate | backend-docstring | n/a |
| 2681 | backend/app/utils/file_parser.py | 17 | 2. 使用 charset_normalizer 检测编码 | deliberate | backend-docstring | n/a |
| 2682 | backend/app/utils/file_parser.py | 18 | 3. 回退到 chardet 检测编码 | deliberate | backend-docstring | n/a |
| 2683 | backend/app/utils/file_parser.py | 19 | 4. 最终使用 UTF-8 + errors='replace' 兜底 | review-needed | backend-string | n/a |
| 2684 | backend/app/utils/file_parser.py | 22 | file_path: 文件路径 | deliberate | backend-docstring | n/a |
| 2685 | backend/app/utils/file_parser.py | 25 | 解码后的文本内容 | deliberate | backend-docstring | n/a |
| 2686 | backend/app/utils/file_parser.py | 29 | # 首先尝试 UTF-8 | deliberate | backend-comment | n/a |
| 2687 | backend/app/utils/file_parser.py | 35 | # 尝试使用 charset_normalizer 检测编码 | deliberate | backend-comment | n/a |
| 2688 | backend/app/utils/file_parser.py | 45 | # 回退到 chardet | deliberate | backend-comment | n/a |
| 2689 | backend/app/utils/file_parser.py | 54 | # 最终兜底:使用 UTF-8 + replace | deliberate | backend-comment | n/a |
| 2690 | backend/app/utils/file_parser.py | 62 | """文件解析器""" | deliberate | backend-docstring | n/a |
| 2691 | backend/app/utils/file_parser.py | 69 | 从文件中提取文本 | deliberate | backend-docstring | n/a |
| 2692 | backend/app/utils/file_parser.py | 72 | file_path: 文件路径 | deliberate | backend-docstring | n/a |
| 2693 | backend/app/utils/file_parser.py | 75 | 提取的文本内容 | deliberate | backend-docstring | n/a |
| 2694 | backend/app/utils/file_parser.py | 80 | raise FileNotFoundError(f"文件不存在: {file_path}") | review-needed | backend-string | n/a |
| 2695 | backend/app/utils/file_parser.py | 85 | raise ValueError(f"不支持的文件格式: {suffix}") | review-needed | backend-string | n/a |
| 2696 | backend/app/utils/file_parser.py | 94 | raise ValueError(f"无法处理的文件格式: {suffix}") | review-needed | backend-string | n/a |
| 2697 | backend/app/utils/file_parser.py | 98 | """从PDF提取文本""" | deliberate | backend-docstring | n/a |
| 2698 | backend/app/utils/file_parser.py | 102 | raise ImportError("需要安装PyMuPDF: pip install PyMuPDF") | review-needed | backend-string | n/a |
| 2699 | backend/app/utils/file_parser.py | 115 | """从Markdown提取文本,支持自动编码检测""" | deliberate | backend-docstring | n/a |
| 2700 | backend/app/utils/file_parser.py | 120 | """从TXT提取文本,支持自动编码检测""" | deliberate | backend-docstring | n/a |
| 2701 | backend/app/utils/file_parser.py | 126 | 从多个文件提取文本并合并 | deliberate | backend-docstring | n/a |
| 2702 | backend/app/utils/file_parser.py | 129 | file_paths: 文件路径列表 | deliberate | backend-docstring | n/a |
| 2703 | backend/app/utils/file_parser.py | 132 | 合并后的文本 | deliberate | backend-docstring | n/a |
| 2704 | backend/app/utils/file_parser.py | 140 | all_texts.append(f"=== 文档 {i}: {filename} ===\n{text}") | review-needed | backend-string | n/a |
| 2705 | backend/app/utils/file_parser.py | 142 | all_texts.append(f"=== 文档 {i}: {file_path} (提取失败: {str(e)}) ===") | review-needed | backend-string | n/a |
| 2706 | backend/app/utils/file_parser.py | 153 | 将文本分割成小块 | deliberate | backend-docstring | n/a |
| 2707 | backend/app/utils/file_parser.py | 156 | text: 原始文本 | deliberate | backend-docstring | n/a |
| 2708 | backend/app/utils/file_parser.py | 157 | chunk_size: 每块的字符数 | deliberate | backend-docstring | n/a |
| 2709 | backend/app/utils/file_parser.py | 158 | overlap: 重叠字符数 | deliberate | backend-docstring | n/a |
| 2710 | backend/app/utils/file_parser.py | 161 | 文本块列表 | deliberate | backend-docstring | n/a |
| 2711 | backend/app/utils/file_parser.py | 172 | # 尝试在句子边界处分割 | deliberate | backend-comment | n/a |
| 2712 | backend/app/utils/file_parser.py | 174 | # 查找最近的句子结束符 | deliberate | backend-comment | n/a |
| 2713 | backend/app/utils/file_parser.py | 185 | # 下一个块从重叠位置开始 | deliberate | backend-comment | n/a |
| 2714 | backend/app/utils/llm_client.py | 2 | LLM客户端封装 | deliberate | backend-docstring | n/a |
| 2715 | backend/app/utils/llm_client.py | 3 | 统一使用OpenAI格式调用 | deliberate | backend-docstring | n/a |
| 2716 | backend/app/utils/llm_client.py | 16 | """LLM客户端""" | deliberate | backend-docstring | n/a |
| 2717 | backend/app/utils/llm_client.py | 29 | raise ValueError("LLM_API_KEY 未配置") | review-needed | backend-string | n/a |
| 2718 | backend/app/utils/llm_client.py | 41 | 发送聊天请求 | deliberate | backend-docstring | n/a |
| 2719 | backend/app/utils/llm_client.py | 44 | messages: 消息列表 | deliberate | backend-docstring | n/a |
| 2720 | backend/app/utils/llm_client.py | 45 | temperature: 温度参数 | deliberate | backend-docstring | n/a |
| 2721 | backend/app/utils/llm_client.py | 46 | max_tokens: 最大token数 | deliberate | backend-docstring | n/a |
| 2722 | backend/app/utils/llm_client.py | 47 | response_format: 响应格式(如JSON模式) | deliberate | backend-docstring | n/a |
| 2723 | backend/app/utils/llm_client.py | 50 | 模型响应文本 | deliberate | backend-docstring | n/a |
| 2724 | backend/app/utils/llm_client.py | 64 | # 部分模型(如MiniMax M2.5)会在content中包含<think>思考内容,需要移除 | deliberate | backend-comment | n/a |
| 2725 | backend/app/utils/llm_client.py | 82 | # 清理markdown代码块标记 | deliberate | backend-comment | n/a |
| 2726 | backend/app/utils/llm_client.py | 93 | raise ValueError(f"LLM返回的JSON格式无效: {cleaned_response}") | review-needed | backend-string | n/a |
| 2727 | backend/app/utils/locale.py | 96 | return lang_config.get('llmInstruction', '请使用中文回答。') | review-needed | backend-string | n/a |
| 2728 | backend/app/utils/logger.py | 2 | 日志配置模块 | deliberate | backend-docstring | Logs |
| 2729 | backend/app/utils/logger.py | 3 | 提供统一的日志管理,同时输出到控制台和文件 | deliberate | backend-docstring | Logs |
| 2730 | backend/app/utils/logger.py | 15 | 确保 stdout/stderr 使用 UTF-8 编码 | deliberate | backend-docstring | Logs |
| 2731 | backend/app/utils/logger.py | 16 | 解决 Windows 控制台中文乱码问题 | deliberate | backend-docstring | Logs |
| 2732 | backend/app/utils/logger.py | 19 | # Windows 下重新配置标准输出为 UTF-8 | deliberate | backend-comment | Logs |
| 2733 | backend/app/utils/logger.py | 26 | # 日志目录 | deliberate | backend-comment | Logs |
| 2734 | backend/app/utils/logger.py | 32 | 设置日志器 | deliberate | backend-docstring | Logs |
| 2735 | backend/app/utils/logger.py | 35 | name: 日志器名称 | deliberate | backend-docstring | Logs |
| 2736 | backend/app/utils/logger.py | 36 | level: 日志级别 | deliberate | backend-docstring | Logs |
| 2737 | backend/app/utils/logger.py | 39 | 配置好的日志器 | deliberate | backend-docstring | Logs |
| 2738 | backend/app/utils/logger.py | 41 | # 确保日志目录存在 | deliberate | backend-comment | Logs |
| 2739 | backend/app/utils/logger.py | 44 | # 创建日志器 | deliberate | backend-comment | Logs |
| 2740 | backend/app/utils/logger.py | 48 | # 阻止日志向上传播到根 logger,避免重复输出 | deliberate | backend-comment | Logs |
| 2741 | backend/app/utils/logger.py | 51 | # 如果已经有处理器,不重复添加 | deliberate | backend-comment | Logs |
| 2742 | backend/app/utils/logger.py | 55 | # 日志格式 | deliberate | backend-comment | Logs |
| 2743 | backend/app/utils/logger.py | 66 | # 1. 文件处理器 - 详细日志(按日期命名,带轮转) | deliberate | backend-comment | Logs |
| 2744 | backend/app/utils/logger.py | 77 | # 2. 控制台处理器 - 简洁日志(INFO及以上) | deliberate | backend-comment | Logs |
| 2745 | backend/app/utils/logger.py | 78 | # 确保 Windows 下使用 UTF-8 编码,避免中文乱码 | deliberate | backend-comment | Logs |
| 2746 | backend/app/utils/logger.py | 84 | # 添加处理器 | deliberate | backend-comment | Logs |
| 2747 | backend/app/utils/logger.py | 93 | 获取日志器(如果不存在则创建) | deliberate | backend-docstring | Logs |
| 2748 | backend/app/utils/logger.py | 96 | name: 日志器名称 | deliberate | backend-docstring | Logs |
| 2749 | backend/app/utils/logger.py | 99 | 日志器实例 | deliberate | backend-docstring | Logs |
| 2750 | backend/app/utils/logger.py | 107 | # 创建默认日志器 | deliberate | backend-comment | Logs |
| 2751 | backend/app/utils/logger.py | 111 | # 便捷方法 | deliberate | backend-comment | Logs |
| 2752 | backend/app/utils/retry.py | 2 | API调用重试机制 | deliberate | backend-docstring | Logs |
| 2753 | backend/app/utils/retry.py | 3 | 用于处理LLM等外部API调用的重试逻辑 | deliberate | backend-docstring | Logs |
| 2754 | backend/app/utils/retry.py | 25 | 带指数退避的重试装饰器 | deliberate | backend-docstring | Logs |
| 2755 | backend/app/utils/retry.py | 28 | max_retries: 最大重试次数 | deliberate | backend-docstring | Logs |
| 2756 | backend/app/utils/retry.py | 29 | initial_delay: 初始延迟(秒) | deliberate | backend-docstring | Logs |
| 2757 | backend/app/utils/retry.py | 30 | max_delay: 最大延迟(秒) | deliberate | backend-docstring | Logs |
| 2758 | backend/app/utils/retry.py | 31 | backoff_factor: 退避因子 | deliberate | backend-docstring | Logs |
| 2759 | backend/app/utils/retry.py | 32 | jitter: 是否添加随机抖动 | deliberate | backend-docstring | Logs |
| 2760 | backend/app/utils/retry.py | 33 | exceptions: 需要重试的异常类型 | deliberate | backend-docstring | Logs |
| 2761 | backend/app/utils/retry.py | 34 | on_retry: 重试时的回调函数 (exception, retry_count) | deliberate | backend-docstring | Logs |
| 2762 | backend/app/utils/retry.py | 55 | logger.error(f"函数 {func.__name__} 在 {max_retries} 次重试后仍失败: {str(e)}") | gap | backend-log | Logs |
| 2763 | backend/app/utils/retry.py | 58 | # 计算延迟 | deliberate | backend-comment | Logs |
| 2764 | backend/app/utils/retry.py | 64 | f"函数 {func.__name__} 第 {attempt + 1} 次尝试失败: {str(e)}, " | review-needed | backend-string | Logs |
| 2765 | backend/app/utils/retry.py | 65 | f"{current_delay:.1f}秒后重试..." | review-needed | backend-string | Logs |
| 2766 | backend/app/utils/retry.py | 90 | 异步版本的重试装饰器 | deliberate | backend-docstring | Logs |
| 2767 | backend/app/utils/retry.py | 108 | logger.error(f"异步函数 {func.__name__} 在 {max_retries} 次重试后仍失败: {str(e)}") | gap | backend-log | Logs |
| 2768 | backend/app/utils/retry.py | 116 | f"异步函数 {func.__name__} 第 {attempt + 1} 次尝试失败: {str(e)}, " | review-needed | backend-string | Logs |
| 2769 | backend/app/utils/retry.py | 117 | f"{current_delay:.1f}秒后重试..." | review-needed | backend-string | Logs |
| 2770 | backend/app/utils/retry.py | 134 | 可重试的API客户端封装 | deliberate | backend-docstring | Logs |
| 2771 | backend/app/utils/retry.py | 157 | 执行函数调用并在失败时重试 | deliberate | backend-docstring | Logs |
| 2772 | backend/app/utils/retry.py | 160 | func: 要调用的函数 | deliberate | backend-docstring | Logs |
| 2773 | backend/app/utils/retry.py | 161 | *args: 函数参数 | deliberate | backend-docstring | Logs |
| 2774 | backend/app/utils/retry.py | 162 | exceptions: 需要重试的异常类型 | deliberate | backend-docstring | Logs |
| 2775 | backend/app/utils/retry.py | 163 | **kwargs: 函数关键字参数 | deliberate | backend-docstring | Logs |
| 2776 | backend/app/utils/retry.py | 166 | 函数返回值 | deliberate | backend-docstring | Logs |
| 2777 | backend/app/utils/retry.py | 179 | logger.error(f"API调用在 {self.max_retries} 次重试后仍失败: {str(e)}") | gap | backend-log | Logs |
| 2778 | backend/app/utils/retry.py | 186 | f"API调用第 {attempt + 1} 次尝试失败: {str(e)}, " | review-needed | backend-string | Logs |
| 2779 | backend/app/utils/retry.py | 187 | f"{current_delay:.1f}秒后重试..." | review-needed | backend-string | Logs |
| 2780 | backend/app/utils/retry.py | 203 | 批量调用并对每个失败项单独重试 | deliberate | backend-docstring | Logs |
| 2781 | backend/app/utils/retry.py | 206 | items: 要处理的项目列表 | deliberate | backend-docstring | Logs |
| 2782 | backend/app/utils/retry.py | 207 | process_func: 处理函数,接收单个item作为参数 | deliberate | backend-docstring | Logs |
| 2783 | backend/app/utils/retry.py | 208 | exceptions: 需要重试的异常类型 | deliberate | backend-docstring | Logs |
| 2784 | backend/app/utils/retry.py | 209 | continue_on_failure: 单项失败后是否继续处理其他项 | deliberate | backend-docstring | Logs |
| 2785 | backend/app/utils/retry.py | 212 | (成功结果列表, 失败项列表) | deliberate | backend-docstring | Logs |
| 2786 | backend/app/utils/retry.py | 227 | logger.error(f"处理第 {idx + 1} 项失败: {str(e)}") | gap | backend-log | Logs |
| 2787 | backend/app/utils/zep_paging.py | 1 | """Zep Graph 分页读取工具。 | deliberate | backend-docstring | n/a |
| 2788 | backend/app/utils/zep_paging.py | 3 | Zep 的 node/edge 列表接口使用 UUID cursor 分页, | deliberate | backend-docstring | n/a |
| 2789 | backend/app/utils/zep_paging.py | 4 | 本模块封装自动翻页逻辑(含单页重试),对调用方透明地返回完整列表。 | deliberate | backend-docstring | n/a |
| 2790 | backend/app/utils/zep_paging.py | 33 | """单页请求,失败时指数退避重试。自动处理429限速。""" | deliberate | backend-docstring | n/a |
| 2791 | backend/app/utils/zep_paging.py | 46 | # 检测429限速,使用retry-after头部指定的等待时间 | deliberate | backend-comment | n/a |
| 2792 | backend/app/utils/zep_paging.py | 68 | """分页获取图谱节点,最多返回 max_items 条(默认 2000)。每页请求自带重试。""" | deliberate | backend-docstring | n/a |
| 2793 | backend/app/utils/zep_paging.py | 113 | """分页获取图谱所有边,返回完整列表。每页请求自带重试。""" | deliberate | backend-docstring | n/a |
| 2794 | frontend/src/components/Step2EnvSetup.vue | 680 | if (newStage === '生成Agent人设' || newStage === 'generating_profiles') { | gap | frontend-ui-string | Env Setup |
| 2795 | frontend/src/components/Step2EnvSetup.vue | 682 | } else if (newStage === '生成模拟配置' || newStage === 'generating_config') { | gap | frontend-ui-string | Env Setup |
| 2796 | frontend/src/components/Step2EnvSetup.vue | 689 | } else if (newStage === '准备模拟脚本' || newStage === 'copying_scripts') { | gap | frontend-ui-string | Env Setup |
| 2797 | frontend/src/components/Step3Simulation.vue | 423 | startError.value = res.error || '启动失败' | gap | frontend-ui-string | Simulation |
| 2798 | frontend/src/components/Step4Report.vue | 555 | const queryMatch = text.match(/分析问题:\s*(.+?)(?:\n|$)/) | gap | frontend-regex-parser | Report |
| 2799 | frontend/src/components/Step4Report.vue | 559 | const reqMatch = text.match(/预测场景:\s*(.+?)(?:\n|$)/) | gap | frontend-regex-parser | Report |
| 2800 | frontend/src/components/Step4Report.vue | 562 | // Extract counters from the "相关预测事实: X条" format. | gap | frontend-ui-string | Report |
| 2801 | frontend/src/components/Step4Report.vue | 563 | const factMatch = text.match(/相关预测事实:\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2802 | frontend/src/components/Step4Report.vue | 564 | const entityMatch = text.match(/涉及实体:\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2803 | frontend/src/components/Step4Report.vue | 565 | const relMatch = text.match(/关系链:\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2804 | frontend/src/components/Step4Report.vue | 571 | const subQSection = text.match(/### 分析的子问题\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2805 | frontend/src/components/Step4Report.vue | 578 | const factsSection = text.match(/### 【关键事实】[\s\S]*?\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2806 | frontend/src/components/Step4Report.vue | 588 | const entitySection = text.match(/### 【核心实体】\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2807 | frontend/src/components/Step4Report.vue | 595 | const summaryMatch = block.match(/摘要:\s*"?(.+?)"?(?:\n|$)/) | gap | frontend-regex-parser | Report |
| 2808 | frontend/src/components/Step4Report.vue | 596 | const relatedMatch = block.match(/相关事实:\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2809 | frontend/src/components/Step4Report.vue | 607 | const relSection = text.match(/### 【关系链】\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2810 | frontend/src/components/Step4Report.vue | 636 | const queryMatch = text.match(/查询:\s*(.+?)(?:\n|$)/) | gap | frontend-regex-parser | Report |
| 2811 | frontend/src/components/Step4Report.vue | 640 | const nodesMatch = text.match(/总节点数:\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2812 | frontend/src/components/Step4Report.vue | 641 | const edgesMatch = text.match(/总边数:\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2813 | frontend/src/components/Step4Report.vue | 642 | const activeMatch = text.match(/当前有效事实:\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2814 | frontend/src/components/Step4Report.vue | 643 | const histMatch = text.match(/历史\/过期事实:\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2815 | frontend/src/components/Step4Report.vue | 650 | const activeSection = text.match(/### 【当前有效事实】[\s\S]*?\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2816 | frontend/src/components/Step4Report.vue | 661 | const histSection = text.match(/### 【历史\/过期事实】[\s\S]*?\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2817 | frontend/src/components/Step4Report.vue | 671 | const entitySection = text.match(/### 【涉及实体】\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2818 | frontend/src/components/Step4Report.vue | 700 | const topicMatch = text.match(/\*\*采访主题:\*\*\s*(.+?)(?:\n|$)/) | gap | frontend-regex-parser | Report |
| 2819 | frontend/src/components/Step4Report.vue | 703 | // Extract the interview-count line, e.g. "5 / 9 位模拟Agent". | gap | frontend-ui-string | Report |
| 2820 | frontend/src/components/Step4Report.vue | 704 | const countMatch = text.match(/\*\*采访人数:\*\*\s*(\d+)\s*\/\s*(\d+)/) | gap | frontend-regex-parser | Report |
| 2821 | frontend/src/components/Step4Report.vue | 712 | const reasonMatch = text.match(/### 采访对象选择理由\n([\s\S]*?)(?=\n---\n|\n### 采访实录)/) | gap | frontend-regex-parser | Report |
| 2822 | frontend/src/components/Step4Report.vue | 738 | // Format 2: "- 选择<name>(index <i>):<reason>" | gap | frontend-ui-string | Report |
| 2823 | frontend/src/components/Step4Report.vue | 740 | headerMatch = line.match(/^-\s*选择([^((]+)(?:[((]index\s*=?\s*\d+[))])?[::]\s*(.*)/) | gap | frontend-regex-parser | Report |
| 2824 | frontend/src/components/Step4Report.vue | 763 | } else if (currentName && line.trim() && !line.match(/^未选|^综上|^最终选择/)) { | gap | frontend-regex-parser | Report |
| 2825 | frontend/src/components/Step4Report.vue | 779 | const interviewBlocks = text.split(/#### 采访 #\d+:/).slice(1) | review-needed | frontend-other | Report |
| 2826 | frontend/src/components/Step4Report.vue | 795 | // Extract the title (e.g. "学生", "教育从业者"). | gap | frontend-ui-string | Report |
| 2827 | frontend/src/components/Step4Report.vue | 809 | const bioMatch = block.match(/_简介:\s*([\s\S]*?)_\n/) | gap | frontend-regex-parser | Report |
| 2828 | frontend/src/components/Step4Report.vue | 832 | const answerMatch = block.match(/\*\*A:\*\*\s*([\s\S]*?)(?=\*\*关键引言|$)/) | gap | frontend-regex-parser | Report |
| 2829 | frontend/src/components/Step4Report.vue | 837 | const twitterMatch = answerText.match(/【Twitter平台回答】\n?([\s\S]*?)(?=【Reddit平台回答】|$)/) | gap | frontend-regex-parser | Report |
| 2830 | frontend/src/components/Step4Report.vue | 838 | const redditMatch = answerText.match(/【Reddit平台回答】\n?([\s\S]*?)$/) | gap | frontend-regex-parser | Report |
| 2831 | frontend/src/components/Step4Report.vue | 850 | if (interview.redditAnswer && interview.redditAnswer !== '(该平台未获得回复)') { | gap | frontend-ui-string | Report |
| 2832 | frontend/src/components/Step4Report.vue | 854 | if (interview.twitterAnswer && interview.twitterAnswer !== '(该平台未获得回复)') { | gap | frontend-ui-string | Report |
| 2833 | frontend/src/components/Step4Report.vue | 864 | const quotesMatch = block.match(/\*\*关键引言:\*\*\n([\s\S]*?)(?=\n---|\n####|$)/) | gap | frontend-regex-parser | Report |
| 2834 | frontend/src/components/Step4Report.vue | 886 | const summaryMatch = text.match(/### 采访摘要与核心观点\n([\s\S]*?)$/) | gap | frontend-regex-parser | Report |
| 2835 | frontend/src/components/Step4Report.vue | 908 | const queryMatch = text.match(/搜索查询:\s*(.+?)(?:\n|$)/) | gap | frontend-regex-parser | Report |
| 2836 | frontend/src/components/Step4Report.vue | 912 | const countMatch = text.match(/找到\s*(\d+)\s*条/) | gap | frontend-regex-parser | Report |
| 2837 | frontend/src/components/Step4Report.vue | 916 | const factsSection = text.match(/### 相关事实:\n([\s\S]*)$/) | gap | frontend-regex-parser | Report |
| 2838 | frontend/src/components/Step4Report.vue | 923 | const edgesSection = text.match(/### 相关边:\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2839 | frontend/src/components/Step4Report.vue | 936 | const nodesSection = text.match(/### 相关节点:\n([\s\S]*?)(?=\n###|$)/) | gap | frontend-regex-parser | Report |
| 2840 | frontend/src/components/Step4Report.vue | 1325 | return t === '(该平台未获得回复)' || t === '(该平台未获得回复)' || t === '[无回复]' | gap | frontend-ui-string | Report |
| 2841 | frontend/src/components/Step4Report.vue | 1334 | // 1. "问题X:" / "问题X:" — the newer Chinese-style format from the backend. | gap | frontend-ui-string | Report |
| 2842 | frontend/src/components/Step4Report.vue | 1339 | // Try the "问题X:" form first. | gap | frontend-ui-string | Report |
| 2843 | frontend/src/components/Step4Report.vue | 1340 | const cnPattern = /(?:^|[\r\n]+)问题(\d+)[::]\s*/g | review-needed | frontend-other | Report |
| 2844 | frontend/src/components/Step4Report.vue | 1364 | .replace(/^问题\d+[::]\s*/, '') | review-needed | frontend-other | Report |
| 2845 | frontend/src/components/Step4Report.vue | 1464 | h('div', { class: 'reason-label' }, '选择理由'), | gap | frontend-ui-string | Report |
| 2846 | frontend/src/components/Step4Report.vue | 1774 | return steps[0] || { noLabel: '--', title: '等待开始', status: 'todo', meta: '' } | gap | frontend-ui-string | Report |
| 2847 | frontend/src/components/Step4Report.vue | 2005 | if (log.includes('ERROR') || log.includes('错误')) return 'error' | gap | frontend-ui-string | Report |
| 2848 | frontend/src/components/Step4Report.vue | 2006 | if (log.includes('WARNING') || log.includes('警告')) return 'warning' | gap | frontend-ui-string | Report |
| 2849 | frontend/src/components/Step4Report.vue | 2096 | // Look for content after the Chinese "最终答案:" marker. | gap | frontend-ui-string | Report |
| 2850 | frontend/src/components/Step4Report.vue | 2097 | const chineseFinalMatch = response.match(/最终答案[::]\s*\n*([\s\S]*)$/i) | gap | frontend-regex-parser | Report |
| 2851 | frontend/src/components/Step5Interaction.vue | 721 | .map(msg => `${msg.role === 'user' ? '提问者' : '你'}:${msg.content}`) | gap | frontend-ui-string | Interaction |
| 2852 | frontend/src/components/Step5Interaction.vue | 723 | prompt = `以下是我们之前的对话:\n${historyContext}\n\n现在我的新问题是:${message}` | gap | frontend-ui-string | Interaction |
| 2853 | frontend/src/views/Process.vue | 10 | <div class="step-name">图谱构建</div> | review-needed | frontend-other | UI |
| 2854 | frontend/src/views/Process.vue | 26 | <span class="header-title">实时知识图谱</span> | review-needed | frontend-other | UI |
| 2855 | frontend/src/views/Process.vue | 30 | <span class="stat-item">{{ graphData.node_count || graphData.nodes?.length || 0 }} 节点</span> | review-needed | frontend-other | UI |
| 2856 | frontend/src/views/Process.vue | 32 | <span class="stat-item">{{ graphData.edge_count || graphData.edges?.length || 0 }} 关系</span> | review-needed | frontend-other | UI |
| 2857 | frontend/src/views/Process.vue | 36 | <button class="action-btn" @click="refreshGraph" :disabled="graphLoading" title="刷新图谱"> | gap | frontend-ui-string | UI |
| 2858 | frontend/src/views/Process.vue | 39 | <button class="action-btn" @click="toggleFullScreen" :title="isFullScreen ? '退出全屏' : '全屏显示'"> | gap | frontend-ui-string | UI |
| 2859 | frontend/src/views/Process.vue | 53 | 实时更新中... | review-needed | frontend-other | UI |
| 2860 | frontend/src/views/Process.vue | 174 | <p class="loading-text">图谱数据加载中...</p> | review-needed | frontend-other | UI |
| 2861 | frontend/src/views/Process.vue | 192 | <p class="waiting-text">等待本体生成</p> | review-needed | frontend-other | UI |
| 2862 | frontend/src/views/Process.vue | 193 | <p class="waiting-hint">生成完成后将自动开始构建图谱</p> | review-needed | frontend-other | UI |
| 2863 | frontend/src/views/Process.vue | 203 | <p class="waiting-text">图谱构建中</p> | review-needed | frontend-other | UI |
| 2864 | frontend/src/views/Process.vue | 204 | <p class="waiting-hint">数据即将显示...</p> | review-needed | frontend-other | UI |
| 2865 | frontend/src/views/Process.vue | 228 | <span class="header-title">构建流程</span> | review-needed | frontend-other | UI |
| 2866 | frontend/src/views/Process.vue | 237 | <div class="phase-title">本体生成</div> | review-needed | frontend-other | UI |
| 2867 | frontend/src/views/Process.vue | 247 | <div class="detail-label">接口说明</div> | review-needed | frontend-other | UI |
| 2868 | frontend/src/views/Process.vue | 249 | 上传文档后,LLM分析文档内容,自动生成适合舆论模拟的本体结构(实体类型 + 关系类型) | review-needed | frontend-other | UI |
| 2869 | frontend/src/views/Process.vue | 255 | <div class="detail-label">生成进度</div> | review-needed | frontend-other | UI |
| 2870 | frontend/src/views/Process.vue | 264 | <div class="detail-label">生成的实体类型 ({{ projectData.ontology.entity_types?.length || 0 }})</div> | review-needed | frontend-other | UI |
| 2871 | frontend/src/views/Process.vue | 277 | <div class="detail-label">生成的关系类型 ({{ projectData.ontology.relation_types?.length || 0 }})</div> | review-needed | frontend-other | UI |
| 2872 | frontend/src/views/Process.vue | 291 | +{{ projectData.ontology.relation_types.length - 5 }} 更多关系... | review-needed | frontend-other | UI |
| 2873 | frontend/src/views/Process.vue | 298 | <div class="waiting-hint">等待本体生成...</div> | review-needed | frontend-other | UI |
| 2874 | frontend/src/views/Process.vue | 308 | <div class="phase-title">图谱构建</div> | review-needed | frontend-other | UI |
| 2875 | frontend/src/views/Process.vue | 318 | <div class="detail-label">接口说明</div> | review-needed | frontend-other | UI |
| 2876 | frontend/src/views/Process.vue | 320 | 基于生成的本体,将文档分块后调用 Zep API 构建知识图谱,提取实体和关系 | review-needed | frontend-other | UI |
| 2877 | frontend/src/views/Process.vue | 326 | <div class="waiting-hint">等待本体生成完成...</div> | review-needed | frontend-other | UI |
| 2878 | frontend/src/views/Process.vue | 331 | <div class="detail-label">构建进度</div> | review-needed | frontend-other | UI |
| 2879 | frontend/src/views/Process.vue | 342 | <div class="detail-label">构建结果</div> | review-needed | frontend-other | UI |
| 2880 | frontend/src/views/Process.vue | 346 | <span class="result-label">实体节点</span> | review-needed | frontend-other | UI |
| 2881 | frontend/src/views/Process.vue | 350 | <span class="result-label">关系边</span> | review-needed | frontend-other | UI |
| 2882 | frontend/src/views/Process.vue | 354 | <span class="result-label">实体类型</span> | review-needed | frontend-other | UI |
| 2883 | frontend/src/views/Process.vue | 366 | <div class="phase-title">构建完成</div> | review-needed | frontend-other | UI |
| 2884 | frontend/src/views/Process.vue | 367 | <div class="phase-api">准备进入下一步骤</div> | review-needed | frontend-other | UI |
| 2885 | frontend/src/views/Process.vue | 378 | 进入环境搭建 | review-needed | frontend-other | UI |
| 2886 | frontend/src/views/Process.vue | 388 | <span class="project-title">项目信息</span> | review-needed | frontend-other | UI |
| 2887 | frontend/src/views/Process.vue | 392 | <span class="item-label">项目名称</span> | review-needed | frontend-other | UI |
| 2888 | frontend/src/views/Process.vue | 396 | <span class="item-label">项目ID</span> | review-needed | frontend-other | UI |
| 2889 | frontend/src/views/Process.vue | 400 | <span class="item-label">图谱ID</span> | review-needed | frontend-other | UI |
| 2890 | frontend/src/views/Process.vue | 404 | <span class="item-label">模拟需求</span> | review-needed | frontend-other | UI |
| 2891 | frontend/src/views/Process.vue | 452 | if (error.value) return '构建失败' | gap | frontend-ui-string | UI |
| 2892 | frontend/src/views/Process.vue | 453 | if (currentPhase.value >= 2) return '构建完成' | gap | frontend-ui-string | UI |
| 2893 | frontend/src/views/Process.vue | 454 | if (currentPhase.value === 1) return '图谱构建中' | gap | frontend-ui-string | UI |
| 2894 | frontend/src/views/Process.vue | 455 | if (currentPhase.value === 0) return '本体生成中' | gap | frontend-ui-string | UI |
| 2895 | frontend/src/views/Process.vue | 456 | return '初始化中' | gap | frontend-ui-string | UI |
| 2896 | frontend/src/views/Process.vue | 482 | alert('环境搭建功能开发中...') | gap | frontend-ui-string | UI |
| 2897 | frontend/src/views/Process.vue | 536 | if (currentPhase.value > phase) return '已完成' | gap | frontend-ui-string | UI |
| 2898 | frontend/src/views/Process.vue | 541 | return '进行中' | gap | frontend-ui-string | UI |
| 2899 | frontend/src/views/Process.vue | 543 | return '等待中' | gap | frontend-ui-string | UI |
| 2900 | frontend/src/views/Process.vue | 563 | error.value = '没有待上传的文件,请返回首页重新操作' | gap | frontend-ui-string | UI |
| 2901 | frontend/src/views/Process.vue | 571 | ontologyProgress.value = { message: '正在上传文件并分析文档...' } | gap | frontend-ui-string | UI |
| 2902 | frontend/src/views/Process.vue | 598 | error.value = response.error || '本体生成失败' | gap | frontend-ui-string | UI |
| 2903 | frontend/src/views/Process.vue | 602 | error.value = '项目初始化失败: ' + (err.message || '未知错误') | gap | frontend-ui-string | UI |
| 2904 | frontend/src/views/Process.vue | 634 | error.value = response.error || '加载项目失败' | gap | frontend-ui-string | UI |
| 2905 | frontend/src/views/Process.vue | 638 | error.value = '加载项目失败: ' + (err.message || '未知错误') | gap | frontend-ui-string | UI |
| 2906 | frontend/src/views/Process.vue | 657 | error.value = projectData.value?.error || '处理失败' | gap | frontend-ui-string | UI |
| 2907 | frontend/src/views/Process.vue | 667 | message: '正在启动图谱构建...' | gap | frontend-ui-string | UI |
| 2908 | frontend/src/views/Process.vue | 673 | buildProgress.value.message = '图谱构建任务已启动...' | gap | frontend-ui-string | UI |
| 2909 | frontend/src/views/Process.vue | 681 | error.value = response.error || '启动图谱构建失败' | gap | frontend-ui-string | UI |
| 2910 | frontend/src/views/Process.vue | 686 | error.value = '启动图谱构建失败: ' + (err.message || '未知错误') | gap | frontend-ui-string | UI |
| 2911 | frontend/src/views/Process.vue | 763 | message: task.message || '处理中...' | gap | frontend-ui-string | UI |
| 2912 | frontend/src/views/Process.vue | 778 | message: '构建完成,正在加载图谱...' | gap | frontend-ui-string | UI |
| 2913 | frontend/src/views/Process.vue | 797 | error.value = '图谱构建失败: ' + (task.error || '未知错误') | gap | frontend-ui-string | UI |
| 2914 | frontend/src/views/Process.vue | 872 | .text('等待图谱数据...') | gap | frontend-ui-string | UI |
| 2915 | frontend/src/views/Process.vue | 884 | name: n.name || '未命名', | gap | frontend-ui-string | UI |
| 2916 | frontend/src/views/Process.vue | 900 | source_name: nodeMap[e.source_node_uuid]?.name || '未知', | gap | frontend-ui-string | UI |
| 2917 | frontend/src/views/Process.vue | 901 | target_name: nodeMap[e.target_node_uuid]?.name || '未知' | gap | frontend-ui-string | UI |