Skip to content

fix: make default model reflect immediately on new room page upon switch - #3378

Open
ekim1707 wants to merge 18 commits into
devfrom
1357-default-model-hotfix
Open

fix: make default model reflect immediately on new room page upon switch#3378
ekim1707 wants to merge 18 commits into
devfrom
1357-default-model-hotfix

Conversation

@ekim1707

@ekim1707 ekim1707 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

This is a fix on earlier 1357 default model branch to make the new room page default model dropdown reflect immediately as soon as user changes default model on the Models page

Changes Made

refreshProfileDefaultModel method added to chat.store.ts that makes backend GetUserInfo() call. Then useEffect added to trigger that method upon mount on new-room-page so that the default model change reflects instantly

How to Test

  1. Change default model in Models page
  2. Navigate to the new room page and see if the default model change was reflected

Notes

If the default model is changed on the UI, the change is not reflected in the Settings > My Profile page until after logout/login. This looks to be due to MobX in-memory state that only provides default model once upon login and is never resynced.

@snyk-io

snyk-io Bot commented Jul 9, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@ekim1707
ekim1707 requested review from ckelly17 and kzsb03 July 9, 2026 18:29
@ekim1707
ekim1707 marked this pull request as ready for review July 16, 2026 13:59
@ekim1707
ekim1707 requested a review from a team as a code owner July 16, 2026 13:59
refreshProfileDefaultModel = async (): Promise<void> => {
try {
// Use GetUserMetadata to bypass the GetUserInfo cache
const result = await this._actions.run<[Record<string, string[]>]>(

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.

should type this better, rather than leaving it generic Record

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'm not that familiar with typing, but does this look ok?

const result = await this._actions.run<[{ "text-generation-model"?: string | string[] }]>(
META | GetUserMetadata();,
);

// Run GetUserInfo and GetUserMetadata in parallel.
// GetUserMetadata bypasses the cache that GetUserInfo has, so it
// always returns the latest saved text-generation-model value.
const [userInfoResult, userMetaResult] = await Promise.allSettled([

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.

rather than like this, should just send both pixel calls in the same request like run(META | GetUserInfo(); META | GetUserMetadata(); )

@ekim1707 ekim1707 Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

getUser = async (): Promise => {
try {
const result = await this._actions.run<
[
Record<string, { id: string; name: string; lastLogin?: string }>,
UserMetadata,
]
>(META | GetUserInfo(); META | GetUserMetadata(););

put the both pixels calls in one request in bold. does this check out?

Comment thread packages/playground/src/stores/chat/chat.store.ts

const meta = result.pixelReturn[0].output;
const metaValue = meta?.["text-generation-model"];
const newModelId = Array.isArray(metaValue)

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.

you could make this a helper (cuz it's used in 2 places) but not a huge deal

Comment thread packages/playground/src/stores/chat/chat.store.ts
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.

2 participants