fr-cli 2.4.0__tar.gz → 2.4.2__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 (173) hide show
  1. {fr_cli-2.4.0 → fr_cli-2.4.2}/MANIFEST.in +1 -0
  2. {fr_cli-2.4.0/fr_cli.egg-info → fr_cli-2.4.2}/PKG-INFO +107 -50
  3. {fr_cli-2.4.0 → fr_cli-2.4.2}/README.md +107 -50
  4. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/WEAPON.MD +1 -1
  5. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/__init__.py +1 -1
  6. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/addon/plugin.py +4 -4
  7. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/db.py +7 -6
  8. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/powerful_agent_template.py +14 -7
  9. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/remote.py +11 -6
  10. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/generator.py +1 -1
  11. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/hermes.py +24 -12
  12. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/image_and_parallel.py +36 -43
  13. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/master.py +7 -1
  14. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/remote.py +10 -25
  15. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/executor.py +16 -4
  16. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/config.py +1 -1
  17. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/cron.py +1 -1
  18. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/disk.py +1 -1
  19. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/fs.py +1 -1
  20. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/mail.py +1 -1
  21. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/session.py +1 -1
  22. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/web.py +1 -1
  23. fr_cli-2.4.2/fr_cli/conf/config.py +282 -0
  24. fr_cli-2.4.2/fr_cli/conf/default_models.yaml +298 -0
  25. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/chat.py +28 -8
  26. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/core.py +59 -11
  27. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/llm.py +71 -25
  28. fr_cli-2.4.2/fr_cli/core/model_factory.py +140 -0
  29. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/optimizations.py +10 -3
  30. fr_cli-2.4.2/fr_cli/core/stream.py +268 -0
  31. fr_cli-2.4.2/fr_cli/lang/i18n.py +25 -0
  32. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/lang/translations/en.py +17 -8
  33. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/lang/translations/zh.py +14 -8
  34. fr_cli-2.4.2/fr_cli/main.py +363 -0
  35. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/memory/context.py +29 -40
  36. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/memory/session.py +9 -3
  37. fr_cli-2.4.2/fr_cli/repl/batch.py +80 -0
  38. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/bootstrap.py +73 -28
  39. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/__init__.py +1 -0
  40. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/_common.py +8 -4
  41. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/base.py +78 -39
  42. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/config.py +151 -14
  43. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/session.py +32 -0
  44. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/router.py +2 -0
  45. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/ui/banner.py +10 -8
  46. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/ui/buddha.py +5 -0
  47. fr_cli-2.4.2/fr_cli/ui/markdown.py +114 -0
  48. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/ui/prompt.py +26 -7
  49. fr_cli-2.4.2/fr_cli/ui/ui.py +110 -0
  50. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/ui/web_config.py +21 -15
  51. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/fs.py +109 -6
  52. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/mcp.py +49 -27
  53. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/vision.py +8 -1
  54. {fr_cli-2.4.0 → fr_cli-2.4.2/fr_cli.egg-info}/PKG-INFO +107 -50
  55. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli.egg-info/SOURCES.txt +10 -1
  56. {fr_cli-2.4.0 → fr_cli-2.4.2}/pyproject.toml +4 -1
  57. {fr_cli-2.4.0 → fr_cli-2.4.2}/tests/test_a2a_and_providers.py +26 -0
  58. fr_cli-2.4.2/tests/test_batch_mode.py +123 -0
  59. fr_cli-2.4.2/tests/test_help_update.py +62 -0
  60. {fr_cli-2.4.0 → fr_cli-2.4.2}/tests/test_integration_real.py +3 -3
  61. {fr_cli-2.4.0 → fr_cli-2.4.2}/tests/test_model_config.py +3 -2
  62. {fr_cli-2.4.0 → fr_cli-2.4.2}/tests/test_new_providers.py +106 -2
  63. fr_cli-2.4.2/tests/test_no_color_prompt_toolkit.py +141 -0
  64. fr_cli-2.4.2/tests/test_plugin_exec.py +76 -0
  65. fr_cli-2.4.2/tests/test_prompt_completion.py +67 -0
  66. fr_cli-2.4.2/tests/test_vfs_diff.py +79 -0
  67. fr_cli-2.4.0/fr_cli/conf/config.py +0 -190
  68. fr_cli-2.4.0/fr_cli/core/model_factory.py +0 -228
  69. fr_cli-2.4.0/fr_cli/core/stream.py +0 -151
  70. fr_cli-2.4.0/fr_cli/lang/i18n.py +0 -8
  71. fr_cli-2.4.0/fr_cli/main.py +0 -122
  72. fr_cli-2.4.0/fr_cli/ui/ui.py +0 -117
  73. {fr_cli-2.4.0 → fr_cli-2.4.2}/LICENSE +0 -0
  74. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/README.md +0 -0
  75. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/__init__.py +0 -0
  76. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/a2a.py +0 -0
  77. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/acp.py +0 -0
  78. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/artifact_detector.py +0 -0
  79. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/__init__.py +0 -0
  80. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/_utils.py +0 -0
  81. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/local.py +0 -0
  82. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/rag.py +0 -0
  83. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/rag_watcher_daemon.py +0 -0
  84. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/builtins/spider.py +0 -0
  85. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/client.py +0 -0
  86. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/coding_helper.py +0 -0
  87. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/context_files.py +0 -0
  88. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/executor.py +0 -0
  89. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/gateway.py +0 -0
  90. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/hermes_daemon.py +0 -0
  91. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/manager.py +0 -0
  92. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/master_prompt.py +0 -0
  93. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/personality.py +0 -0
  94. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/plugin_system.py +0 -0
  95. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/server.py +0 -0
  96. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/shell_mode.py +0 -0
  97. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/skills.py +0 -0
  98. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow.py +0 -0
  99. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow_system/__init__.py +0 -0
  100. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow_system/engine.py +0 -0
  101. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow_system/executor.py +0 -0
  102. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow_system/manager.py +0 -0
  103. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow_system/models.py +0 -0
  104. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow_system/monitor.py +0 -0
  105. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow_system/tools.py +0 -0
  106. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/agent/workflow_system.py +0 -0
  107. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/assets/splash.jpeg +0 -0
  108. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/breakthrough/update.py +0 -0
  109. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/__init__.py +0 -0
  110. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/__init__.py +0 -0
  111. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/agent.py +0 -0
  112. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/app.py +0 -0
  113. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/dataframe.py +0 -0
  114. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/mcp.py +0 -0
  115. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/other.py +0 -0
  116. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/system.py +0 -0
  117. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/handlers/vision.py +0 -0
  118. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/registered/agent_data_mcp.py +0 -0
  119. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/registered/fs.py +0 -0
  120. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/registered/image.py +0 -0
  121. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/registered/main_routes.py +0 -0
  122. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/registered/services.py +0 -0
  123. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/registered/session_config.py +0 -0
  124. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/registered/web.py +0 -0
  125. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/registry.py +0 -0
  126. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/command/security.py +0 -0
  127. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/conf/__init__.py +0 -0
  128. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/conf/paths.py +0 -0
  129. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/conf/wizard.py +0 -0
  130. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/cache.py +0 -0
  131. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/errors.py +0 -0
  132. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/intent.py +0 -0
  133. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/preferences.py +0 -0
  134. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/project.py +0 -0
  135. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/recommender.py +0 -0
  136. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/sysmon.py +0 -0
  137. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/core/thinking.py +0 -0
  138. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/gatekeeper/__init__.py +0 -0
  139. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/gatekeeper/daemon.py +0 -0
  140. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/gatekeeper/manager.py +0 -0
  141. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/lang/translations/__init__.py +0 -0
  142. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/memory/history.py +0 -0
  143. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/__init__.py +0 -0
  144. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/actions.py +0 -0
  145. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/agent.py +0 -0
  146. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/cron.py +0 -0
  147. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/dataframe.py +0 -0
  148. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/dev.py +0 -0
  149. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/fs.py +0 -0
  150. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/mcp.py +0 -0
  151. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/rag.py +0 -0
  152. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/remote_agent.py +0 -0
  153. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands/system.py +0 -0
  154. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/commands.py +0 -0
  155. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/queue.py +0 -0
  156. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/quick_actions.py +0 -0
  157. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/repl/scenarios.py +0 -0
  158. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/security/security.py +0 -0
  159. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/ui/splash.py +0 -0
  160. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/cron.py +0 -0
  161. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/dataframe.py +0 -0
  162. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/disk.py +0 -0
  163. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/launcher.py +0 -0
  164. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/loader.py +0 -0
  165. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/mail.py +0 -0
  166. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli/weapon/web.py +0 -0
  167. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli.egg-info/dependency_links.txt +0 -0
  168. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli.egg-info/entry_points.txt +0 -0
  169. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli.egg-info/requires.txt +0 -0
  170. {fr_cli-2.4.0 → fr_cli-2.4.2}/fr_cli.egg-info/top_level.txt +0 -0
  171. {fr_cli-2.4.0 → fr_cli-2.4.2}/setup.cfg +0 -0
  172. {fr_cli-2.4.0 → fr_cli-2.4.2}/tests/test_master_prompt_fix.py +0 -0
  173. {fr_cli-2.4.0 → fr_cli-2.4.2}/tests/test_new_features.py +0 -0
