Extend the chat brain-icon popup and its backing session PATCH route so an
active Direct chat's model or agent can be switched mid-conversation instead
of only being set at creation time.
- Add a Model/Agent section to ChatThinkingLevelControl (the brain-icon
popup) for picking a model provider/model or retargeting to a real agent
without leaving the chat.
- Extend PATCH /api/chat/sessions/:id to accept modelProvider/modelId (as a
validated pair via the existing validateModelPair helper) and agentId,
forwarding only the keys present in the body so omitted fields leave the
session's stored target untouched.
- Add chat-store updateSession support for the agentId clause alongside the
existing model/thinkingLevel fields, and a useChat.setSessionModel hook
for the dashboard to call the new PATCH capability.
- Update i18n locale strings (en/es/fr/ko/zh-CN/zh-TW) and dashboard-guide.md
docs for the new switcher UI.
- Add unit/integration test coverage across chat-store, chat-manager,
chat-routes, useChat, ChatThinkingLevelControl, and ChatView for the new
model/agent switch behavior.
- Add changeset fn-7908-chat-model-agent-switcher.md (minor,
@runfusion/fusion).
Files changed:
.changeset/fn-7908-chat-model-agent-switcher.md | 7 +
docs/dashboard-guide.md | 3 +-
packages/core/src/__tests__/chat-store.test.ts | 21 ++
packages/core/src/chat-store.ts | 8 +
packages/core/src/chat-types.ts | 2 +
packages/dashboard/app/api/legacy.ts | 11 +-
.../app/components/ChatThinkingLevelControl.tsx | 219 ++++++++++++++++++---
packages/dashboard/app/components/ChatView.css | 135 ++++++++++++-
packages/dashboard/app/components/ChatView.tsx | 23 ++-
.../__tests__/ChatThinkingLevelControl.test.tsx | 109 +++++++++-
.../__tests__/ChatView.thinking-level.test.tsx | 67 ++++++-
.../dashboard/app/hooks/__tests__/useChat.test.ts | 166 +++++++++++++++-
packages/dashboard/app/hooks/useChat.ts | 56 ++++++
.../dashboard/src/__tests__/chat-manager.test.ts | 38 ++++
.../dashboard/src/__tests__/chat-routes.test.ts | 117 ++++++++++-
.../dashboard/src/routes/register-chat-routes.ts | 48 ++++-
packages/i18n/locales/en/app.json | 8 +-
packages/i18n/locales/es/app.json | 8 +-
packages/i18n/locales/fr/app.json | 8 +-
packages/i18n/locales/ko/app.json | 8 +-
packages/i18n/locales/zh-CN/app.json | 8 +-
packages/i18n/locales/zh-TW/app.json | 8 +-
22 files changed, 1007 insertions(+), 71 deletions(-)
Fusion-Task-Id: FN-7908
Fusion-Task-Lineage: b1104865-9b0c-4d77-973e-89152fe245e0
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>