fix: make default model reflect immediately on new room page upon switch - #3378
fix: make default model reflect immediately on new room page upon switch#3378ekim1707 wants to merge 18 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…efault-model-hotfix
| refreshProfileDefaultModel = async (): Promise<void> => { | ||
| try { | ||
| // Use GetUserMetadata to bypass the GetUserInfo cache | ||
| const result = await this._actions.run<[Record<string, string[]>]>( |
There was a problem hiding this comment.
should type this better, rather than leaving it generic Record
There was a problem hiding this comment.
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([ |
There was a problem hiding this comment.
rather than like this, should just send both pixel calls in the same request like run(META | GetUserInfo(); META | GetUserMetadata(); )
There was a problem hiding this comment.
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?
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
…efault-model-hotfix
|
|
||
| const meta = result.pixelReturn[0].output; | ||
| const metaValue = meta?.["text-generation-model"]; | ||
| const newModelId = Array.isArray(metaValue) |
There was a problem hiding this comment.
you could make this a helper (cuz it's used in 2 places) but not a huge deal
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
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.