@@ -1,5 +1,6 @@
1
1
  include fr_cli/WEAPON.MD
2
2
  include fr_cli/README.md
3
+ include fr_cli/conf/default_models.yaml
3
4
  include fr_cli/assets/*.jpeg
4
5
  include fr_cli/assets/*.png
5
6
  include fr_cli/assets/*.jpg
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fr-cli
3
- Version: 2.4.0
3
+ Version: 2.4.2
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,46 @@ python3 main.py
173
180
  /exit 退出
174
181
  ```
175
182
 
176
- ### 🤖 AI 模型切换示例
183
+ ### 🖥️ 非交互 / 批处理模式
184
+
185
+ fr-cli 支持在不进入 REPL 的情况下执行单次命令或单次 AI 对话,适用于脚本、cron、管道等场景:
186
+
187
+ ```bash
188
+ # 执行一条 slash 命令后退出
189
+ fr-cli -c "/model current"
190
+ fr-cli -c "/ls"
191
+
192
+ # 向 AI 提问后退出
193
+ fr-cli "请总结 README.md"
194
+ fr-cli -p "Python 如何读取 JSON?"
177
195
 
196
+ # 从文件或标准输入读取提示词
197
+ cat article.txt | fr-cli -s
198
+ fr-cli -f prompt.txt
199
+
200
+ # 静默模式(跳过启动 banner,只输出核心结果)
201
+ fr-cli -q -c "/model current"
202
+ fr-cli -q -p "1+1等于几"
178
203
  ```
179
- # 使用 Kimi K2(代码优化版)
180
- /model kimi-k2
181
204
 
182
- # 使用 MiniMax M2.7(Token Plan)
183
- /model minimax-m27
205
+ ### 🤖 AI 模型配置
206
+
207
+ ```bash
208
+ # 交互式配置向导(推荐)
209
+ >>> /model config
184
210
 
185
- # 使用 Step-3(阶跃星辰)
186
- /model step-3
211
+ # 直接切换(仅当前会话生效,重启后恢复 factory 默认)
212
+ >>> /model deepseek-chat
213
+ >>> /model deepseek:deepseek-reasoner
187
214
 
188
- # 使用 Kimi Code
189
- /model kimi-code
215
+ # 查看当前模型
216
+ >>> /model current
217
+
218
+ # 恢复 factory 默认模型
219
+ >>> /model default
190
220
 
191
221
  # 配置新的 API Key
192
- /providers add step-3 <your-api-key>
222
+ >>> /providers add step-3 <your-api-key>
193
223
  ```
194
224
 
195
225
  ### 🔧 Agent 管理
@@ -306,30 +336,33 @@ fr acp
306
336
 
307
337
  ## 🤖 支持的模型提供商(25+)
308
338
 
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 |
339
+ | 道统 | 默认模型 | API 地址 | 常用模型 |
340
+ |------|---------|----------|---------|
341
+ | 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 |
342
+ | zhipu-coding | GLM-4.7 | open.bigmodel.cn/api/coding/paas/v4 (Coding Plan) | GLM-4.7, GLM-5.1, GLM-4.5-air |
343
+ | zhipu-anthropic | glm-4.6 | open.bigmodel.cn/api/anthropic | glm-4.6 |
344
+ | openai | gpt-4o-mini | api.openai.com/v1 | gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1-mini, o3-mini |
345
+ | deepseek | deepseek-chat | api.deepseek.com | deepseek-chat, deepseek-reasoner, deepseek-coder |
346
+ | kimi | moonshot-v1-8k | api.moonshot.cn | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
347
+ | kimi-k2 | kimi-k2-0905-preview | api.moonshot.cn | kimi-k2-0905-preview |
348
+ | kimi-code | kimi-for-coding | api.kimi.com/coding/v1 | kimi-for-coding |
349
+ | qwen | qwen-turbo | dashscope.aliyuncs.com | qwen-turbo, qwen-plus, qwen-max, qwen-coder-plus |
350
+ | 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 |
351
+ | step-1 | step-1-8k | api.stepfun.com | step-1-8k |
352
+ | step-2 | step-2-16k | api.stepfun.com | step-2-16k |
353
+ | step-3 | step-3-auto | api.stepfun.com | step-3-auto |
354
+ | step-audio | step-audio-2 | api.stepfun.com | step-audio-2 |
355
+ | stepfun-step-plan | step-3-auto | api.stepfun.com/step_plan/v1 (Step Plan) | step-3-auto, step-2-16k, step-1-8k |
356
+ | 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 |
357
+ | minimax-m27 | MiniMax-M2.7 | api.minimax.chat (Token Plan) | MiniMax-M2.7 |
358
+ | minimax-m27-fast | MiniMax-M2.7-HighSpeed | api.minimax.chat (Token Plan) | MiniMax-M2.7-HighSpeed |
359
+ | minimax-token-plan | MiniMax-M2.7 | api.minimax.chat (Token Plan) | MiniMax-M2.7 |
360
+ | spark | generalv3.5 | spark-api-open.xf-yun.com | generalv3.5 |
361
+ | doubao | doubao-1-5-pro-32k-250115 | ark.cn-beijing.volces.com | doubao-1-5-pro-32k, doubao-1-5-lite-32k |
362
+ | mimo | mimo-v2-flash | api.xiaomimimo.com | mimo-v2-flash, mimo-v2-pro |
363
+ | mimo-token-plan | mimo-v2-flash | token-plan-sgp.xiaomimimo.com (Token Plan) | mimo-v2-flash, mimo-v2-pro |
364
+ | longcat | LongCat-Flash-Chat | api.longcat.chat/openai | LongCat-Flash-Chat |
365
+ | longcat-anthropic | LongCat | api.longcat.chat/anthropic | LongCat |
333
366
 
334
367
  ## 🔧 开发
335
368
 
@@ -345,9 +378,17 @@ pip install -e ".[all]"
345
378
  python3 -m pytest tests/ -v
346
379
 
347
380
  # 运行程序
348
- python3 main.py
381
+ fr-cli
349
382
  ```
350
383
 
384
+ ### 环境变量
385
+
386
+ | 变量 | 说明 |
387
+ |------|------|
388
+ | `NO_COLOR=1` | 禁用所有 ANSI 颜色输出,适合 CI/管道/日志重定向 |
389
+ | `FR_CLI_DEBUG=1` | 开启调试模式,显示详细 traceback |
390
+ | `FR_CLI_NON_INTERACTIVE=1` | 非交互模式,安全确认默认拒绝 |
391
+
351
392
  ## 📂 项目结构
352
393
 
353
394
  ```
@@ -358,7 +399,8 @@ fr_cli/
358
399
  │ ├── master.py # MasterAgent 主控
359
400
  │ └── ...
360
401
  ├── core/ # 核心模块
361
- └── llm.py # LLM 客户端(20+ 提供商)
402
+ ├── llm.py # LLM 客户端(20+ 提供商)
403
+ │ └── model_factory.py # 模型工厂配置
362
404
  ├── weapon/ # 武器库
363
405
  ├── memory/ # 记忆系统
364
406
  └── lang/ # 国际化
@@ -370,18 +412,21 @@ fr_cli/
370
412
 
371
413
  ## 📂 配置目录
372
414
 
415
+ > 配置统一在 `~/.fr_cli/` 目录下,旧路径(如 `~/.zhipu_cli_config.json`)会在首次启动时自动迁移到新路径。
416
+
373
417
  | 路径 | 说明 |
374
418
  |------|------|
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)|
419
+ | `~/.fr_cli/config.json` | 主配置文件(统一配置目录) |
420
+ | `~/.fr_cli/config.json.bak` | 配置自动备份 |
421
+ | `~/.fr_cli/history/` | 会话历史记录 |
422
+ | `~/.fr_cli/context.json` | 上下文记忆 |
423
+ | `~/.fr_cli/sessions/` | 按日期自动存档的会话 |
424
+ | `~/.fr_cli/plugins/` | 用户插件目录 |
425
+ | `~/.fr_cli/agents/` | Agent 分身目录 |
426
+ | `~/.fr_cli/master/` | MasterAgent 记忆与进化记录 |
427
+ | `~/.fr_cli/remotes.json` | 远程主机配置 |
428
+ | `~/.fr_cli/databases.json` | 数据库连接配置 |
429
+ | `~/.fr_cli/rag_db/` | RAG 向量库(ChromaDB)|
385
430
 
386
431
  ## ❓ 常见问题
387
432
 
@@ -393,6 +438,18 @@ fr_cli/
393
438
  /mode react # ReAct
394
439
  ```
395
440
 
441
+ **Q: 模型切换后重启又变回去了?**
442
+ 这是预期行为。fr-cli 每次启动从 `model_factory.py` 的工厂配置读取默认模型,`/model` 切换仅当前会话生效。如需持久化切换默认模型,可修改 `fr_cli/core/model_factory.py` 中的默认模型,或使用 `/providers setup` 交互式配置向导。
443
+
444
+ **Q: 如何配置模型?**
445
+ ```bash
446
+ # 推荐:交互式向导
447
+ /model config
448
+
449
+ # 或
450
+ /providers setup
451
+ ```
452
+
396
453
  **Q: 如何保存会话?**
397
454
  ```bash
398
455
  /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,46 @@ python3 main.py
99
106
  /exit 退出
100
107
  ```
101
108
 
102
- ### 🤖 AI 模型切换示例
109
+ ### 🖥️ 非交互 / 批处理模式
110
+
111
+ fr-cli 支持在不进入 REPL 的情况下执行单次命令或单次 AI 对话,适用于脚本、cron、管道等场景:
112
+
113
+ ```bash
114
+ # 执行一条 slash 命令后退出
115
+ fr-cli -c "/model current"
116
+ fr-cli -c "/ls"
117
+
118
+ # 向 AI 提问后退出
119
+ fr-cli "请总结 README.md"
120
+ fr-cli -p "Python 如何读取 JSON?"
103
121
 
122
+ # 从文件或标准输入读取提示词
123
+ cat article.txt | fr-cli -s
124
+ fr-cli -f prompt.txt
125
+
126
+ # 静默模式(跳过启动 banner,只输出核心结果)
127
+ fr-cli -q -c "/model current"
128
+ fr-cli -q -p "1+1等于几"
104
129
  ```
105
- # 使用 Kimi K2(代码优化版)
106
- /model kimi-k2
107
130
 
108
- # 使用 MiniMax M2.7(Token Plan)
109
- /model minimax-m27
131
+ ### 🤖 AI 模型配置
132
+
133
+ ```bash
134
+ # 交互式配置向导(推荐)
135
+ >>> /model config
110
136
 
111
- # 使用 Step-3(阶跃星辰)
112
- /model step-3
137
+ # 直接切换(仅当前会话生效,重启后恢复 factory 默认)
138
+ >>> /model deepseek-chat
139
+ >>> /model deepseek:deepseek-reasoner
113
140
 
114
- # 使用 Kimi Code
115
- /model kimi-code
141
+ # 查看当前模型
142
+ >>> /model current
143
+
144
+ # 恢复 factory 默认模型
145
+ >>> /model default
116
146
 
117
147
  # 配置新的 API Key
118
- /providers add step-3 <your-api-key>
148
+ >>> /providers add step-3 <your-api-key>
119
149
  ```
120
150
 
121
151
  ### 🔧 Agent 管理
@@ -232,30 +262,33 @@ fr acp
232
262
 
233
263
  ## 🤖 支持的模型提供商(25+)
234
264
 
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 |
265
+ | 道统 | 默认模型 | API 地址 | 常用模型 |
266
+ |------|---------|----------|---------|
267
+ | 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 |
268
+ | zhipu-coding | GLM-4.7 | open.bigmodel.cn/api/coding/paas/v4 (Coding Plan) | GLM-4.7, GLM-5.1, GLM-4.5-air |
269
+ | zhipu-anthropic | glm-4.6 | open.bigmodel.cn/api/anthropic | glm-4.6 |
270
+ | openai | gpt-4o-mini | api.openai.com/v1 | gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1-mini, o3-mini |
271
+ | deepseek | deepseek-chat | api.deepseek.com | deepseek-chat, deepseek-reasoner, deepseek-coder |
272
+ | kimi | moonshot-v1-8k | api.moonshot.cn | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
273
+ | kimi-k2 | kimi-k2-0905-preview | api.moonshot.cn | kimi-k2-0905-preview |
274
+ | kimi-code | kimi-for-coding | api.kimi.com/coding/v1 | kimi-for-coding |
275
+ | qwen | qwen-turbo | dashscope.aliyuncs.com | qwen-turbo, qwen-plus, qwen-max, qwen-coder-plus |
276
+ | 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 |
277
+ | step-1 | step-1-8k | api.stepfun.com | step-1-8k |
278
+ | step-2 | step-2-16k | api.stepfun.com | step-2-16k |
279
+ | step-3 | step-3-auto | api.stepfun.com | step-3-auto |
280
+ | step-audio | step-audio-2 | api.stepfun.com | step-audio-2 |
281
+ | stepfun-step-plan | step-3-auto | api.stepfun.com/step_plan/v1 (Step Plan) | step-3-auto, step-2-16k, step-1-8k |
282
+ | 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 |
283
+ | minimax-m27 | MiniMax-M2.7 | api.minimax.chat (Token Plan) | MiniMax-M2.7 |
284
+ | minimax-m27-fast | MiniMax-M2.7-HighSpeed | api.minimax.chat (Token Plan) | MiniMax-M2.7-HighSpeed |
285
+ | minimax-token-plan | MiniMax-M2.7 | api.minimax.chat (Token Plan) | MiniMax-M2.7 |
286
+ | spark | generalv3.5 | spark-api-open.xf-yun.com | generalv3.5 |
287
+ | doubao | doubao-1-5-pro-32k-250115 | ark.cn-beijing.volces.com | doubao-1-5-pro-32k, doubao-1-5-lite-32k |
288
+ | mimo | mimo-v2-flash | api.xiaomimimo.com | mimo-v2-flash, mimo-v2-pro |
289
+ | mimo-token-plan | mimo-v2-flash | token-plan-sgp.xiaomimimo.com (Token Plan) | mimo-v2-flash, mimo-v2-pro |
290
+ | longcat | LongCat-Flash-Chat | api.longcat.chat/openai | LongCat-Flash-Chat |
291
+ | longcat-anthropic | LongCat | api.longcat.chat/anthropic | LongCat |
259
292
 
260
293
  ## 🔧 开发
261
294
 
@@ -271,9 +304,17 @@ pip install -e ".[all]"
271
304
  python3 -m pytest tests/ -v
272
305
 
273
306
  # 运行程序
274
- python3 main.py
307
+ fr-cli
275
308
  ```
276
309
 
310
+ ### 环境变量
311
+
312
+ | 变量 | 说明 |
313
+ |------|------|
314
+ | `NO_COLOR=1` | 禁用所有 ANSI 颜色输出,适合 CI/管道/日志重定向 |
315
+ | `FR_CLI_DEBUG=1` | 开启调试模式,显示详细 traceback |
316
+ | `FR_CLI_NON_INTERACTIVE=1` | 非交互模式,安全确认默认拒绝 |
317
+
277
318
  ## 📂 项目结构
278
319
 
279
320
  ```
@@ -284,7 +325,8 @@ fr_cli/
284
325
  │ ├── master.py # MasterAgent 主控
285
326
  │ └── ...
286
327
  ├── core/ # 核心模块
287
- └── llm.py # LLM 客户端(20+ 提供商)
328
+ ├── llm.py # LLM 客户端(20+ 提供商)
329
+ │ └── model_factory.py # 模型工厂配置
288
330
  ├── weapon/ # 武器库
289
331
  ├── memory/ # 记忆系统
290
332
  └── lang/ # 国际化
@@ -296,18 +338,21 @@ fr_cli/
296
338
 
297
339
  ## 📂 配置目录
298
340
 
341
+ > 配置统一在 `~/.fr_cli/` 目录下,旧路径(如 `~/.zhipu_cli_config.json`)会在首次启动时自动迁移到新路径。
342
+
299
343
  | 路径 | 说明 |
300
344
  |------|------|
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)|
345
+ | `~/.fr_cli/config.json` | 主配置文件(统一配置目录) |
346
+ | `~/.fr_cli/config.json.bak` | 配置自动备份 |
347
+ | `~/.fr_cli/history/` | 会话历史记录 |
348
+ | `~/.fr_cli/context.json` | 上下文记忆 |
349
+ | `~/.fr_cli/sessions/` | 按日期自动存档的会话 |
350
+ | `~/.fr_cli/plugins/` | 用户插件目录 |
351
+ | `~/.fr_cli/agents/` | Agent 分身目录 |
352
+ | `~/.fr_cli/master/` | MasterAgent 记忆与进化记录 |
353
+ | `~/.fr_cli/remotes.json` | 远程主机配置 |
354
+ | `~/.fr_cli/databases.json` | 数据库连接配置 |
355
+ | `~/.fr_cli/rag_db/` | RAG 向量库(ChromaDB)|
311
356
 
312
357
  ## ❓ 常见问题
313
358
 
@@ -319,6 +364,18 @@ fr_cli/
319
364
  /mode react # ReAct
320
365
  ```
321
366
 
367
+ **Q: 模型切换后重启又变回去了?**
368
+ 这是预期行为。fr-cli 每次启动从 `model_factory.py` 的工厂配置读取默认模型,`/model` 切换仅当前会话生效。如需持久化切换默认模型,可修改 `fr_cli/core/model_factory.py` 中的默认模型,或使用 `/providers setup` 交互式配置向导。
369
+
370
+ **Q: 如何配置模型?**
371
+ ```bash
372
+ # 推荐:交互式向导
373
+ /model config
374
+
375
+ # 或
376
+ /providers setup
377
+ ```
378
+
322
379
  **Q: 如何保存会话?**
323
380
  ```bash
324
381
  /save my-session
@@ -349,4 +406,4 @@ pip install aligo # 阿里云盘
349
406
 
350
407
  ## 📄 License
351
408
 
352
- MIT
409
+ MIT
@@ -176,7 +176,7 @@
176
176
  - AI 调用: `mcp_call({"server": "服务器名", "tool": "工具名", "arguments": {...}})`
177
177
  - REPL 管理: `/mcp_list`, `/mcp_add`, `/mcp_del`, `/mcp_enable`, `/mcp_disable`, `/mcp_refresh`
178
178
  - **触发关键词**: mcp, 外部工具, 外部神通, 调用工具, use tool, invoke tool
179
- - **配置持久化**: `~/.zhipu_cli_config.json` 的 `mcp.servers` 字段
179
+ - **配置持久化**: `~/.fr_cli/config.json` 的 `mcp.servers` 字段
180
180
  - **示例**:
181
181
  ```
182
182
  /mcp_add fs npx -y @modelcontextprotocol/server-filesystem /tmp
@@ -1,4 +1,4 @@
1
1
  """
2
2
  凡人打字机 - 基于智谱AI的终极全能终端工具
3
3
  """
4
- __version__ = "2.4.0"
4
+ __version__ = "2.4.2"
@@ -38,19 +38,19 @@ def exec_plugin(name, path, args, lang):
38
38
  print(f"{RED}❌ 非法插件名: {name}{RESET}")
39
39
  return
40
40
 
41
- import json, shlex
41
+ import json
42
42
  # 使用 json.dumps 安全序列化参数,防止字符串逃逸注入
43
43
  safe_args = json.dumps(args)
44
44
  runner_code = f"""
45
45
  import sys, json, runpy
46
- sys.path.insert(0, {shlex.quote(str(PLUGIN_DIR))})
47
- mod = runpy.run_module({shlex.quote(name)}, run_name='__main__')
46
+ sys.path.insert(0, {json.dumps(str(PLUGIN_DIR), ensure_ascii=False)})
47
+ mod = runpy.run_module({json.dumps(name, ensure_ascii=False)}, run_name='__main__')
48
48
  run_fn = mod.get('run')
49
49
  if run_fn is None:
50
50
  print("Error: 插件缺少 run 函数", file=sys.stderr)
51
51
  else:
52
52
  try:
53
- print(run_fn(json.loads({safe_args})))
53
+ print(run_fn(json.loads({json.dumps(safe_args, ensure_ascii=False)})))
54
54
  except Exception as e:
55
55
  print(f"Error: {{e}}", file=sys.stderr)
56
56
  """
@@ -1,11 +1,14 @@
1
1
  """
2
2
  @db 内置 Agent —— 数据库智能助手
3
3
  支持 MySQL / PostgreSQL / SQL Server / Oracle 的 Schema 分析和 SQL 生成。
4
+
5
+ 数据库连接配置统一收敛到 ~/.fr_cli/config.json 的 databases 命名空间。
4
6
  """
5
- from pathlib import Path
7
+ from fr_cli.conf.config import load_namespace, save_namespace
6
8
  from fr_cli.conf.paths import DATABASE_FILE
7
9
 
8
- DB_CFG_PATH = DATABASE_FILE # from fr_cli.conf.paths
10
+ _NS_KEY = "databases"
11
+ DB_CFG_PATH = DATABASE_FILE # 保留用于一次性迁移
9
12
 
10
13
  DB_SYS_PROMPT = """你是一个数据库专家。请根据以下数据库 Schema 信息和用户需求,生成最合适的 SQL 语句。
11
14
 
@@ -25,13 +28,11 @@ Schema 信息:
25
28
 
26
29
 
27
30
  def _load_dbs():
28
- from fr_cli.agent.builtins._utils import load_json_config
29
- return load_json_config(DB_CFG_PATH)
31
+ return load_namespace(_NS_KEY, default={}, old_path=DB_CFG_PATH)
30
32
 
31
33
 
32
34
  def _save_dbs(dbs):
33
- from fr_cli.agent.builtins._utils import save_json_config
34
- save_json_config(DB_CFG_PATH, dbs)
35
+ save_namespace(_NS_KEY, dbs)
35
36
 
36
37
 
37
38
  def _connect(db_cfg):
@@ -17,8 +17,8 @@
17
17
 
18
18
  示例配置:
19
19
  {
20
- "provider": "kimi-k2",
21
- "model": "kimi-k2-0905-preview",
20
+ "provider": "<your-provider>",
21
+ "model": "<your-model>",
22
22
  "key": "your-api-key"
23
23
  }
24
24
  """
@@ -641,10 +641,17 @@ class PowerfulAgent:
641
641
  self.a2a = A2AIntegration(name, context.get("state"))
642
642
  self.evolution = EvolutionSystem(name)
643
643
 
644
- # 从 context 获取配置
644
+ # 从 context 获取配置;未指定时回退到 ModelFactory 首个 provider
645
645
  self.client = context.get("client")
646
- self.provider = context.get("provider", "zhipu")
647
- self.model = context.get("model", "glm-4-flash")
646
+ self.provider = context.get("provider")
647
+ self.model = context.get("model")
648
+ if not self.provider:
649
+ from fr_cli.core.model_factory import get_model_factory
650
+ factory = get_model_factory()
651
+ providers = factory.list_providers()
652
+ if providers:
653
+ self.provider = providers[0]
654
+ self.model = factory.get_model_name(self.provider)
648
655
  self.persona = context.get("persona", "")
649
656
  self.skills = context.get("skills", "")
650
657
  self.lang = context.get("lang", "zh")
@@ -900,8 +907,8 @@ if __name__ == "__main__":
900
907
  # 示例:创建并运行 Agent
901
908
  example_context = {
902
909
  "client": None, # 在实际运行时由 fr-cli 提供
903
- "provider": "kimi-k2",
904
- "model": "kimi-k2-0905-preview",
910
+ "provider": "<your-provider>",
911
+ "model": "<your-model>",
905
912
  "persona": "你是一个专业的代码审查员,擅长发现代码中的问题和优化点。",
906
913
  "skills": "代码审查、性能优化、重构建议",
907
914
  "lang": "zh",
@@ -1,11 +1,15 @@
1
1
  """
2
2
  @remote 内置 Agent —— 远程 SSH 操作助手
3
3
  支持多机配置、配置向导、AI 生成远程命令。
4
+
5
+ 远程主机配置统一收敛到 ~/.fr_cli/config.json 的 remote.hosts 命名空间。
6
+ 旧文件 ~/.fr_cli/remote/hosts.json 会在首次加载时一次性迁移。
4
7
  """
5
- from pathlib import Path
8
+ from fr_cli.conf.config import load_namespace, save_namespace
6
9
  from fr_cli.conf.paths import REMOTE_HOSTS_FILE
7
10
 
8
- REMOTE_CFG_PATH = REMOTE_HOSTS_FILE # from fr_cli.conf.paths
11
+ _NS_KEY = "remote"
12
+ REMOTE_CFG_PATH = REMOTE_HOSTS_FILE # 保留用于一次性迁移
9
13
 
10
14
  REMOTE_SYS_PROMPT = """你是一个远程系统命令专家。请根据目标主机的操作系统类型和用户需求,生成最合适的远程命令。
11
15
 
@@ -21,13 +25,14 @@ REMOTE_SYS_PROMPT = """你是一个远程系统命令专家。请根据目标主
21
25
 
22
26
 
23
27
  def _load_hosts():
24
- from fr_cli.agent.builtins._utils import load_json_config
25
- return load_json_config(REMOTE_CFG_PATH)
28
+ ns = load_namespace(_NS_KEY, default={"hosts": {}}, old_path=REMOTE_CFG_PATH)
29
+ return ns.get("hosts", {})
26
30
 
27
31
 
28
32
  def _save_hosts(hosts):
29
- from fr_cli.agent.builtins._utils import save_json_config
30
- save_json_config(REMOTE_CFG_PATH, hosts)
33
+ ns = load_namespace(_NS_KEY, default={"hosts": {}})
34
+ ns["hosts"] = hosts
35
+ save_namespace(_NS_KEY, ns)
31
36
 
32
37
 
33
38
  def list_hosts():