fr-cli 2.4.0__tar.gz → 2.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. {fr_cli-2.4.0/fr_cli.egg-info → fr_cli-2.4.1}/PKG-INFO +86 -51
  2. {fr_cli-2.4.0 → fr_cli-2.4.1}/README.md +86 -51
  3. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/__init__.py +1 -1
  4. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/master.py +7 -1
  5. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/executor.py +16 -4
  6. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/conf/config.py +70 -31
  7. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/chat.py +28 -8
  8. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/core.py +55 -2
  9. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/llm.py +62 -22
  10. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/model_factory.py +119 -21
  11. fr_cli-2.4.1/fr_cli/core/stream.py +268 -0
  12. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/lang/translations/en.py +1 -1
  13. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/lang/translations/zh.py +1 -1
  14. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/main.py +9 -9
  15. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/memory/session.py +9 -3
  16. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/bootstrap.py +66 -27
  17. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/__init__.py +1 -0
  18. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/_common.py +3 -1
  19. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/base.py +73 -38
  20. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/config.py +145 -13
  21. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/session.py +24 -0
  22. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/router.py +2 -0
  23. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/ui/banner.py +6 -4
  24. fr_cli-2.4.1/fr_cli/ui/markdown.py +114 -0
  25. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/ui/prompt.py +6 -3
  26. fr_cli-2.4.1/fr_cli/ui/ui.py +64 -0
  27. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/ui/web_config.py +5 -0
  28. {fr_cli-2.4.0 → fr_cli-2.4.1/fr_cli.egg-info}/PKG-INFO +86 -51
  29. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli.egg-info/SOURCES.txt +1 -0
  30. {fr_cli-2.4.0 → fr_cli-2.4.1}/pyproject.toml +1 -1
  31. {fr_cli-2.4.0 → fr_cli-2.4.1}/tests/test_a2a_and_providers.py +26 -0
  32. {fr_cli-2.4.0 → fr_cli-2.4.1}/tests/test_integration_real.py +2 -2
  33. {fr_cli-2.4.0 → fr_cli-2.4.1}/tests/test_model_config.py +3 -2
  34. {fr_cli-2.4.0 → fr_cli-2.4.1}/tests/test_new_providers.py +106 -2
  35. fr_cli-2.4.0/fr_cli/core/stream.py +0 -151
  36. fr_cli-2.4.0/fr_cli/ui/ui.py +0 -117
  37. {fr_cli-2.4.0 → fr_cli-2.4.1}/LICENSE +0 -0
  38. {fr_cli-2.4.0 → fr_cli-2.4.1}/MANIFEST.in +0 -0
  39. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/README.md +0 -0
  40. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/WEAPON.MD +0 -0
  41. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/addon/plugin.py +0 -0
  42. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/__init__.py +0 -0
  43. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/a2a.py +0 -0
  44. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/acp.py +0 -0
  45. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/artifact_detector.py +0 -0
  46. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/__init__.py +0 -0
  47. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/_utils.py +0 -0
  48. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/db.py +0 -0
  49. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/local.py +0 -0
  50. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/powerful_agent_template.py +0 -0
  51. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/rag.py +0 -0
  52. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/rag_watcher_daemon.py +0 -0
  53. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/remote.py +0 -0
  54. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/builtins/spider.py +0 -0
  55. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/client.py +0 -0
  56. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/coding_helper.py +0 -0
  57. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/context_files.py +0 -0
  58. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/executor.py +0 -0
  59. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/gateway.py +0 -0
  60. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/generator.py +0 -0
  61. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/hermes.py +0 -0
  62. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/hermes_daemon.py +0 -0
  63. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/image_and_parallel.py +0 -0
  64. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/manager.py +0 -0
  65. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/master_prompt.py +0 -0
  66. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/personality.py +0 -0
  67. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/plugin_system.py +0 -0
  68. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/remote.py +0 -0
  69. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/server.py +0 -0
  70. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/shell_mode.py +0 -0
  71. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/skills.py +0 -0
  72. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow.py +0 -0
  73. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow_system/__init__.py +0 -0
  74. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow_system/engine.py +0 -0
  75. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow_system/executor.py +0 -0
  76. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow_system/manager.py +0 -0
  77. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow_system/models.py +0 -0
  78. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow_system/monitor.py +0 -0
  79. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow_system/tools.py +0 -0
  80. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/agent/workflow_system.py +0 -0
  81. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/assets/splash.jpeg +0 -0
  82. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/breakthrough/update.py +0 -0
  83. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/__init__.py +0 -0
  84. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/__init__.py +0 -0
  85. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/agent.py +0 -0
  86. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/app.py +0 -0
  87. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/config.py +0 -0
  88. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/cron.py +0 -0
  89. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/dataframe.py +0 -0
  90. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/disk.py +0 -0
  91. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/fs.py +0 -0
  92. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/mail.py +0 -0
  93. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/mcp.py +0 -0
  94. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/other.py +0 -0
  95. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/session.py +0 -0
  96. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/system.py +0 -0
  97. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/vision.py +0 -0
  98. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/handlers/web.py +0 -0
  99. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/registered/agent_data_mcp.py +0 -0
  100. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/registered/fs.py +0 -0
  101. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/registered/image.py +0 -0
  102. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/registered/main_routes.py +0 -0
  103. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/registered/services.py +0 -0
  104. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/registered/session_config.py +0 -0
  105. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/registered/web.py +0 -0
  106. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/registry.py +0 -0
  107. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/command/security.py +0 -0
  108. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/conf/__init__.py +0 -0
  109. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/conf/paths.py +0 -0
  110. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/conf/wizard.py +0 -0
  111. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/cache.py +0 -0
  112. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/errors.py +0 -0
  113. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/intent.py +0 -0
  114. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/optimizations.py +0 -0
  115. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/preferences.py +0 -0
  116. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/project.py +0 -0
  117. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/recommender.py +0 -0
  118. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/sysmon.py +0 -0
  119. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/core/thinking.py +0 -0
  120. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/gatekeeper/__init__.py +0 -0
  121. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/gatekeeper/daemon.py +0 -0
  122. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/gatekeeper/manager.py +0 -0
  123. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/lang/i18n.py +0 -0
  124. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/lang/translations/__init__.py +0 -0
  125. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/memory/context.py +0 -0
  126. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/memory/history.py +0 -0
  127. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/__init__.py +0 -0
  128. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/actions.py +0 -0
  129. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/agent.py +0 -0
  130. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/cron.py +0 -0
  131. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/dataframe.py +0 -0
  132. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/dev.py +0 -0
  133. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/fs.py +0 -0
  134. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/mcp.py +0 -0
  135. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/rag.py +0 -0
  136. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/remote_agent.py +0 -0
  137. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands/system.py +0 -0
  138. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/commands.py +0 -0
  139. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/queue.py +0 -0
  140. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/quick_actions.py +0 -0
  141. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/repl/scenarios.py +0 -0
  142. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/security/security.py +0 -0
  143. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/ui/buddha.py +0 -0
  144. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/ui/splash.py +0 -0
  145. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/cron.py +0 -0
  146. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/dataframe.py +0 -0
  147. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/disk.py +0 -0
  148. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/fs.py +0 -0
  149. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/launcher.py +0 -0
  150. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/loader.py +0 -0
  151. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/mail.py +0 -0
  152. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/mcp.py +0 -0
  153. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/vision.py +0 -0
  154. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli/weapon/web.py +0 -0
  155. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli.egg-info/dependency_links.txt +0 -0
  156. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli.egg-info/entry_points.txt +0 -0
  157. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli.egg-info/requires.txt +0 -0
  158. {fr_cli-2.4.0 → fr_cli-2.4.1}/fr_cli.egg-info/top_level.txt +0 -0
  159. {fr_cli-2.4.0 → fr_cli-2.4.1}/setup.cfg +0 -0
  160. {fr_cli-2.4.0 → fr_cli-2.4.1}/tests/test_master_prompt_fix.py +0 -0
  161. {fr_cli-2.4.0 → fr_cli-2.4.1}/tests/test_new_features.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fr-cli
