From bd6cfb047fd94a63239a73d1912e006fc5dc5596 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 26 Feb 2025 16:00:19 -0800 Subject: [PATCH 1/9] refresh profiles button on 401 --- core/config/ConfigHandler.ts | 14 ++++--- core/core.ts | 4 ++ core/protocol/core.ts | 1 + core/protocol/passThrough.ts | 1 + docs/docs/yaml-reference.md | 36 +++++++++--------- .../constants/MessageTypes.kt | 1 + gui/src/context/Auth.tsx | 10 +++++ gui/src/pages/gui/StreamError.tsx | 37 ++++++++++++++----- 8 files changed, 72 insertions(+), 32 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index b9a0f0896..84d578620 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -353,11 +353,7 @@ export class ConfigHandler { Promise.resolve(sessionInfo), this.ideSettingsPromise, ); - this.fetchControlPlaneProfiles().catch(async (e) => { - console.error("Failed to fetch control plane profiles: ", e); - await this.updateAvailableProfiles([this.localProfileManager]); - await this.reloadConfig(); - }); + await this.refreshProfiles(); } private profilesListeners: (( @@ -435,6 +431,14 @@ export class ConfigHandler { return this.profiles?.map((p) => p.profileDescription) ?? null; } + async refreshProfiles() { + this.fetchControlPlaneProfiles().catch(async (e) => { + console.error("Failed to fetch control plane profiles: ", e); + await this.updateAvailableProfiles([this.localProfileManager]); + await this.reloadConfig(); + }); + } + async loadConfig(): Promise> { if (!this.currentProfile) { return { diff --git a/core/core.ts b/core/core.ts index 00d141117..57e0117be 100644 --- a/core/core.ts +++ b/core/core.ts @@ -306,6 +306,10 @@ export class Core { return this.configHandler.listProfiles(); }); + on("config/refreshProfiles", async (msg) => { + await this.configHandler.refreshProfiles(); + }); + on("config/addContextProvider", async (msg) => { addContextProvider(msg.data, this.configHandler); }); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 0a3913590..ac991622a 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -69,6 +69,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { "config/addContextProvider": [ContextProviderWithParams, void]; "config/reload": [undefined, ConfigResult]; "config/listProfiles": [undefined, ProfileDescription[] | null]; + "config/refreshProfiles": [undefined, void]; "config/openProfile": [{ profileId: string | undefined }, void]; "config/updateSharedConfig": [SharedConfigSchema, SharedConfigSchema]; "config/updateSelectedModel": [ diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index d3a7259f2..ef71c66a1 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -22,6 +22,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "config/getSerializedProfileInfo", "config/deleteModel", "config/listProfiles", + "config/refreshProfiles", "config/openProfile", "config/updateSharedConfig", "config/updateSelectedModel", diff --git a/docs/docs/yaml-reference.md b/docs/docs/yaml-reference.md index 126199f05..dd461cd97 100644 --- a/docs/docs/yaml-reference.md +++ b/docs/docs/yaml-reference.md @@ -435,26 +435,26 @@ model_defaults: &model_defaults apiBase: https://api.example.com/llm models: -- name: mistral - <<: *model_defaults - model: mistral-7b-instruct - roles: - - chat - - edit + - name: mistral + <<: *model_defaults + model: mistral-7b-instruct + roles: + - chat + - edit -- name: qwen2.5-coder-7b-instruct - <<: *model_defaults - model: qwen2.5-coder-7b-instruct - roles: - - chat - - edit + - name: qwen2.5-coder-7b-instruct + <<: *model_defaults + model: qwen2.5-coder-7b-instruct + roles: + - chat + - edit -- name: qwen2.5-coder-7b - <<: *model_defaults - model: qwen2.5-coder-7b - useLegacyCompletionsEndpoint: false - roles: - - autocomplete + - name: qwen2.5-coder-7b + <<: *model_defaults + model: qwen2.5-coder-7b + useLegacyCompletionsEndpoint: false + roles: + - autocomplete ``` ### Fully deprecated settings diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt index bfbe614cc..e71401b15 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt @@ -89,6 +89,7 @@ class MessageTypes { "config/getSerializedProfileInfo", "config/deleteModel", "config/listProfiles", + "config/refreshProfiles", "config/openProfile", "config/updateSharedConfig", "config/updateSelectedModel", diff --git a/gui/src/context/Auth.tsx b/gui/src/context/Auth.tsx index 967db1321..d5ec8fa42 100644 --- a/gui/src/context/Auth.tsx +++ b/gui/src/context/Auth.tsx @@ -27,6 +27,7 @@ interface AuthContextType { login: (useOnboarding: boolean) => Promise; selectedProfile: ProfileDescription | null; profiles: ProfileDescription[] | null; + refreshProfiles: () => void; controlServerBetaEnabled: boolean; organizations: OrganizationDescription[]; selectedOrganization: OrganizationDescription | null; @@ -175,6 +176,14 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ }); }, []); + const refreshProfiles = () => { + try { + ideMessenger.post("config/refreshProfiles", undefined); + } catch (e) { + console.error("Failed to refresh profiles", e); + } + }; + useWebviewListener( "didChangeAvailableProfiles", async (data) => { @@ -196,6 +205,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ login, selectedProfile, profiles, + refreshProfiles, selectedOrganization, organizations: orgs, controlServerBetaEnabled, diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx index 2a8465c30..38da7df22 100644 --- a/gui/src/pages/gui/StreamError.tsx +++ b/gui/src/pages/gui/StreamError.tsx @@ -1,14 +1,17 @@ -import { Cog8ToothIcon, ListBulletIcon } from "@heroicons/react/24/outline"; -import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { useContext } from "react"; -import { GithubIcon } from "../../components/svg/GithubIcon"; -import { DiscordIcon } from "../../components/svg/DiscordIcon"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { Cog8ToothIcon } from "@heroicons/react/24/outline"; import { DISCORD_LINK, GITHUB_LINK } from "core/util/constants"; -import { selectDefaultModel } from "../../redux/slices/configSlice"; -import { providers } from "../AddNewModel/configs/providers"; +import { useContext } from "react"; import { Button, SecondaryButton } from "../../components"; +import { DiscordIcon } from "../../components/svg/DiscordIcon"; +import { GithubIcon } from "../../components/svg/GithubIcon"; +import { useAuth } from "../../context/Auth"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; +import { selectUseHub } from "../../redux/selectors"; +import { selectDefaultModel } from "../../redux/slices/configSlice"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; +import { isLocalProfile } from "../../util"; +import { providers } from "../AddNewModel/configs/providers"; interface StreamErrorProps { error: unknown; @@ -17,6 +20,11 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { const dispatch = useAppDispatch(); const ideMessenger = useContext(IdeMessengerContext); const selectedModel = useAppSelector(selectDefaultModel); + const hubEnabled = useAppSelector(selectUseHub); + const selectedProfile = useAppSelector( + (store) => store.session.selectedProfile, + ); + const { session, refreshProfiles } = useAuth(); // Collect model information to display useful error info let modelTitle = "Chat model"; @@ -139,7 +147,18 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { if (statusCode === 401) { errorContent = (
- {`Likely cause: your API key is invalid.`} + {hubEnabled && + session && + selectedProfile && + !isLocalProfile(selectedProfile) && ( +
+ {`If your hub secret values may have changed, refresh your profiles`} + + Refresh profile secrets + +
+ )} + {`It's possible that your API key is invalid.`}
{checkKeysButton} {configButton} From fb2d2907f77c800a32d2f3559feb68ec2ed5e24a Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 26 Feb 2025 16:07:01 -0800 Subject: [PATCH 2/9] refresh profiles stream error dialog updates --- gui/src/pages/gui/StreamError.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx index 38da7df22..867cd044b 100644 --- a/gui/src/pages/gui/StreamError.tsx +++ b/gui/src/pages/gui/StreamError.tsx @@ -26,6 +26,12 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { ); const { session, refreshProfiles } = useAuth(); + const handleRefreshProfiles = () => { + refreshProfiles(); + dispatch(setShowDialog(false)); + dispatch(setDialogMessage(undefined)); + }; + // Collect model information to display useful error info let modelTitle = "Chat model"; let providerName = "the model provider"; @@ -151,9 +157,9 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { session && selectedProfile && !isLocalProfile(selectedProfile) && ( -
- {`If your hub secret values may have changed, refresh your profiles`} - +
+ {`If your hub secret values may have changed, refresh your assistants`} + Refresh profile secrets
From 84856e0331a40a71dba143ad31aeda449977c129 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 26 Feb 2025 16:12:02 -0800 Subject: [PATCH 3/9] refresh profiles done --- gui/src/context/Auth.tsx | 6 ++++-- gui/src/pages/config/index.tsx | 9 +++++++++ gui/src/pages/gui/StreamError.tsx | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gui/src/context/Auth.tsx b/gui/src/context/Auth.tsx index d5ec8fa42..807065019 100644 --- a/gui/src/context/Auth.tsx +++ b/gui/src/context/Auth.tsx @@ -176,11 +176,13 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ }); }, []); - const refreshProfiles = () => { + const refreshProfiles = async () => { try { - ideMessenger.post("config/refreshProfiles", undefined); + await ideMessenger.request("config/refreshProfiles", undefined); + ideMessenger.post("showToast", ["info", "Config refreshed"]); } catch (e) { console.error("Failed to refresh profiles", e); + ideMessenger.post("showToast", ["error", "Failed to refresh config"]); } }; diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index dcf1a6bf0..9f385c9c9 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -42,6 +42,7 @@ function ConfigPage() { selectedProfile, controlServerBetaEnabled, selectedOrganization, + refreshProfiles, } = useAuth(); const changeProfileId = (id: string) => { @@ -297,6 +298,14 @@ function ConfigPage() { : "Open Workspace"}
)} + {hubEnabled && session && ( +
+ {`If your hub secret values may have changed, refresh your assistants`} + + Refresh assistants + +
+ )} ) : (
Loading...
diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx index 867cd044b..36d3853b1 100644 --- a/gui/src/pages/gui/StreamError.tsx +++ b/gui/src/pages/gui/StreamError.tsx @@ -160,7 +160,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
{`If your hub secret values may have changed, refresh your assistants`} - Refresh profile secrets + Refresh assistant secrets
)} From cd04f0611d8387b569a52aab50667fc4a48b740c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 26 Feb 2025 16:16:03 -0800 Subject: [PATCH 4/9] remove refresh secrets from settings page --- gui/src/pages/config/index.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index 9f385c9c9..7a98248fe 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -42,7 +42,6 @@ function ConfigPage() { selectedProfile, controlServerBetaEnabled, selectedOrganization, - refreshProfiles, } = useAuth(); const changeProfileId = (id: string) => { @@ -298,14 +297,14 @@ function ConfigPage() { : "Open Workspace"} )} - {hubEnabled && session && ( + {/* {hubEnabled && session && (
{`If your hub secret values may have changed, refresh your assistants`} Refresh assistants
- )} + )} */} ) : (
Loading...
From 3ab0b388f27da59c2cad2fb5c0ce200f9fb9ebb9 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 26 Feb 2025 16:19:54 -0800 Subject: [PATCH 5/9] fix so actually reloads profiles --- core/config/ConfigHandler.ts | 12 ++++++------ core/core.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 84d578620..9f0bbc711 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -353,7 +353,11 @@ export class ConfigHandler { Promise.resolve(sessionInfo), this.ideSettingsPromise, ); - await this.refreshProfiles(); + this.fetchControlPlaneProfiles().catch(async (e) => { + console.error("Failed to fetch control plane profiles: ", e); + await this.updateAvailableProfiles([this.localProfileManager]); + await this.reloadConfig(); + }); } private profilesListeners: (( @@ -432,11 +436,7 @@ export class ConfigHandler { } async refreshProfiles() { - this.fetchControlPlaneProfiles().catch(async (e) => { - console.error("Failed to fetch control plane profiles: ", e); - await this.updateAvailableProfiles([this.localProfileManager]); - await this.reloadConfig(); - }); + await this.loadAssistantsForSelectedOrg(); } async loadConfig(): Promise> { diff --git a/core/core.ts b/core/core.ts index 57e0117be..6d78ca855 100644 --- a/core/core.ts +++ b/core/core.ts @@ -307,7 +307,7 @@ export class Core { }); on("config/refreshProfiles", async (msg) => { - await this.configHandler.refreshProfiles(); + await this.configHandler.loadAssistantsForSelectedOrg(); }); on("config/addContextProvider", async (msg) => { From c8311d98b9f9756869d142b9db360dbc9f618b40 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 26 Feb 2025 16:21:12 -0800 Subject: [PATCH 6/9] cleanup --- core/config/ConfigHandler.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 9f0bbc711..b9a0f0896 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -435,10 +435,6 @@ export class ConfigHandler { return this.profiles?.map((p) => p.profileDescription) ?? null; } - async refreshProfiles() { - await this.loadAssistantsForSelectedOrg(); - } - async loadConfig(): Promise> { if (!this.currentProfile) { return { From 792612a670b9a7d3e516e168330f03676dee3169 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 26 Feb 2025 16:37:16 -0800 Subject: [PATCH 7/9] thread message spacing, assistant label --- gui/src/pages/config/index.tsx | 136 +++++++++++++++++---------------- gui/src/pages/gui/Chat.tsx | 2 +- 2 files changed, 71 insertions(+), 67 deletions(-) diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index 7a98248fe..58ecd7be1 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -224,70 +224,76 @@ function ConfigPage() {

Configuration

{profiles ? ( <> - - {({ open }) => ( -
- - - {selectedProfile?.title ?? "No Assistant Selected"} - -
-
-
+
+ {`${hubEnabled ? "Assistant" : "Profile"}`} + + {({ open }) => ( +
+ + + {selectedProfile?.title ?? "No Assistant Selected"} + +
+
+
- - - {profiles.map((option, idx) => ( - - - {option.title} - - - ))} - {hubEnabled && ( - { - if (session) { - ideMessenger.post("controlPlane/openUrl", { - path: "new", - orgSlug: selectedOrganization?.slug, - }); - } else { - login(false); - } - }} - > - - - Create new Assistant - - - )} - - -
- )} -
+ + + {profiles.map((option, idx) => ( + + + {option.title} + + + ))} + {hubEnabled && ( + { + if (session) { + ideMessenger.post("controlPlane/openUrl", { + path: "new", + orgSlug: selectedOrganization?.slug, + }); + } else { + login(false); + } + }} + > + + + Create new Assistant + + + )} + + +
+ )} + +
{selectedProfile && ( {selectedProfile.id === "local" @@ -310,9 +316,7 @@ function ConfigPage() {
Loading...
)}
-

- Active Models -

+

Model Roles

Date: Wed, 26 Feb 2025 16:38:26 -0800 Subject: [PATCH 8/9] override copy --- docs/docs/yaml-reference.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/yaml-reference.md b/docs/docs/yaml-reference.md index dd461cd97..9de133cd7 100644 --- a/docs/docs/yaml-reference.md +++ b/docs/docs/yaml-reference.md @@ -69,7 +69,7 @@ Note that hub secrets can be passed as inputs, using the a similar mustache form ### Overrides -Block properties can be also be directly overriden using `overrides`. For example: +Block properties can be also be directly overriden using `override`. For example: ```yaml title="Assistant config.yaml" name: myprofile/custom-assistant @@ -78,7 +78,7 @@ models: with: ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }} TEMP: 0.9 - overrides: + override: roles: - chat ``` @@ -350,7 +350,7 @@ models: - uses: anthropic/claude-3.5-sonnet with: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - overrides: + override: defaultCompletionOptions: temperature: 0.8 - name: GPT-4 From 8480e4a7b57f3e31c767bb5b3f246ef4f02c4d40 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 26 Feb 2025 16:56:53 -0800 Subject: [PATCH 9/9] intermediate size --- gui/src/components/mainInput/InputToolbar.tsx | 4 ++-- gui/tailwind.config.cjs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 2f7c6a3b1..ace2ae991 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -126,7 +126,7 @@ function InputToolbar(props: InputToolbarProps) { } }} /> - + {!props.toolbarOptions?.hideUseCodebase && !isInEditMode && (