处理输入源(URL或文件)- 使用升级版智能体编排引擎
(self, input_source: str, input_type: str)
| 228 | return {"status": "error", "error": error_msg} |
| 229 | |
| 230 | async def process_input(self, input_source: str, input_type: str): |
| 231 | """处理输入源(URL或文件)- 使用升级版智能体编排引擎""" |
| 232 | try: |
| 233 | # Document segmentation configuration is managed by CLI interface |
| 234 | |
| 235 | self.cli.print_separator() |
| 236 | self.cli.print_status( |
| 237 | "🚀 Starting intelligent agent orchestration...", "processing" |
| 238 | ) |
| 239 | |
| 240 | # 显示处理阶段(根据配置决定) |
| 241 | chat_mode = input_type == "chat" |
| 242 | self.cli.display_processing_stages( |
| 243 | 0, self.cli.enable_indexing, chat_mode=chat_mode |
| 244 | ) |
| 245 | |
| 246 | # 使用工作流适配器进行处理 |
| 247 | result = await self.workflow_adapter.process_input_with_orchestration( |
| 248 | input_source=input_source, |
| 249 | input_type=input_type, |
| 250 | enable_indexing=self.cli.enable_indexing, |
| 251 | ) |
| 252 | |
| 253 | if result["status"] == "success": |
| 254 | # 显示完成状态 |
| 255 | if chat_mode: |
| 256 | final_stage = 4 |
| 257 | else: |
| 258 | final_stage = 8 if self.cli.enable_indexing else 5 |
| 259 | self.cli.display_processing_stages( |
| 260 | final_stage, self.cli.enable_indexing, chat_mode=chat_mode |
| 261 | ) |
| 262 | self.cli.print_status( |
| 263 | "🎉 Agent orchestration completed successfully!", "complete" |
| 264 | ) |
| 265 | |
| 266 | # 显示结果 |
| 267 | self.display_results( |
| 268 | result.get("analysis_result", ""), |
| 269 | result.get("download_result", ""), |
| 270 | result.get("repo_result", ""), |
| 271 | result.get("pipeline_mode", "comprehensive"), |
| 272 | ) |
| 273 | else: |
| 274 | self.cli.print_status( |
| 275 | f"❌ Processing failed: {result.get('error', 'Unknown error')}", |
| 276 | "error", |
| 277 | ) |
| 278 | |
| 279 | # 添加到历史记录 |
| 280 | self.cli.add_to_history(input_source, result) |
| 281 | |
| 282 | return result |
| 283 | |
| 284 | except Exception as e: |
| 285 | error_msg = str(e) |
| 286 | self.cli.print_error_box("Agent Orchestration Error", error_msg) |
| 287 | self.cli.print_status(f"Error during orchestration: {error_msg}", "error") |
no test coverage detected