Skip to content

Fix wrong model after login (#213) #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sharp-colts-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Fix wrong model after login (#213)
22 changes: 14 additions & 8 deletions webview-ui/src/components/settings/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,22 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, o
// kilocode_change start
// Temporary way of making sure that the Settings view updates its local state properly when receiving
// api keys from providers that support url callbacks. This whole Settings View needs proper with this local state thing later
const { kilocodeToken, openRouterApiKey, glamaApiKey, requestyApiKey } = extensionState.apiConfiguration ?? {}
useEffect(() => {
setCachedState((prevCachedState) => ({ ...prevCachedState, ...extensionState }))
setChangeDetected(false)
setCachedState((prevCachedState) => ({
...prevCachedState,
apiConfiguration: {
...prevCachedState.apiConfiguration,
// Only set specific tokens/keys instead of spreading the entire
// `prevCachedState.apiConfiguration` since it may contain unsaved changes
kilocodeToken,
openRouterApiKey,
glamaApiKey,
requestyApiKey,
},
}))
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
extensionState.apiConfiguration?.kilocodeToken,
extensionState.apiConfiguration?.openRouterApiKey,
extensionState.apiConfiguration?.glamaApiKey,
extensionState.apiConfiguration?.requestyApiKey,
])
}, [kilocodeToken, openRouterApiKey, glamaApiKey, requestyApiKey])

useEffect(() => {
// Only update if we're not already detecting changes
Expand Down