Skip to content

fix(frontend): persist model selection per thread#1553

Open
LittleChenLiya wants to merge 4 commits intobytedance:mainfrom
LittleChenLiya:Admire/fix-thread-model-selection
Open

fix(frontend): persist model selection per thread#1553
LittleChenLiya wants to merge 4 commits intobytedance:mainfrom
LittleChenLiya:Admire/fix-thread-model-selection

Conversation

@LittleChenLiya
Copy link
Copy Markdown
Contributor

Summary

  • persist model selection per thread in local storage
  • load thread-specific model settings when switching chats or agents

Fixes #1541

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Persists the selected model on a per-thread basis in the frontend so switching between chat threads/agents restores each thread’s own model choice instead of sharing a single global selection.

Changes:

  • Add per-thread localStorage keys for model_name and load them when a threadId is provided.
  • Update useLocalSettings to accept an optional threadId and persist per-thread model changes.
  • Wire thread-aware settings into both the generic chat page and agent chat page.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
frontend/src/core/settings/local.ts Introduces per-thread model storage and extends getLocalSettings/saveLocalSettings to optionally scope model selection by thread.
frontend/src/core/settings/hooks.ts Updates useLocalSettings to accept threadId and persist/load settings accordingly.
frontend/src/app/workspace/chats/[thread_id]/page.tsx Uses thread-aware local settings in the main chat page.
frontend/src/app/workspace/agents/[agent_name]/chats/[thread_id]/page.tsx Uses thread-aware local settings in the agent chat page.

@foreleven
Copy link
Copy Markdown
Collaborator

I think this would be cleaner as a separate useThreadSettings hook rather than extending useLocalSettings with thread-specific behavior. useLocalSettings reads like global user settings, but this logic only applies when a thread is present and only affects that thread’s selection. Keeping them separate would make the API clearer and avoid mixing global settings with per-thread overrides.

@LittleChenLiya
Copy link
Copy Markdown
Contributor Author

已按建议拆分,新增了 useThreadSettings 来承载 thread-specific 的 model override,useLocalSettings 现在只保留全局设置语义,这样职责会更清晰一些。

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.

[Bug] Model selection is shared across all threads/agents

3 participants