Repository navigation
Feat/tui align webui - #1002
Feat/tui align webui#1002suluyana wants to merge 26 commits into
Conversation
TUI now reuses the same project/session tree as WebUI and writes provider keys, search, instructions, MCP/skills, and memory flags into MS_AGENT_HOME instead of only the work-dir yaml patch. Co-authored-by: Cursor <cursoragent@cursor.com>
Slash commands now pick global vs project the same way WebUI does; converted MEMORY.md lands in the work dir; the agent learns config via the update-config skill; streamable_http quit no longer dumps a stack. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Slash commands keep writing the WebUI ledger. The same agent refreshes skills, MCP, the model client, and memory on the next message, and model saves roll back when the catalog rejects the key or the model id. Co-authored-by: Cursor <cursoragent@cursor.com>
New chats start from the global default. Switching updates that default and the current session, while resuming an older chat restores its own model. Slash output no longer tells a TUI user the files are shared with WebUI. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the two skill trees, default a new slash skill to this machine, and show one MCP with /mcp get. Mask credentials in /config, and stop sending a saved key when only the model URL changes. Tell the user when memory or an MCP server actually fails, and drop the bundled update-config skill. Co-authored-by: Cursor <cursoragent@cursor.com>
The checklist is no longer part of this branch. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the five chat-unsupported phrases unchanged, and drop the live-list count of filtered image, video, and embedding ids. Co-authored-by: Cursor <cursoragent@cursor.com>
A cleared key left the old client in place, then failed the turn. Drop that client and keep the session on the setup prompt until a new key exists. Co-authored-by: Cursor <cursoragent@cursor.com>
Slash commands were still reading config off Runtime, which has no such field, so /skills crashed and search never applied in-process. The next user message already reloads the ledger; a new TUI home now starts with Tavily search enabled. Co-authored-by: Cursor <cursoragent@cursor.com>
Probe the configured servers together before a turn, leave the unreachable ones out of that turn, and reap a connect that is still open on quit. Co-authored-by: Cursor <cursoragent@cursor.com>
Live was redrawing the whole reply and still writing when the prompt took the terminal. Stop it first, typeset once, and split a multiline paste into separate commands. Co-authored-by: Cursor <cursoragent@cursor.com>
A shell call was failing on description, and a short tool name was only reported. The default model id is one the endpoint still lists, a rejected id uses the existing unavailable-model sentence, and the missing-key note is shown once then the held sentence runs after the key is configured. Co-authored-by: Cursor <cursoragent@cursor.com>
The setup text was the exception plus several commands. It now gives the live provider and one key command, and notes when a parked sentence is sent. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the key line, and print a pip command when the selected engine's package is missing. /tools marks a local tool that did not connect instead of listing it as ready. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Read the renamed schema, error, and timeout fields, return image, audio, and structured results, and declare loguru so a clean install can import the agent. Co-authored-by: Cursor <cursoragent@cursor.com>
Insert tui when no subcommand is given, and show only the model id on the welcome line so the provider prefix is not copied into a model field. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep it out of the framework requirements. A missing package is reported at local-search startup instead of failing the agent import. Co-authored-by: Cursor <cursoragent@cursor.com>
The existing import error already covers a missing dependency, so a separate loguru check is unnecessary. Co-authored-by: Cursor <cursoragent@cursor.com>
Restore the WebUI prefix mask and use it in /model list. Refresh the WebUI lock so mcp is no longer recorded as mcp<2. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Model ids that contain a slash stay on the current provider, slow or exited MCP servers update without blocking chat, and project history files no longer store API keys. Co-authored-by: Cursor <cursoragent@cursor.com>
A slash in a copyable /model hint was read as part of the model id, so pasting the Switch line failed. Idle Ctrl-C still leaves the TUI; Ctrl-C during a turn only stops that turn, including after a permission menu. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
| if api_key: | ||
| headers['Authorization'] = f'Bearer {api_key}' | ||
| try: | ||
| with httpx.Client(timeout=8) as client: |
There was a problem hiding this comment.
这里使用同步 httpx.Client 请求供应商接口,而该函数会通过共享命令路由运行在 WebUI 的事件循环中。供应商响应较慢时,同一 worker 上其他请求也会被阻塞。建议改用异步 HTTP 客户端并沿调用链 await,或在异步调用入口将完整的同步探测移到工作线程,避免单个模型目录查询拖住 WebUI 后端。
复现:配置一个 /models 接口延迟 7 秒返回的 provider,在 WebUI 发送 /model list live review-slow,同时请求独立的 /api/health。PR 分支中,脚本测得健康检查耗时约 7004 ms,浏览器验证约 7017 ms。作为对照,main 收到相同聊天输入时不会触发这项新增的目录探测,健康检查耗时约 3–4 ms。
|
|
||
| SDK_ROOT = Path(__file__).resolve().parents[2] | ||
| DEFAULT_WEBUI_BACKEND = Path( | ||
| os.environ.get( |
There was a problem hiding this comment.
默认 backend 路径指向作者的个人工作目录,在其他开发机或 CI 上会导致相关 WebUI 测试直接 skip。
| # Inherited by newly-created projects. | ||
| default_memory_enabled: bool = True | ||
| default_memory_backend: MemoryBackend = "file" | ||
| # Inherited by newly-created projects. None on PUT = leave unchanged |
There was a problem hiding this comment.
注释与实际行为不符:显式 PUT {"default_memory_enabled":null} 会关闭已开启的默认记忆,main 则返回 422。exclude_unset=True 只忽略未提交的字段,不会忽略 null。建议明确拒绝或跳过这些字段的 null 值,并同步注释。正常前端提交布尔值时未复现。
| try: | ||
| self.prepare_llm() | ||
| except Exception as e: | ||
| if not (self._interactive and client_rejected_missing_key(e)): |
There was a problem hiding this comment.
WebUI 的 self._interactive 也为 True,会误入这个等待补充凭证的分支。已复现选择未配置 API key 的模型发送消息,main 显示错误并保存历史;PR 静默结束、历史为空,刷新后消息消失。建议将此等待流程限制在支持它的终端交互中,让 WebUI 保留明确的错误提示和消息记录。
Change Summary
Related issue number
Checklist
pre-commit installandpre-commit run --all-filesbefore git commit, and passed lint check.