Skip to content

feat(webui): provider/model selection and session close - #680

Merged
delete-cloud merged 1 commit into
mainfrom
feat/webui-model-select-delete
Jul 24, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
feat/webui-model-select-delete

Conversation

@delete-cloud

@delete-cloud delete-cloud commented Jul 24, 2026 •

Copy link
Copy Markdown
Owner

服务端能力早已存在(CreateSessionRequest.provider/model、DELETE /sessions/{id}),纯前端补齐:

  • 新建会话:provider 下拉(9 个 ProviderName + server default)+ model 自由输入(kimi-for-coding/k3/deepseek-chat 预设),默认 kimi-code/kimi-for-coding,随 localStorage 持久化
  • 会话列表:显示 provider_name/model_name;每行新增关闭按钮,调 DELETE /sessions/{id},404/409 显示可读错误
  • 24/24 vitest(新增 4 个测试),tsc 干净

Summary by CodeRabbit

  • New Features

    • Added provider selection and model configuration in the header.
    • New sessions now use the selected provider and model, or server defaults when unspecified.
    • Added controls to close and remove sessions from the session list.
    • Session entries now display provider and model information.
  • Bug Fixes

    • Added clear error handling when session deletion fails, while preserving the session in the list.

New-session flow gains a provider dropdown (all ProviderName literals +
'server default', which omits both fields) and a free-text model input
with kimi-for-coding/k3/deepseek-chat presets; defaults to
kimi-code/kimi-for-coding. Both persist via the existing localStorage
config. Session list shows provider_name/model_name and gains a
per-row close button wired to DELETE /sessions/{id} with a confirm
step; 404/409 surface in the list error banner.

Server support already existed (CreateSessionRequest.provider/model,
DELETE /sessions/{id}); this is frontend-only. 24/24 vitest, tsc clean.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The WebUI adds provider and model controls to session creation, omits them for server defaults, and introduces session deletion with confirmation, API handling, UI state updates, and conflict-error coverage.

Changes

Session management

Layer / File(s) Summary
Provider/model session creation
coding-agent/webui/app/src/App.tsx, coding-agent/webui/app/src/components/Header.tsx, coding-agent/webui/app/src/lib/api.ts, coding-agent/webui/app/src/App.test.tsx
Provider and model configuration is persisted and exposed in the header; session creation trims configured values and omits both fields when server defaults are selected.
Session deletion flow
coding-agent/webui/app/src/components/SessionList.tsx, coding-agent/webui/app/src/App.tsx, coding-agent/webui/app/src/lib/api.ts, coding-agent/webui/app/src/App.test.tsx
Session rows provide a close control, deletion calls the DELETE endpoint, successful deletion updates active state and the list, and HTTP 409 responses remain visible as errors.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SessionRow
  participant App
  participant AgentClient
  participant SessionsAPI
  SessionRow->>App: request deletion
  App->>AgentClient: closeSession(sessionId)
  AgentClient->>SessionsAPI: DELETE /sessions/{sessionId}
  SessionsAPI-->>AgentClient: status and session_id
  AgentClient-->>App: deletion result
  App-->>SessionRow: remove session or show error
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main frontend change: provider/model selection plus session closing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/webui-model-select-delete

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@coding-agent/webui/app/src/App.tsx`:
- Around line 184-192: Update the deleteSession success path to call
setSessionsError(null) after the deletion completes successfully, before
refreshing or updating the session list. Keep the existing error assignment in
the failure path unchanged so only stale errors are cleared after a confirmed
successful delete.

In `@coding-agent/webui/app/src/components/Header.tsx`:
- Around line 13-23: Update the PROVIDERS definition in Header.tsx to use a
generated or shared source of truth from the backend provider names instead of
maintaining a manual duplicate. Ensure additions and removals in the backend
provider list automatically keep the UI provider options synchronized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: aaf2f534-54b6-445d-a1ed-8995162a2aa0

📥 Commits

Reviewing files that changed from the base of the PR and between 013e880 and dbeaf74.

📒 Files selected for processing (5)
  • coding-agent/webui/app/src/App.test.tsx
  • coding-agent/webui/app/src/App.tsx
  • coding-agent/webui/app/src/components/Header.tsx
  • coding-agent/webui/app/src/components/SessionList.tsx
  • coding-agent/webui/app/src/lib/api.ts

Comment thread coding-agent/webui/app/src/App.tsx
Comment thread coding-agent/webui/app/src/components/Header.tsx
@delete-cloud
delete-cloud merged commit 0574471 into main Jul 24, 2026
2 checks passed
@delete-cloud
delete-cloud deleted the feat/webui-model-select-delete branch July 24, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant