shuiyu67 1383d32f8b feat: OpenAI 多模型注册表 + /model 命令,告别手改配置文件
痛点:很多模型都是 OpenAI 格式,但换模型只能手改 config.json 的单槽位,
且只能存一个。新增模型注册表与 /model 命令族:

- 新增 xcli_core/model_registry.py:在 api.engines.openai 下维护
  models 列表(name + base_url + api_key + model)与 current 指针,全部落盘。
  向后兼容:无 models 时把扁平 api_key/base_url/model 当作单条隐式模型。
- OpenaiAI 接入:__init__ 应用注册表 current 模型;新增
  set_registry_model / list_registry_models / add_model / remove_model /
  current_model_name。注意保留引擎原有的轻量 set_model(只改 model 名)
  与 list_models(查 API /models 端点),新方法与它们不重名、互不干扰。
- 新增 /model 命令族(仅 openai 引擎):
    /model            列出已配置模型(* 标记当前)
    /model <名称>     切换当前模型并持久化
    /model add        交互式录入(名称/base_url/api_key/model),回车即存并切换
    /model rm <名称>  删除(删当前则回退到列表第一个)
- 启动横幅引擎名后显示当前模型;紧凑提示与 /help 速查表均补 /model 入口。
- 测试:新增 tests/test_model_registry.py(13 项,覆盖兼容/增删/切换/落盘/
  引擎接入/CLI 路由,全程临时配置不污染真实 config.json)。
  全量 230 passed(原 217 passed)。

交互实测:/model add → 已添加并切换到 gpt4o;/model gpt4o → 已切换;
/model rm gpt4o → 回退到 xophunyuan7bmt,配置结构与内容完好。
2026-08-05 16:12:35 +08:00
2026-08-02 18:39:28 +08:00
2026-06-19 00:30:15 +08:00

XiaoLi Pro-CLI

AI Programming Assistant — Code Editing · Git · Browser Automation · Multi-Agent

version python license tests


Features

  • Dual AI Engines — Ollama local + OpenAI compatible (DeepSeek, Grok, SiliconFlow, etc.)
  • Code Editing & Search — Precise replace, batch edit, symbol extraction, regex search
  • Git Integration — Full Git operations + workflow automation
  • Browser Automation — Playwright-driven, navigate/interact/screenshot/JS execution
  • Sub-Agent System — Multi-agent parallel collaboration with task delegation
  • Unified Safety — AI risk analysis + 3-mode switching (Normal/Manual/Unrestricted)
  • 15 Plugins, 141 Operations — Code, Git, browser, engineering, file management, etc.
  • 113 Automated Tests — pytest coverage for all plugins and core modules

Quick Start

git clone https://gitee.com/shuiyu1123/xiaoli-cli.git
cd xiaoli-cli
pip install -r requirements.txt
python ai_cli.py

AI Engines

Engine Type Description
ollama Local Ollama local models, no API key needed
openai Cloud/Local OpenAI compatible: DeepSeek, Grok, SiliconFlow, local vLLM

Plugins (15)

Core Productivity

Plugin Ops Description
code_editor 23 Code editing + search. replace/batch/find/regex/symbols/imports/callers/todo
git_tools 20 Git. status/diff/log/commit/branch + smart-commit/changelog/contributors
cmd_executor 1 Shell commands. Cross-platform, timeout, danger blocking
file_manager 11 File system. list/read/write/copy/move/delete/search/info/mkdir
auto_engineer 16 Engineering. lint/format/test/build/deps + complexity/security/metrics
task_manager 7 Task tracking. add/list/complete/delete/clear with JSON persistence

Advanced

Plugin Ops Description
sub_agent 8 Sub-Agent system. spawn/list/status/result/send/kill, parallel collaboration
browser_auto 31 Browser automation. navigate/click/fill/screenshot/JS/PDF/cookies
tool_search — Tool discovery. Search available plugins by keyword

Utilities

Plugin Description
network_tools ping/get/status/headers/ip
ai_search AI search via jina.ai + web content extraction
frontend_tester HTML/CSS/JS syntax check, responsive validation
speech_recognition Voice recording + speech-to-text
audio_player Audio playback
send_image Send images to phone (Clawli mode)

Safety

Three modes (/safe to switch):

Mode Icon Behavior
Normal (default) AI analyzes risk, confirms only when risk detected
Manual All commands require user confirmation
Unrestricted Execute directly, no checking

Testing

python -m pytest tests/ -v   # 113 tests

License

MIT License

S
Description
No description provided
Readme
10 MiB
0 Stars 1 Watchers 0 Forks