3
- Version: 2.4.0
3
+ Version: 2.4.1
4
4
  Summary: 凡人打字机 - 支持多模型(Zhipu/DeepSeek/Kimi/Qwen/StepFun/MiniMax/Spark/Doubao/MiMo)的终极全能终端工具
5
5
  Author: FANREN CLI Author
6
6
  License-Expression: MIT
@@ -84,6 +84,7 @@ Dynamic: license-file
84
84
  支持以下 AI 模型提供商:
85
85
  - **智谱 AI**: GLM-4-Flash 等
86
86
  - **智谱 Coding Plan**: GLM-4.7 等 (https://docs.bigmodel.cn/cn/coding-plan/quick-start)
87
+ - **OpenAI**: GPT-4o / GPT-4o-mini / o1-mini / o3-mini 等(标准 OpenAI 接口)
87
88
  - **DeepSeek**: DeepSeek-Chat 等
88
89
  - **Kimi (Moonshot)**: moonshot-v1-8k 等
89
90
  - **Kimi K2**: 代码优化版 kimi-k2-0905-preview
@@ -122,6 +123,7 @@ Dynamic: license-file
122
123
  - **MCP 外部神通**:支持 Model Context Protocol
123
124
  - **多源信息融合**:大模型 + 工具结果统一汇总
124
125
  - **中英文切换**:完整国际化支持
126
+ - **NO_COLOR 支持**:`NO_COLOR=1` 禁用所有 ANSI 颜色,适合 CI/管道环境
125
127
 
126
128
  ## 🚀 快速开始
127
129
 
@@ -135,10 +137,10 @@ fr-cli
135
137
  # 或从源码运行
136
138
  cd fr-cli
137
139
  pip install -e .
138
- python3 main.py
140
+ fr-cli
139
141
  ```
140
142
 
141
- 首次运行会引导输入当前道统的 API Key
143
+ 首次运行会引导输入当前道统的 API Key。直接回车可进入 Mock 模式试用。
142
144
 
143
145
  ## 📝 使用方法
144
146
 
@@ -155,11 +157,16 @@ python3 main.py
155
157
  /load 加载历史会话
156
158
  /export 导出会话为 Markdown
157
159
 
158
- /model <模型名> 切换AI模型
160
+ /model <模型名> 切换AI模型(仅当前会话生效)
159
161
  /model <道统>:<模型名> 同时切换道统和模型
162
+ /model config 🆕 交互式模型配置向导
163
+ /model list 列出所有可用模型
164
+ /model current 显示当前模型
165
+ /model default 恢复 factory 默认模型
160
166
  /key <key> 修改当前道统 API Key
161
167
  /key <道统> <key> 为指定道统设置 Key
162
168
  /providers 查看所有道统配置
169
+ /providers setup 交互式配置向导
163
170
  /providers add <p> <k> [m] 添加/更新道统配置
164
171
  /providers use <p> 切换到指定道统
165
172
 
@@ -173,23 +180,24 @@ python3 main.py
173
180
  /exit 退出
174
181
  ```
175
182
 
176
- ### 🤖 AI 模型切换示例
183
+ ### 🤖 AI 模型配置
177
184
 
178
- ```
179
- # 使用 Kimi K2(代码优化版)
180
- /model kimi-k2
185
+ ```bash
186
+ # 交互式配置向导(推荐)
187
+ >>> /model config
181
188
 
182
- # 使用 MiniMax M2.7(Token Plan)
183
- /model minimax-m27
189
+ # 直接切换(仅当前会话生效,重启后恢复 factory 默认)
190
+ >>> /model deepseek-chat
191
+ >>> /model deepseek:deepseek-reasoner
184
192
 
185
- # 使用 Step-3(阶跃星辰)
186
- /model step-3
193
+ # 查看当前模型
194
+ >>> /model current
187
195
 
188
- # 使用 Kimi Code
189
- /model kimi-code
196
+ # 恢复 factory 默认模型
197
+ >>> /model default
190
198
 
191
199
  # 配置新的 API Key
192
- /providers add step-3 <your-api-key>
200
+ >>> /providers add step-3 <your-api-key>
193
201
  ```
194
202
 
195
203
  ### 🔧 Agent 管理
@@ -306,30 +314,33 @@ fr acp
306
314
 
307
315
  ## 🤖 支持的模型提供商(25+)
308
316
 
309
- | 道统 | 默认模型 | API 地址 |
310
- |------|---------|----------|
311
- | zhipu | glm-4-flash | - |
312
- | zhipu-coding | GLM-4.7 | open.bigmodel.cn/api/coding/paas/v4 |
313
- | zhipu-anthropic | glm-4.6 | open.bigmodel.cn/api/anthropic |
314
- | deepseek | deepseek-chat | api.deepseek.com |
315
- | kimi | moonshot-v1-8k | api.moonshot.cn |
316
- | kimi-k2 | kimi-k2-0905-preview | api.moonshot.cn |
317
- | kimi-code | kimi-for-coding | api.kimi.com/coding/v1 |
318
- | qwen | qwen-turbo | dashscope.aliyuncs.com |
319
- | stepfun | step-1-8k | api.stepfun.com |
320
- | step-1 | step-1-8k | api.stepfun.com |
321
- | step-2 | step-2-16k | api.stepfun.com |
322
- | step-3 | step-3-auto | api.stepfun.com |
323
- | step-audio | step-audio-2 | api.stepfun.com |
324
- | minimax | MiniMax-Text-01 | api.minimax.chat |
325
- | minimax-m27 | MiniMax-M2.7 | api.minimax.chat |
326
- | minimax-m27-fast | MiniMax-M2.7-HighSpeed | api.minimax.chat |
327
- | minimax-token-plan | MiniMax-M2.7 | api.minimax.chat |
328
- | spark | generalv3.5 | spark-api-open.xf-yun.com |
329
- | doubao | doubao-1-5-pro-32k-250115 | ark.cn-beijing.volces.com |
330
- | mimo | mimo-v2-flash | api.xiaomimimo.com |
331
- | longcat | LongCat-Flash-Chat | api.longcat.chat/openai |
332
- | longcat-anthropic | LongCat | api.longcat.chat/anthropic |
317
+ | 道统 | 默认模型 | API 地址 | 常用模型 |
318
+ |------|---------|----------|---------|
319
+ | zhipu | glm-4-flash | open.bigmodel.cn/api/paas/v4 | glm-4-flash, glm-4-plus, glm-4, glm-4v-plus, glm-4-air, glm-4-long |
320
+ | zhipu-coding | GLM-4.7 | open.bigmodel.cn/api/coding/paas/v4 (Coding Plan) | GLM-4.7, GLM-5.1, GLM-4.5-air |
321
+ | zhipu-anthropic | glm-4.6 | open.bigmodel.cn/api/anthropic | glm-4.6 |
322
+ | openai | gpt-4o-mini | api.openai.com/v1 | gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1-mini, o3-mini |
323
+ | deepseek | deepseek-chat | api.deepseek.com | deepseek-chat, deepseek-reasoner, deepseek-coder |
324
+ | kimi | moonshot-v1-8k | api.moonshot.cn | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
325
+ | kimi-k2 | kimi-k2-0905-preview | api.moonshot.cn | kimi-k2-0905-preview |
326
+ | kimi-code | kimi-for-coding | api.kimi.com/coding/v1 | kimi-for-coding |
327
+ | qwen | qwen-turbo | dashscope.aliyuncs.com | qwen-turbo, qwen-plus, qwen-max, qwen-coder-plus |
328
+ | stepfun | step-1-8k | api.stepfun.com (api.stepfun.com/step_plan/v1 for Step Plan) | step-1-8k, step-1-32k, step-2-16k, step-3-auto |
329
+ | step-1 | step-1-8k | api.stepfun.com | step-1-8k |
330
+ | step-2 | step-2-16k | api.stepfun.com | step-2-16k |
331
+ | step-3 | step-3-auto | api.stepfun.com | step-3-auto |
332
+ | step-audio | step-audio-2 | api.stepfun.com | step-audio-2 |
333
+ | stepfun-step-plan | step-3-auto | api.stepfun.com/step_plan/v1 (Step Plan) | step-3-auto, step-2-16k, step-1-8k |
334
+ | minimax | MiniMax-Text-01 | api.minimax.io (api.minimax.chat for Token Plan) | MiniMax-Text-01, MiniMax-M2.1, abab6.5s-chat, abab6.5t-chat |
335
+ | minimax-m27 | MiniMax-M2.7 | api.minimax.chat (Token Plan) | MiniMax-M2.7 |
336
+ | minimax-m27-fast | MiniMax-M2.7-HighSpeed | api.minimax.chat (Token Plan) | MiniMax-M2.7-HighSpeed |
337
+ | minimax-token-plan | MiniMax-M2.7 | api.minimax.chat (Token Plan) | MiniMax-M2.7 |
338
+ | spark | generalv3.5 | spark-api-open.xf-yun.com | generalv3.5 |
339
+ | doubao | doubao-1-5-pro-32k-250115 | ark.cn-beijing.volces.com | doubao-1-5-pro-32k, doubao-1-5-lite-32k |
340
+ | mimo | mimo-v2-flash | api.xiaomimimo.com | mimo-v2-flash, mimo-v2-pro |
341
+ | mimo-token-plan | mimo-v2-flash | token-plan-sgp.xiaomimimo.com (Token Plan) | mimo-v2-flash, mimo-v2-pro |
342
+ | longcat | LongCat-Flash-Chat | api.longcat.chat/openai | LongCat-Flash-Chat |
343
+ | longcat-anthropic | LongCat | api.longcat.chat/anthropic | LongCat |
333
344
 
334
345
  ## 🔧 开发
335
346
 
@@ -345,9 +356,17 @@ pip install -e ".[all]"
345
356
  python3 -m pytest tests/ -v
346
357
 
347
358
  # 运行程序
348
- python3 main.py
359
+ fr-cli
349
360
  ```
350
361
 
362
+ ### 环境变量
363
+
364
+ | 变量 | 说明 |
365
+ |------|------|
366
+ | `NO_COLOR=1` | 禁用所有 ANSI 颜色输出,适合 CI/管道/日志重定向 |
367
+ | `FR_CLI_DEBUG=1` | 开启调试模式,显示详细 traceback |
368
+ | `FR_CLI_NON_INTERACTIVE=1` | 非交互模式,安全确认默认拒绝 |
369
+
351
370
  ## 📂 项目结构
352
371
 
353
372
  ```
@@ -358,7 +377,8 @@ fr_cli/
358
377
  │ ├── master.py # MasterAgent 主控
359
378
  │ └── ...
360
379
  ├── core/ # 核心模块
361
- └── llm.py # LLM 客户端(20+ 提供商)
380
+ ├── llm.py # LLM 客户端(20+ 提供商)
381
+ │ └── model_factory.py # 模型工厂配置
362
382
  ├── weapon/ # 武器库
363
383
  ├── memory/ # 记忆系统
364
384
  └── lang/ # 国际化
@@ -370,18 +390,21 @@ fr_cli/
370
390
 
371
391
  ## 📂 配置目录
372
392
 
393
+ > 配置统一在 `~/.fr_cli/` 目录下,旧路径 `~/.zhipu_cli_config.json` 等会在首次启动时自动迁移。
394
+
373
395
  | 路径 | 说明 |
374
396
  |------|------|
375
- | `~/.zhipu_cli_config.json` | 主配置文件 |
376
- | `~/.zhipu_cli_history/` | 会话历史记录 |
377
- | `~/.zhipu_cli_plugins/` | 用户插件目录 |
378
- | `~/.zhipu_cli_context.json` | 上下文记忆 |
379
- | `~/.fr_cli_agents/` | Agent 分身目录 |
380
- | `~/.fr_cli_sessions/` | 按日期自动存档的会话 |
381
- | `~/.fr_cli_master/` | MasterAgent 记忆与进化记录 |
382
- | `~/.fr_cli_remotes.json` | 远程主机配置 |
383
- | `~/.fr_cli_databases.json` | 数据库连接配置 |
384
- | `~/.fr_cli_rag_db/` | RAG 向量库(ChromaDB)|
397
+ | `~/.fr_cli/config.json` | 主配置文件(统一配置目录) |
398
+ | `~/.fr_cli/config.json.bak` | 配置自动备份 |
399
+ | `~/.fr_cli/history/` | 会话历史记录 |
400
+ | `~/.fr_cli/context.json` | 上下文记忆 |
401
+ | `~/.fr_cli/sessions/` | 按日期自动存档的会话 |
402
+ | `~/.fr_cli/plugins/` | 用户插件目录 |
403
+ | `~/.fr_cli/agents/` | Agent 分身目录 |
404
+ | `~/.fr_cli/master/` | MasterAgent 记忆与进化记录 |
405
+ | `~/.fr_cli/remotes.json` | 远程主机配置 |
406
+ | `~/.fr_cli/databases.json` | 数据库连接配置 |
407
+ | `~/.fr_cli/rag_db/` | RAG 向量库(ChromaDB)|
385
408
 
386
409
  ## ❓ 常见问题
387
410
 
@@ -393,6 +416,18 @@ fr_cli/
393
416
  /mode react # ReAct
394
417
  ```
395
418
 
419
+ **Q: 模型切换后重启又变回去了?**
420
+ 这是预期行为。fr-cli 每次启动从 `model_factory.py` 的工厂配置读取默认模型,`/model` 切换仅当前会话生效。如需持久化切换默认模型,可修改 `fr_cli/core/model_factory.py` 中的默认模型,或使用 `/providers setup` 交互式配置向导。
421
+
422
+ **Q: 如何配置模型?**
423
+ ```bash
424
+ # 推荐:交互式向导
425
+ /model config
426
+
427
+ # 或
428
+ /providers setup
429
+ ```
430
+
396
431
  **Q: 如何保存会话?**
397
432
  ```bash
398
433
  /save my-session
@@ -10,6 +10,7 @@
10
10
  支持以下 AI 模型提供商:
11
11
  - **智谱 AI**: GLM-4-Flash 等
12
12
  - **智谱 Coding Plan**: GLM-4.7 等 (https://docs.bigmodel.cn/cn/coding-plan/quick-start)
13
+ - **OpenAI**: GPT-4o / GPT-4o-mini / o1-mini / o3-mini 等(标准 OpenAI 接口)
13
14
  - **DeepSeek**: DeepSeek-Chat 等
14
15
  - **Kimi (Moonshot)**: moonshot-v1-8k 等
15
16
  - **Kimi K2**: 代码优化版 kimi-k2-0905-preview
@@ -48,6 +49,7 @@
48
49
  - **MCP 外部神通**:支持 Model Context Protocol
49
50
  - **多源信息融合**:大模型 + 工具结果统一汇总
50
51
  - **中英文切换**:完整国际化支持
52
+ - **NO_COLOR 支持**:`NO_COLOR=1` 禁用所有 ANSI 颜色,适合 CI/管道环境
51
53
 
52
54
  ## 🚀 快速开始
53
55
 
@@ -61,10 +63,10 @@ fr-cli
61
63
  # 或从源码运行
62
64
  cd fr-cli
63
65
  pip install -e .
64
- python3 main.py
66
+ fr-cli
65
67
  ```
66
68
 
67
- 首次运行会引导输入当前道统的 API Key
69
+ 首次运行会引导输入当前道统的 API Key。直接回车可进入 Mock 模式试用。
68
70
 
69
71
  ## 📝 使用方法
70
72
 
@@ -81,11 +83,16 @@ python3 main.py
81
83
  /load 加载历史会话
82
84
  /export 导出会话为 Markdown
83
85
 
84
- /model <模型名> 切换AI模型
86
+ /model <模型名> 切换AI模型(仅当前会话生效)
85
87
  /model <道统>:<模型名> 同时切换道统和模型
88
+ /model config 🆕 交互式模型配置向导
89
+ /model list 列出所有可用模型
90
+ /model current 显示当前模型
91
+ /model default 恢复 factory 默认模型
86
92
  /key <key> 修改当前道统 API Key
87
93
  /key <道统> <key> 为指定道统设置 Key
88
94
  /providers 查看所有道统配置
95
+ /providers setup 交互式配置向导
89
96
  /providers add <p> <k> [m] 添加/更新道统配置
90
97
  /providers use <p> 切换到指定道统
91
98
 
@@ -99,23 +106,24 @@ python3 main.py
99
106
  /exit 退出
100
107
  ```
101
108
 
102
- ### 🤖 AI 模型切换示例
109
+ ### 🤖 AI 模型配置
103
110
 
104
- ```
105
- # 使用 Kimi K2(代码优化版)
106
- /model kimi-k2
111
+ ```bash
112
+ # 交互式配置向导(推荐)
113
+ >>> /model config
107
114
 
108
- # 使用 MiniMax M2.7(Token Plan)
109
- /model minimax-m27
115
+ # 直接切换(仅当前会话生效,重启后恢复 factory 默认)
116
+ >>> /model deepseek-chat
117
+ >>> /model deepseek:deepseek-reasoner
110
118
 
111
- # 使用 Step-3(阶跃星辰)
112
- /model step-3
119
+ # 查看当前模型
120
+ >>> /model current
113
121
 
114
- # 使用 Kimi Code
115
- /model kimi-code
122
+ # 恢复 factory 默认模型
123
+ >>> /model default
116
124
 
117
125
  # 配置新的 API Key
118
- /providers add step-3 <your-api-key>
126
+ >>> /providers add step-3 <your-api-key>
119
127
  ```
120
128
 
121
129
  ### 🔧 Agent 管理
@@ -232,30 +240,33 @@ fr acp
232
240
 
233
241
  ## 🤖 支持的模型提供商(25+)
234
242
 
235
- | 道统 | 默认模型 | API 地址 |
236
- |------|---------|----------|
237
- | zhipu | glm-4-flash | - |
238
- | zhipu-coding | GLM-4.7 | open.bigmodel.cn/api/coding/paas/v4 |
239
- | zhipu-anthropic | glm-4.6 | open.bigmodel.cn/api/anthropic |
240
- | deepseek | deepseek-chat | api.deepseek.com |
241
- | kimi | moonshot-v1-8k | api.moonshot.cn |
242
- | kimi-k2 | kimi-k2-0905-preview | api.moonshot.cn |
243
- | kimi-code | kimi-for-coding | api.kimi.com/coding/v1 |
244
- | qwen | qwen-turbo | dashscope.aliyuncs.com |
245
- | stepfun | step-1-8k | api.stepfun.com |
246
- | step-1 | step-1-8k | api.stepfun.com |
247
- | step-2 | step-2-16k | api.stepfun.com |
248
- | step-3 | step-3-auto | api.stepfun.com |
249
- | step-audio | step-audio-2 | api.stepfun.com |
250
- | minimax | MiniMax-Text-01 | api.minimax.chat |
251
- | minimax-m27 | MiniMax-M2.7 | api.minimax.chat |
252
- | minimax-m27-fast | MiniMax-M2.7-HighSpeed | api.minimax.chat |
253
- | minimax-token-plan | MiniMax-M2.7 | api.minimax.chat |
254
- | spark | generalv3.5 | spark-api-open.xf-yun.com |
255
- | doubao | doubao-1-5-pro-32k-250115 | ark.cn-beijing.volces.com |
256
- | mimo | mimo-v2-flash | api.xiaomimimo.com |
257
- | longcat | LongCat-Flash-Chat | api.longcat.chat/openai |
258
- | longcat-anthropic | LongCat | api.longcat.chat/anthropic |
243
+ | 道统 | 默认模型 | API 地址 | 常用模型 |
244
+ |------|---------|----------|---------|
245
+ | zhipu | glm-4-flash | open.bigmodel.cn/api/paas/v4 | glm-4-flash, glm-4-plus, glm-4, glm-4v-plus, glm-4-air, glm-4-long |
246
+ | zhipu-coding | GLM-4.7 | open.bigmodel.cn/api/coding/paas/v4 (Coding Plan) | GLM-4.7, GLM-5.1, GLM-4.5-air |
247
+ | zhipu-anthropic | glm-4.6 | open.bigmodel.cn/api/anthropic | glm-4.6 |
248
+ | openai | gpt-4o-mini | api.openai.com/v1 | gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1-mini, o3-mini |
249
+ | deepseek | deepseek-chat | api.deepseek.com | deepseek-chat, deepseek-reasoner, deepseek-coder |
250
+ | kimi | moonshot-v1-8k | api.moonshot.cn | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
251
+ | kimi-k2 | kimi-k2-0905-preview | api.moonshot.cn | kimi-k2-0905-preview |
252
+ | kimi-code | kimi-for-coding | api.kimi.com/coding/v1 | kimi-for-coding |
253
+ | qwen | qwen-turbo | dashscope.aliyuncs.com | qwen-turbo, qwen-plus, qwen-max, qwen-coder-plus |
254
+ | stepfun | step-1-8k | api.stepfun.com (api.stepfun.com/step_plan/v1 for Step Plan) | step-1-8k, step-1-32k, step-2-16k, step-3-auto |
255
+ | step-1 | step-1-8k | api.stepfun.com | step-1-8k |
256
+ | step-2 | step-2-16k | api.stepfun.com | step-2-16k |
257
+ | step-3 | step-3-auto | api.stepfun.com | step-3-auto |
258
+ | step-audio | step-audio-2 | api.stepfun.com | step-audio-2 |
259
+ | stepfun-step-plan | step-3-auto | api.stepfun.com/step_plan/v1 (Step Plan) | step-3-auto, step-2-16k, step-1-8k |
260
+ | minimax | MiniMax-Text-01 | api.minimax.io (api.minimax.chat for Token Plan) | MiniMax-Text-01, MiniMax-M2.1, abab6.5s-chat, abab6.5t-chat |
261
+ | minimax-m27 | MiniMax-M2.7 | api.minimax.chat (Token Plan) | MiniMax-M2.7 |
262
+ | minimax-m27-fast | MiniMax-M2.7-HighSpeed | api.minimax.chat (Token Plan) | MiniMax-M2.7-HighSpeed |
263
+ | minimax-token-plan | MiniMax-M2.7 | api.minimax.chat (Token Plan) | MiniMax-M2.7 |
264
+ | spark | generalv3.5 | spark-api-open.xf-yun.com | generalv3.5 |
265
+ | doubao | doubao-1-5-pro-32k-250115 | ark.cn-beijing.volces.com | doubao-1-5-pro-32k, doubao-1-5-lite-32k |
266
+ | mimo | mimo-v2-flash | api.xiaomimimo.com | mimo-v2-flash, mimo-v2-pro |
267
+ | mimo-token-plan | mimo-v2-flash | token-plan-sgp.xiaomimimo.com (Token Plan) | mimo-v2-flash, mimo-v2-pro |
268
+ | longcat | LongCat-Flash-Chat | api.longcat.chat/openai | LongCat-Flash-Chat |
269
+ | longcat-anthropic | LongCat | api.longcat.chat/anthropic | LongCat |
259
270
 
260
271
  ## 🔧 开发
261
272
 
@@ -271,9 +282,17 @@ pip install -e ".[all]"
271
282
  python3 -m pytest tests/ -v
272
283
 
273
284
  # 运行程序
274
- python3 main.py
285
+ fr-cli
275
286
  ```
276
287
 
288
+ ### 环境变量
289
+
290
+ | 变量 | 说明 |
291
+ |------|------|
292
+ | `NO_COLOR=1` | 禁用所有 ANSI 颜色输出,适合 CI/管道/日志重定向 |
293
+ | `FR_CLI_DEBUG=1` | 开启调试模式,显示详细 traceback |
294
+ | `FR_CLI_NON_INTERACTIVE=1` | 非交互模式,安全确认默认拒绝 |
295
+
277
296
  ## 📂 项目结构
278
297
 
279
298
  ```
@@ -284,7 +303,8 @@ fr_cli/
284
303
  │ ├── master.py # MasterAgent 主控
285
304
  │ └── ...
286
305
  ├── core/ # 核心模块
287
- └── llm.py # LLM 客户端(20+ 提供商)
306
+ ├── llm.py # LLM 客户端(20+ 提供商)
307
+ │ └── model_factory.py # 模型工厂配置
288
308
  ├── weapon/ # 武器库
289
309
  ├── memory/ # 记忆系统
290
310
  └── lang/ # 国际化
@@ -296,18 +316,21 @@ fr_cli/
296
316
 
297
317
  ## 📂 配置目录
298
318
 
319
+ > 配置统一在 `~/.fr_cli/` 目录下,旧路径 `~/.zhipu_cli_config.json` 等会在首次启动时自动迁移。
320
+
299
321
  | 路径 | 说明 |
300
322
  |------|------|
301
- | `~/.zhipu_cli_config.json` | 主配置文件 |
302
- | `~/.zhipu_cli_history/` | 会话历史记录 |
303
- | `~/.zhipu_cli_plugins/` | 用户插件目录 |
304
- | `~/.zhipu_cli_context.json` | 上下文记忆 |
305
- | `~/.fr_cli_agents/` | Agent 分身目录 |
306
- | `~/.fr_cli_sessions/` | 按日期自动存档的会话 |
307
- | `~/.fr_cli_master/` | MasterAgent 记忆与进化记录 |
308
- | `~/.fr_cli_remotes.json` | 远程主机配置 |
309
- | `~/.fr_cli_databases.json` | 数据库连接配置 |
310
- | `~/.fr_cli_rag_db/` | RAG 向量库(ChromaDB)|
323
+ | `~/.fr_cli/config.json` | 主配置文件(统一配置目录) |
324
+ | `~/.fr_cli/config.json.bak` | 配置自动备份 |
325
+ | `~/.fr_cli/history/` | 会话历史记录 |
326
+ | `~/.fr_cli/context.json` | 上下文记忆 |
327
+ | `~/.fr_cli/sessions/` | 按日期自动存档的会话 |
328
+ | `~/.fr_cli/plugins/` | 用户插件目录 |
329
+ | `~/.fr_cli/agents/` | Agent 分身目录 |
330
+ | `~/.fr_cli/master/` | MasterAgent 记忆与进化记录 |
331
+ | `~/.fr_cli/remotes.json` | 远程主机配置 |
332
+ | `~/.fr_cli/databases.json` | 数据库连接配置 |
333
+ | `~/.fr_cli/rag_db/` | RAG 向量库(ChromaDB)|
311
334
 
312
335
  ## ❓ 常见问题
313
336
 
@@ -319,6 +342,18 @@ fr_cli/
319
342
  /mode react # ReAct
320
343
  ```
321
344
 
345
+ **Q: 模型切换后重启又变回去了?**
346
+ 这是预期行为。fr-cli 每次启动从 `model_factory.py` 的工厂配置读取默认模型,`/model` 切换仅当前会话生效。如需持久化切换默认模型,可修改 `fr_cli/core/model_factory.py` 中的默认模型,或使用 `/providers setup` 交互式配置向导。
347
+
348
+ **Q: 如何配置模型?**
349
+ ```bash
350
+ # 推荐:交互式向导
351
+ /model config
352
+
353
+ # 或
354
+ /providers setup
355
+ ```
356
+
322
357
  **Q: 如何保存会话?**
323
358
  ```bash
324
359
  /save my-session
@@ -349,4 +384,4 @@ pip install aligo # 阿里云盘
349
384
 
350
385
  ## 📄 License
351
386
 
352
- MIT
387
+ MIT
@@ -1,4 +1,4 @@
1
1
  """
2
2
  凡人打字机 - 基于智谱AI的终极全能终端工具
3
3
  """
4
- __version__ = "2.4.0"
4
+ __version__ = "2.4.1"
@@ -268,6 +268,12 @@ class MasterAgent:
268
268
  处理用户输入的主入口。
269
269
  返回 (assistant_reply, should_continue)
270
270
  """
271
+ # 模型未配置时阻止调用
272
+ if not self.state.model_name:
273
+ from fr_cli.ui.ui import YELLOW, CYAN, RESET
274
+ print(f"{YELLOW}⚠️ 模型未配置,请使用 {CYAN}/model <模型名>{YELLOW} 或 {CYAN}/model config{YELLOW} 选择模型。{RESET}")
275
+ return None, False
276
+
271
277
  self._step_count = 0
272
278
  lang = self.state.lang
273
279
 
@@ -384,7 +390,7 @@ class MasterAgent:
384
390
 
385
391
  # 2. 自动按日期存档会话
386
392
  if not self.state.auto_session_path:
387
- path = create_session(self.state.messages)
393
+ path = create_session(self.state.messages, session_id=getattr(self.state, "session_id", None))
388
394
  if path:
389
395
  self.state.auto_session_path = path
390
396
  print(f"{DIM}📁 自动会话已创建: {Path(path).name}{RESET}")
@@ -298,7 +298,10 @@ class CommandExecutor:
298
298
  if error:
299
299
  results.append(f"❌ 工具调用失败: {tool_name}\n {error}")
300
300
  else:
301
- results.append(f"✅ 工具调用成功: {tool_name}\n 结果: {result}")
301
+ r = str(result) if result is not None else ""
302
+ if len(r) > 5000:
303
+ r = r[:5000] + f"\n ... (结果共 {len(r)} 字符,已截断)"
304
+ results.append(f"✅ 工具调用成功: {tool_name}\n 结果: {r}")
302
305
  markers_to_remove.append(marker)
303
306
 
304
307
  # ===== 格式2:【命令:...】 =====
@@ -312,7 +315,10 @@ class CommandExecutor:
312
315
  if error:
313
316
  results.append(f"❌ 命令执行失败: {cmd_str}\n {error}")
314
317
  else:
315
- results.append(f"✅ 命令执行成功: {cmd_str}\n 结果: {result}")
318
+ r = str(result) if result is not None else ""
319
+ if len(r) > 5000:
320
+ r = r[:5000] + f"\n ... (结果共 {len(r)} 字符,已截断)"
321
+ results.append(f"✅ 命令执行成功: {cmd_str}\n 结果: {r}")
316
322
  markers_to_remove.append(marker)
317
323
 
318
324
  # ===== 格式3:file_operations/xxx(兼容) =====
@@ -327,7 +333,10 @@ class CommandExecutor:
327
333
  if error:
328
334
  results.append(f"❌ 命令执行失败: {cmd_str}\n {error}")
329
335
  else:
330
- results.append(f"✅ 命令执行成功: {cmd_str}\n 结果: {result}")
336
+ r = str(result) if result is not None else ""
337
+ if len(r) > 5000:
338
+ r = r[:5000] + f"\n ... (结果共 {len(r)} 字符,已截断)"
339
+ results.append(f"✅ 命令执行成功: {cmd_str}\n 结果: {r}")
331
340
  markers_to_remove.append(m.group(0))
332
341
  markers_to_remove_spans.append(m.span())
333
342
  for m in re.finditer(pattern2_plain, ai_response, re.MULTILINE):
@@ -348,7 +357,10 @@ class CommandExecutor:
348
357
  if error:
349
358
  results.append(f"❌ 命令执行失败: {cmd_str}\n {error}")
350
359
  else:
351
- results.append(f"✅ 命令执行成功: {cmd_str}\n 结果: {result}")
360
+ r = str(result) if result is not None else ""
361
+ if len(r) > 5000:
362
+ r = r[:5000] + f"\n ... (结果共 {len(r)} 字符,已截断)"
363
+ results.append(f"✅ 命令执行成功: {cmd_str}\n 结果: {r}")
352
364
  markers_to_remove.append(m.group(0))
353
365
  markers_to_remove_spans.append(m_span)
354
366