diff --git a/gui/src/pages/config/AccountButton.tsx b/gui/src/pages/config/AccountButton.tsx
new file mode 100644
index 000000000..fffc67a6b
--- /dev/null
+++ b/gui/src/pages/config/AccountButton.tsx
@@ -0,0 +1,48 @@
+import { Popover, Transition } from "@headlessui/react";
+import { UserCircleIcon } from "@heroicons/react/24/outline";
+import { Fragment } from "react";
+
+import { SecondaryButton } from "../../components";
+import { useAuth } from "../../context/Auth";
+
+export function AccountButton() {
+ const { session, logout, login } = useAuth();
+
+ if (!session) {
+ return (
+
login(false)}>Sign in
+ );
+ }
+
+ return (
+
+
+
+
+
+
+
+
+
+ {session.account.label}
+
+ {session.account.id}
+
+
+
+ Sign out
+
+
+
+
+
+ );
+}
diff --git a/gui/src/pages/config/ScopeSelect.tsx b/gui/src/pages/config/ScopeSelect.tsx
index c67f68241..2d42483a0 100644
--- a/gui/src/pages/config/ScopeSelect.tsx
+++ b/gui/src/pages/config/ScopeSelect.tsx
@@ -5,6 +5,7 @@ import {
UserCircleIcon,
} from "@heroicons/react/24/outline";
import { useAuth } from "../../context/Auth";
+import { useWebviewListener } from "../../hooks/useWebviewListener";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import { selectOrgThunk } from "../../redux/thunks/profileAndOrg";
@@ -19,6 +20,10 @@ export function ScopeSelect() {
dispatch(selectOrgThunk(newValue));
};
+ useWebviewListener("didSelectOrganization", async (data) => {
+ handleChange(data.orgId);
+ });
+
const CurScopeEntityFallBackIcon = selectedOrgId
? BuildingOfficeIcon
: UserCircleIcon;
diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx
index 79c81a221..3cf9b84a2 100644
--- a/gui/src/pages/config/index.tsx
+++ b/gui/src/pages/config/index.tsx
@@ -1,6 +1,7 @@
import { ModelRole } from "@continuedev/config-yaml";
import { Listbox, Transition } from "@headlessui/react";
import {
+ ArrowTopRightOnSquareIcon,
CheckIcon,
ChevronUpDownIcon,
PlusCircleIcon,
@@ -13,16 +14,21 @@ import {
} from "core/config/sharedConfig";
import { Fragment, useContext, useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
-import { Input, SecondaryButton } from "../../components";
+import { Input } from "../../components";
import NumberInput from "../../components/gui/NumberInput";
import { Select } from "../../components/gui/Select";
import ToggleSwitch from "../../components/gui/Switch";
+import AssistantIcon from "../../components/modelSelection/platform/AssistantIcon";
import PageHeader from "../../components/PageHeader";
import { useAuth } from "../../context/Auth";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useNavigationListener } from "../../hooks/useNavigationListener";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
-import { setDefaultModel, updateConfig } from "../../redux/slices/configSlice";
+import {
+ selectDefaultModel,
+ setDefaultModel,
+ updateConfig,
+} from "../../redux/slices/configSlice";
import { selectProfileThunk } from "../../redux/thunks/profileAndOrg";
import { getFontSize, isJetBrains } from "../../util";
import ModelRoleSelector from "./ModelRoleSelector";
@@ -69,9 +75,7 @@ function ConfigPage() {
/////// User settings section //////
const config = useAppSelector((state) => state.config.config);
- const selectedChatModel = useAppSelector(
- (store) => store.config.defaultModelTitle,
- );
+ const selectedChatModel = useAppSelector(selectDefaultModel);
function handleUpdate(sharedConfig: SharedConfigSchema) {
// Optimistic update
@@ -177,56 +181,31 @@ function ConfigPage() {
return (
-
navigate("/")} title="Chat" />
+ navigate("/")} title="Chat" />
- {(session || hubEnabled || controlServerBetaEnabled) && (
-
-
-
Account
- {!session ? (
-
- You are not signed in.
- login(false)}>
- Sign in
-
-
- ) : (
-
- {hubEnabled ? (
- // Hub: show org selector
-
- {`Organization`}
-
-
- ) : (
- // Continue for teams: show org text
-
You are using Continue for Teams
- )}
-
-
- {session.account.label === ""
- ? "Signed in"
- : `Signed in as ${session.account.label}`}
-
- {`Sign out`}
-
-
- )}
-
-
- )}
-
Configuration
+ {hubEnabled ? (
+ // Hub: show org selector
+ session && (
+
+ {`Organization`}
+
+
+ )
+ ) : (
+ // Continue for teams: show org text
+
You are using Continue for Teams
+ )}
+
{profiles ? (
<>
-
{`${hubEnabled ? "Assistant" : "Profile"}`}
+
+ {`${hubEnabled ? "Assistant" : "Profile"}`}
+
(
-
- {selectedProfile?.title ?? "No Assistant Selected"}
-
+
+ {selectedProfile && (
+
+ )}
+
+ {selectedProfile?.title ??
+ "No Assistant Selected"}
+
+
+
{option.title}
@@ -291,87 +277,93 @@ function ConfigPage() {
)}
+
+ {selectedProfile && (
+
+
+
+ {hubEnabled
+ ? "Open Assistant configuration"
+ : "View Workspace"}
+
+
+ )}
)}
- {selectedProfile && (
-
- {selectedProfile.id === "local"
- ? "Open Config File"
- : hubEnabled
- ? "Open Assistant"
- : "Open Workspace"}
-
- )}
- {/* {hubEnabled && session && (
-
- {`If your hub secret values may have changed, refresh your assistants`}
-
- Refresh assistants
-
-
- )} */}
>
) : (
Loading...
)}
-
+
+ {/* Model Roles as a separate section */}
+
+
+
Model Roles
+
+ handleChatModelSelection(model)}
+ />
+ handleRoleUpdate("autocomplete", model)}
+ />
+ {/* Jetbrains has a model selector inline */}
+ {!jetbrains && (
handleChatModelSelection(model)}
+ displayName="Edit"
+ description="Used for inline edits"
+ models={config.modelsByRole.edit}
+ selectedModel={config.selectedModelByRole.edit}
+ onSelect={(model) => handleRoleUpdate("edit", model)}
/>
- handleRoleUpdate("autocomplete", model)}
- />
- {/* Jetbrains has a model selector inline */}
- {!jetbrains && (
- handleRoleUpdate("edit", model)}
- />
- )}
- handleRoleUpdate("apply", model)}
- />
- handleRoleUpdate("embed", model)}
- />
- handleRoleUpdate("rerank", model)}
- />
-
+ )}
+
handleRoleUpdate("apply", model)}
+ />
+ handleRoleUpdate("embed", model)}
+ />
+ handleRoleUpdate("rerank", model)}
+ />
+
{!controlServerBetaEnabled || hubEnabled ? (
@@ -476,25 +468,6 @@ function ConfigPage() {
text="Use Chromium for Docs Crawling"
/>
-
-
- Codeblock Actions Position
-
-
- handleUpdate({
- codeBlockToolbarPosition: e.target.value as
- | "top"
- | "bottom",
- })
- }
- >
- Top
- Bottom
-
-
-
Multiline Autocompletions
@@ -528,48 +501,6 @@ function ConfigPage() {
/>
-
+ ) : item.message.role === "thinking" ? (
+
0 ? history[index - 1] : null}
+ inProgress={index === history.length - 1}
+ signature={item.message.signature}
+ />
) : (
)}
+ {!hasDismissedExploreDialog && }
+
{history.length === 0 && (
<>
{onboardingCard.show && (
@@ -587,6 +554,12 @@ export function Chat() {
)}
+
+ {!onboardingCard.show && showTutorialCard === false && (
+
+
+
+ )}
>
)}
diff --git a/gui/src/pages/gui/ExploreDialogWatcher.tsx b/gui/src/pages/gui/ExploreDialogWatcher.tsx
new file mode 100644
index 000000000..2bea99d9d
--- /dev/null
+++ b/gui/src/pages/gui/ExploreDialogWatcher.tsx
@@ -0,0 +1,40 @@
+import { useWebviewListener } from "../../hooks/useWebviewListener";
+import { useAppDispatch } from "../../redux/hooks";
+import { setIsExploreDialogOpen } from "../../redux/slices/uiSlice";
+import {
+ getLocalStorage,
+ LocalStorageKey,
+ setLocalStorage,
+} from "../../util/localStorage";
+
+const useTutorialListener = (onTutorialClosed: () => void) => {
+ useWebviewListener("didCloseFiles", async (data) => {
+ const uris = data?.uris ?? [];
+
+ const isTutorial = uris.some((uri) => {
+ const lowercaseUri = uri.toLowerCase();
+ return (
+ lowercaseUri.endsWith("continue_tutorial.py") ||
+ lowercaseUri.endsWith("continue_tutorial.java") ||
+ lowercaseUri.endsWith("continue_tutorial.ts")
+ );
+ });
+
+ if (isTutorial) {
+ onTutorialClosed();
+ }
+ });
+};
+
+export const ExploreDialogWatcher = () => {
+ const dispatch = useAppDispatch();
+
+ useTutorialListener(() => {
+ setLocalStorage(LocalStorageKey.IsExploreDialogOpen, true);
+
+ if (!getLocalStorage(LocalStorageKey.HasDismissedExploreDialog)) {
+ dispatch(setIsExploreDialogOpen(true));
+ }
+ });
+ return null;
+};
diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx
index 635a9ae3e..7e372720c 100644
--- a/gui/src/pages/gui/StreamError.tsx
+++ b/gui/src/pages/gui/StreamError.tsx
@@ -100,7 +100,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
-
Open config
+
Open Assistant configuration
);
diff --git a/gui/src/pages/gui/useAutoScroll.ts b/gui/src/pages/gui/useAutoScroll.ts
new file mode 100644
index 000000000..a787e7ec9
--- /dev/null
+++ b/gui/src/pages/gui/useAutoScroll.ts
@@ -0,0 +1,53 @@
+import { useEffect, useState } from "react";
+
+export const useAutoScroll = (
+ ref: React.RefObject
,
+ history: unknown[],
+) => {
+ const [userHasScrolled, setUserHasScrolled] = useState(false);
+
+ useEffect(() => {
+ if (history.length) {
+ setUserHasScrolled(false);
+ }
+ }, [history.length]);
+
+ useEffect(() => {
+ if (!ref.current || history.length === 0) return;
+
+ const handleScroll = () => {
+ const elem = ref.current;
+ if (!elem) return;
+
+ const isAtBottom =
+ Math.abs(elem.scrollHeight - elem.scrollTop - elem.clientHeight) < 1;
+
+ /**
+ * We stop auto scrolling if a user manually scrolled up.
+ * We resume auto scrolling if a user manually scrolled to the bottom.
+ */
+ setUserHasScrolled(!isAtBottom);
+ };
+
+ const resizeObserver = new ResizeObserver(() => {
+ const elem = ref.current;
+ if (!elem || userHasScrolled) return;
+ elem.scrollTop = elem.scrollHeight;
+ });
+
+ ref.current.addEventListener("scroll", handleScroll);
+
+ // Observe the container
+ resizeObserver.observe(ref.current);
+
+ // Observe all immediate children
+ Array.from(ref.current.children).forEach((child) => {
+ resizeObserver.observe(child);
+ });
+
+ return () => {
+ resizeObserver.disconnect();
+ ref.current?.removeEventListener("scroll", handleScroll);
+ };
+ }, [ref, history.length, userHasScrolled]);
+};
diff --git a/gui/src/pages/history/index.tsx b/gui/src/pages/history/index.tsx
index 0d3c3429e..024f06886 100644
--- a/gui/src/pages/history/index.tsx
+++ b/gui/src/pages/history/index.tsx
@@ -8,7 +8,7 @@ export default function HistoryPage() {
return (
-
navigate("/")} title="Chat" />
+ navigate("/")} title="Chat" />
);
diff --git a/gui/src/redux/slices/configSlice.ts b/gui/src/redux/slices/configSlice.ts
index 3b5c55137..39cf8bb60 100644
--- a/gui/src/redux/slices/configSlice.ts
+++ b/gui/src/redux/slices/configSlice.ts
@@ -6,46 +6,48 @@ import { DEFAULT_MAX_TOKENS } from "core/llm/constants";
export type ConfigState = {
configError: ConfigValidationError[] | undefined;
config: BrowserSerializedContinueConfig;
- defaultModelTitle: string;
+ defaultModelTitle?: string;
+};
+
+const EMPTY_CONFIG: BrowserSerializedContinueConfig = {
+ slashCommands: [
+ {
+ name: "share",
+ description: "Export the current chat session to markdown",
+ },
+ {
+ name: "cmd",
+ description: "Generate a shell command",
+ },
+ ],
+ contextProviders: [],
+ models: [],
+ tools: [],
+ usePlatform: true,
+ modelsByRole: {
+ chat: [],
+ apply: [],
+ edit: [],
+ summarize: [],
+ autocomplete: [],
+ rerank: [],
+ embed: [],
+ },
+ selectedModelByRole: {
+ chat: null,
+ apply: null,
+ edit: null,
+ summarize: null,
+ autocomplete: null,
+ rerank: null,
+ embed: null,
+ },
};
const initialState: ConfigState = {
configError: undefined,
- defaultModelTitle: "GPT-4",
- config: {
- slashCommands: [
- {
- name: "share",
- description: "Export the current chat session to markdown",
- },
- {
- name: "cmd",
- description: "Generate a shell command",
- },
- ],
- contextProviders: [],
- models: [],
- tools: [],
- usePlatform: true,
- modelsByRole: {
- chat: [],
- apply: [],
- edit: [],
- summarize: [],
- autocomplete: [],
- rerank: [],
- embed: [],
- },
- selectedModelByRole: {
- chat: null,
- apply: null,
- edit: null,
- summarize: null,
- autocomplete: null,
- rerank: null,
- embed: null,
- },
- },
+ defaultModelTitle: undefined,
+ config: EMPTY_CONFIG,
};
export const configSlice = createSlice({
@@ -61,17 +63,19 @@ export const configSlice = createSlice({
const { config, errors } = result;
state.configError = errors;
+ // If an error is found in config on save,
+ // We must invalidate the GUI config too,
+ // Since core won't be able to load config
+ // Don't invalidate the loaded config
if (!config) {
- return;
+ state.config = EMPTY_CONFIG;
+ state.defaultModelTitle = undefined;
+ } else {
+ state.config = config;
+ state.defaultModelTitle =
+ config.models.find((model) => model.title === state.defaultModelTitle)
+ ?.title || config.models[0]?.title;
}
-
- const defaultModelTitle =
- config.models.find((model) => model.title === state.defaultModelTitle)
- ?.title ||
- config.models[0]?.title ||
- "";
- state.config = config;
- state.defaultModelTitle = defaultModelTitle;
},
updateConfig: (
state,
@@ -79,12 +83,6 @@ export const configSlice = createSlice({
) => {
state.config = config;
},
- setConfigError: (
- state,
- { payload: error }: PayloadAction,
- ) => {
- state.configError = error;
- },
setDefaultModel: (
state,
{ payload }: PayloadAction<{ title: string; force?: boolean }>,
@@ -136,7 +134,6 @@ export const {
cycleDefaultModel,
updateConfig,
setConfigResult,
- setConfigError,
} = configSlice.actions;
export const {
diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts
index be4d3aa77..04bb7ab19 100644
--- a/gui/src/redux/slices/sessionSlice.ts
+++ b/gui/src/redux/slices/sessionSlice.ts
@@ -294,6 +294,7 @@ export const sessionSlice = createSlice({
state.streamAborter = new AbortController();
},
streamUpdate: (state, action: PayloadAction) => {
+
if (state.history.length) {
function toolCallDeltaToState(
toolCallDelta: ToolCallDelta,
@@ -319,6 +320,22 @@ export const sessionSlice = createSlice({
for (const message of action.payload) {
const lastItem = state.history[state.history.length - 1];
const lastMessage = lastItem.message;
+
+ if (message.role === "thinking" && message.redactedThinking) {
+ console.log("add redacted_thinking blocks");
+
+ state.history.push({
+ message: {
+ role: "thinking",
+ content: "internal reasoning is hidden due to safety reasons",
+ redactedThinking: message.redactedThinking,
+ id: uuidv4(),
+ },
+ contextItems: [],
+ })
+ continue;
+ }
+
if (
lastMessage.role !== message.role ||
// This is for when a tool call comes immediately before/after tool call
@@ -382,6 +399,11 @@ export const sessionSlice = createSlice({
// was already rendered from parts to string
lastMessage.content += messageContent;
}
+ } else if (message.role === "thinking" && message.signature) {
+ if (lastMessage.role === "thinking") {
+ console.log("add signature", message.signature);
+ lastMessage.signature = message.signature;
+ }
} else if (
message.role === "assistant" &&
message.toolCalls?.[0] &&
diff --git a/gui/src/redux/slices/uiSlice.ts b/gui/src/redux/slices/uiSlice.ts
index 4751fed5c..8b03d30f3 100644
--- a/gui/src/redux/slices/uiSlice.ts
+++ b/gui/src/redux/slices/uiSlice.ts
@@ -5,6 +5,7 @@ import {
defaultOnboardingCardState,
OnboardingCardState,
} from "../../components/OnboardingCard";
+import { getLocalStorage, LocalStorageKey } from "../../util/localStorage";
type ToolSetting =
| "allowedWithPermission"
@@ -16,6 +17,8 @@ type UIState = {
dialogMessage: string | JSX.Element | undefined;
dialogEntryOn: boolean;
onboardingCard: OnboardingCardState;
+ isExploreDialogOpen: boolean;
+ hasDismissedExploreDialog: boolean;
shouldAddFileForEditing: boolean;
useTools: boolean;
toolSettings: { [toolName: string]: ToolSetting };
@@ -31,6 +34,10 @@ export const uiSlice = createSlice({
dialogMessage: "",
dialogEntryOn: false,
onboardingCard: defaultOnboardingCardState,
+ isExploreDialogOpen: getLocalStorage(LocalStorageKey.IsExploreDialogOpen),
+ hasDismissedExploreDialog: getLocalStorage(
+ LocalStorageKey.HasDismissedExploreDialog,
+ ),
shouldAddFileForEditing: false,
ttsActive: false,
useTools: false,
@@ -67,14 +74,22 @@ export const uiSlice = createSlice({
setShowDialog: (state, action: PayloadAction) => {
state.showDialog = action.payload;
},
+ setIsExploreDialogOpen: (
+ state,
+ action: PayloadAction,
+ ) => {
+ state.isExploreDialogOpen = action.payload;
+ },
+ setHasDismissedExploreDialog: (state, action: PayloadAction) => {
+ state.hasDismissedExploreDialog = action.payload;
+ },
// Tools
toggleUseTools: (state) => {
state.useTools = !state.useTools;
},
addTool: (state, action: PayloadAction) => {
- state.toolSettings[action.payload.function.name] = action.payload.readonly
- ? "allowedWithoutPermission"
- : "allowedWithPermission";
+ state.toolSettings[action.payload.function.name] =
+ "allowedWithPermission";
},
toggleToolSetting: (state, action: PayloadAction) => {
const setting = state.toolSettings[action.payload];
@@ -105,6 +120,8 @@ export const {
setDialogMessage,
setDialogEntryOn,
setShowDialog,
+ setIsExploreDialogOpen,
+ setHasDismissedExploreDialog,
toggleUseTools,
toggleToolSetting,
addTool,
diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts
index e77ca3ef9..fb3deec79 100644
--- a/gui/src/redux/store.ts
+++ b/gui/src/redux/store.ts
@@ -14,8 +14,8 @@ import editModeStateReducer from "./slices/editModeState";
import indexingReducer from "./slices/indexingSlice";
import miscReducer from "./slices/miscSlice";
import sessionReducer from "./slices/sessionSlice";
-import uiReducer from "./slices/uiSlice";
import tabsReducer from "./slices/tabsSlice";
+import uiReducer from "./slices/uiSlice";
export interface ChatMessage {
role: "system" | "user" | "assistant";
@@ -68,18 +68,21 @@ const migrations: MigrationManifest = {
return {
config: {
- defaultModelTitle: oldState?.state?.defaultModelTitle ?? "GPT-4",
+ defaultModelTitle: oldState?.state?.defaultModelTitle ?? undefined,
},
session: {
history: oldState?.state?.history ?? [],
id: oldState?.state?.sessionId ?? "",
},
tabs: {
- tabs: [{
- id: Date.now().toString(36) + Math.random().toString(36).substring(2),
- title: "Chat 1",
- isActive: true
- }]
+ tabs: [
+ {
+ id:
+ Date.now().toString(36) + Math.random().toString(36).substring(2),
+ title: "Chat 1",
+ isActive: true,
+ },
+ ],
},
_persist: oldState?._persist,
};
diff --git a/gui/src/redux/thunks/callTool.ts b/gui/src/redux/thunks/callTool.ts
index 0bd367587..75b075288 100644
--- a/gui/src/redux/thunks/callTool.ts
+++ b/gui/src/redux/thunks/callTool.ts
@@ -1,7 +1,9 @@
import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit";
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
+import { selectDefaultModel } from "../slices/configSlice";
import {
acceptToolCall,
+ cancelToolCall,
setCalling,
setToolCallOutput,
} from "../slices/sessionSlice";
@@ -22,7 +24,8 @@ export const callTool = createAsyncThunk(
return;
}
- if (!state.config.defaultModelTitle) {
+ const defaultModel = selectDefaultModel(state);
+ if (!defaultModel) {
throw new Error("No model selected");
}
@@ -30,7 +33,7 @@ export const callTool = createAsyncThunk(
const result = await extra.ideMessenger.request("tools/call", {
toolCall: toolCallState.toolCall,
- selectedModelTitle: state.config.defaultModelTitle,
+ selectedModelTitle: defaultModel.title,
});
if (result.status === "success") {
@@ -47,9 +50,22 @@ export const callTool = createAsyncThunk(
);
unwrapResult(response);
} else {
- throw new Error(
- `Failed to call tool ${toolCallState.toolCall.function.name}: ${result.error}`,
+ dispatch(cancelToolCall());
+
+ const output = await dispatch(
+ streamResponseAfterToolCall({
+ toolCallId: toolCallState.toolCallId,
+ toolOutput: [
+ {
+ name: "Tool Call Failed",
+ description: "Tool Call Failed",
+ content: `The tool call failed with the message:\n\n${result.error}\n\nPlease try something else or request further instructions.`,
+ hidden: true,
+ },
+ ],
+ }),
);
+ unwrapResult(output);
}
},
);
diff --git a/gui/src/redux/thunks/cancelTool.ts b/gui/src/redux/thunks/cancelTool.ts
index 89c4e8e12..d46195674 100644
--- a/gui/src/redux/thunks/cancelTool.ts
+++ b/gui/src/redux/thunks/cancelTool.ts
@@ -1,4 +1,4 @@
-import { createAsyncThunk } from "@reduxjs/toolkit";
+import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit";
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
import { cancelToolCall } from "../slices/sessionSlice";
import { ThunkApiType } from "../store";
@@ -20,7 +20,7 @@ export const cancelTool = createAsyncThunk(
dispatch(cancelToolCall());
- dispatch(
+ const output = await dispatch(
streamResponseAfterToolCall({
toolCallId: toolCallState.toolCallId,
toolOutput: [
@@ -34,5 +34,6 @@ export const cancelTool = createAsyncThunk(
],
}),
);
+ unwrapResult(output);
},
);
diff --git a/gui/src/redux/thunks/gatherContext.ts b/gui/src/redux/thunks/gatherContext.ts
index 6b1f11db4..133363978 100644
--- a/gui/src/redux/thunks/gatherContext.ts
+++ b/gui/src/redux/thunks/gatherContext.ts
@@ -54,7 +54,7 @@ export const gatherContext = createAsyncThunk<
// Automatically use currently open file
if (!modifiers.noContext) {
- const usingFreeTrial = defaultModel?.provider === "free-trial";
+ const usingFreeTrial = defaultModel.provider === "free-trial";
const currentFileResponse = await extra.ideMessenger.request(
"context/getContextItems",
diff --git a/gui/src/redux/thunks/session.ts b/gui/src/redux/thunks/session.ts
index be43f725e..b5ef0ac9a 100644
--- a/gui/src/redux/thunks/session.ts
+++ b/gui/src/redux/thunks/session.ts
@@ -3,6 +3,7 @@ import { ChatMessage, Session, SessionMetadata } from "core";
import { NEW_SESSION_TITLE } from "core/util/constants";
import { renderChatMessage } from "core/util/messageContent";
import { IIdeMessenger } from "../../context/IdeMessenger";
+import { selectDefaultModel } from "../slices/configSlice";
import {
deleteSessionMetadata,
newSession,
@@ -166,10 +167,8 @@ export const saveCurrentSession = createAsyncThunk<
// Now save previous session and update chat title if relevant
let title = state.session.title;
if (title === NEW_SESSION_TITLE) {
- if (
- !state.config.config?.disableSessionTitles &&
- state.config.defaultModelTitle
- ) {
+ const defaultModel = selectDefaultModel(state);
+ if (!state.config.config?.disableSessionTitles && defaultModel) {
let assistantResponse = state.session.history
?.filter((h) => h.message.role === "assistant")[0]
?.message?.content?.toString();
@@ -180,7 +179,7 @@ export const saveCurrentSession = createAsyncThunk<
"chatDescriber/describe",
{
text: assistantResponse,
- selectedModelTitle: state.config.defaultModelTitle,
+ selectedModelTitle: defaultModel.title,
},
);
if (result.status === "success" && result.content) {
diff --git a/gui/src/util/index.ts b/gui/src/util/index.ts
index eb5fc2324..2636a3b67 100644
--- a/gui/src/util/index.ts
+++ b/gui/src/util/index.ts
@@ -108,5 +108,5 @@ export function updatedObj(old: any, pathToValue: { [key: string]: any }) {
}
export function isLocalProfile(profile: ProfileDescription): boolean {
- return profile.id === "local";
+ return profile.profileType === "local";
}
diff --git a/gui/src/util/localStorage.ts b/gui/src/util/localStorage.ts
index e80e4ceea..28d63b847 100644
--- a/gui/src/util/localStorage.ts
+++ b/gui/src/util/localStorage.ts
@@ -2,6 +2,8 @@ import { JSONContent } from "@tiptap/react";
import { OnboardingStatus } from "../components/OnboardingCard";
type LocalStorageTypes = {
+ isExploreDialogOpen: boolean;
+ hasDismissedExploreDialog: boolean;
onboardingStatus?: OnboardingStatus;
hasDismissedOnboardingCard: boolean;
mainTextEntryCounter: number;
@@ -17,6 +19,11 @@ type LocalStorageTypes = {
seenHubIntro: boolean;
};
+export enum LocalStorageKey {
+ IsExploreDialogOpen = "isExploreDialogOpen",
+ HasDismissedExploreDialog = "hasDismissedExploreDialog",
+}
+
export function getLocalStorage(
key: T,
): LocalStorageTypes[T] | undefined {
diff --git a/gui/src/util/test/render.tsx b/gui/src/util/test/render.tsx
index 478f766c6..95f1cbd2d 100644
--- a/gui/src/util/test/render.tsx
+++ b/gui/src/util/test/render.tsx
@@ -1,9 +1,10 @@
-import { PropsWithChildren } from "react";
-import { render } from "@testing-library/react";
import type { RenderOptions } from "@testing-library/react";
-import { Provider } from "react-redux";
+import { render } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
+import { PropsWithChildren } from "react";
+import { Provider } from "react-redux";
import { MemoryRouter, RouterProps } from "react-router-dom";
+import { AuthProvider } from "../../context/Auth";
import { setupStore } from "../../redux/store";
// As a basic setup, import your same slice reducers
@@ -29,7 +30,9 @@ export function renderWithProviders(
const Wrapper = ({ children }: PropsWithChildren) => (
- {children}
+
+ {children}
+
);
diff --git a/packages/config-yaml/package-lock.json b/packages/config-yaml/package-lock.json
index ba0912e4e..39d55afb1 100644
--- a/packages/config-yaml/package-lock.json
+++ b/packages/config-yaml/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@continuedev/config-yaml",
- "version": "1.0.51",
+ "version": "1.0.52",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@continuedev/config-yaml",
- "version": "1.0.51",
+ "version": "1.0.52",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json
index 7ef23a724..a54155fa6 100644
--- a/packages/config-yaml/package.json
+++ b/packages/config-yaml/package.json
@@ -1,6 +1,6 @@
{
"name": "@continuedev/config-yaml",
- "version": "1.0.54",
+ "version": "1.0.60",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/packages/config-yaml/src/index.ts b/packages/config-yaml/src/index.ts
index b64db7497..0a70b1c01 100644
--- a/packages/config-yaml/src/index.ts
+++ b/packages/config-yaml/src/index.ts
@@ -6,7 +6,9 @@ export * from "./load/clientRender.js";
export * from "./load/getBlockType.js";
export * from "./load/merge.js";
export * from "./load/proxySecretResolution.js";
+export * from "./load/typeGuards.js";
export * from "./load/unroll.js";
+export * from "./registryClient.js";
export * from "./schemas/data/index.js";
export * from "./schemas/index.js";
export * from "./schemas/models.js";
diff --git a/packages/config-yaml/src/load/getBlockType.ts b/packages/config-yaml/src/load/getBlockType.ts
index 680c3b644..a2cf56062 100644
--- a/packages/config-yaml/src/load/getBlockType.ts
+++ b/packages/config-yaml/src/load/getBlockType.ts
@@ -4,20 +4,18 @@ export type BlockType =
| "models"
| "context"
| "docs"
- | "tools"
| "mcpServers"
| "data"
| "rules"
| "prompts";
-export function getBlockType(block: ConfigYaml): BlockType {
+
+export function getBlockType(block: ConfigYaml): BlockType | undefined {
if (block.context?.length) {
return "context";
} else if (block.models?.length) {
return "models";
} else if (block.docs?.length) {
return "docs";
- } else if (block.tools?.length) {
- return "tools";
} else if (block.mcpServers?.length) {
return "mcpServers";
} else if (block.data?.length) {
@@ -27,6 +25,6 @@ export function getBlockType(block: ConfigYaml): BlockType {
} else if (block.prompts?.length) {
return "prompts";
} else {
- throw new Error("Unknown block type");
+ return undefined;
}
}
diff --git a/packages/config-yaml/src/load/merge.ts b/packages/config-yaml/src/load/merge.ts
index 590572edb..7acd7db7e 100644
--- a/packages/config-yaml/src/load/merge.ts
+++ b/packages/config-yaml/src/load/merge.ts
@@ -9,7 +9,6 @@ export function mergePackages(
models: [...(current.models ?? []), ...(incoming.models ?? [])],
context: [...(current.context ?? []), ...(incoming.context ?? [])],
data: [...(current.data ?? []), ...(incoming.data ?? [])],
- tools: [...(current.tools ?? []), ...(incoming.tools ?? [])],
mcpServers: [...(current.mcpServers ?? []), ...(incoming.mcpServers ?? [])],
rules: [...(current.rules ?? []), ...(incoming.rules ?? [])],
prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])],
diff --git a/packages/config-yaml/src/load/typeGuards.ts b/packages/config-yaml/src/load/typeGuards.ts
new file mode 100644
index 000000000..aae3f2ca5
--- /dev/null
+++ b/packages/config-yaml/src/load/typeGuards.ts
@@ -0,0 +1,13 @@
+import * as z from "zod";
+import { blockItemWrapperSchema } from "../schemas/index.js";
+
+export const isBlockItemWrapper = (
+ block: unknown,
+): block is z.infer<
+ ReturnType>
+> => {
+ const baseSchema = z.object({});
+ const schema = blockItemWrapperSchema(baseSchema);
+
+ return schema.safeParse(block).success;
+};
diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts
index 40bdcb2c8..cc8bc10eb 100644
--- a/packages/config-yaml/src/load/unroll.ts
+++ b/packages/config-yaml/src/load/unroll.ts
@@ -273,15 +273,7 @@ export async function unrollBlocks(
const sections: (keyof Omit<
ConfigYaml,
"name" | "version" | "rules" | "schema"
- >)[] = [
- "models",
- "context",
- "data",
- "tools",
- "mcpServers",
- "prompts",
- "docs",
- ];
+ >)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"];
// For each section, replace "uses/with" blocks with the real thing
for (const section of sections) {
diff --git a/packages/config-yaml/src/registryClient.ts b/packages/config-yaml/src/registryClient.ts
new file mode 100644
index 000000000..66e7f9549
--- /dev/null
+++ b/packages/config-yaml/src/registryClient.ts
@@ -0,0 +1,12 @@
+import { Registry } from "./interfaces/index.js";
+import { FullSlug } from "./interfaces/slugs.js";
+
+export class RegistryClient implements Registry {
+ async getContent(fullSlug: FullSlug): Promise {
+ const response = await fetch(
+ `https://api.continue.dev/registry/v1/${fullSlug.ownerSlug}/${fullSlug.packageSlug}/${fullSlug.versionSlug}`,
+ );
+ const data = await response.json();
+ return data.content;
+ }
+}
diff --git a/packages/config-yaml/src/schemas/index.ts b/packages/config-yaml/src/schemas/index.ts
index d6cb2299b..1ca03b0b6 100644
--- a/packages/config-yaml/src/schemas/index.ts
+++ b/packages/config-yaml/src/schemas/index.ts
@@ -7,13 +7,6 @@ export const contextSchema = z.object({
params: z.any().optional(),
});
-const toolSchema = z.object({
- name: z.string(),
- description: z.string(),
- run: z.string(),
- params: z.any().optional(),
-});
-
const mcpServerSchema = z.object({
name: z.string(),
command: z.string(),
@@ -66,7 +59,6 @@ export const configYamlSchema = baseConfigYamlSchema.extend({
.optional(),
context: z.array(blockOrSchema(contextSchema)).optional(),
data: z.array(blockOrSchema(dataSchema)).optional(),
- tools: z.array(blockOrSchema(toolSchema)).optional(),
mcpServers: z.array(blockOrSchema(mcpServerSchema)).optional(),
rules: z
.array(
@@ -89,7 +81,6 @@ export const assistantUnrolledSchema = baseConfigYamlSchema.extend({
models: z.array(modelSchema).optional(),
context: z.array(contextSchema).optional(),
data: z.array(dataSchema).optional(),
- tools: z.array(toolSchema).optional(),
mcpServers: z.array(mcpServerSchema).optional(),
rules: z.array(z.string()).optional(),
prompts: z.array(promptSchema).optional(),
@@ -103,7 +94,6 @@ export const blockSchema = baseConfigYamlSchema.and(
z.object({ models: z.array(modelSchema).length(1) }),
z.object({ context: z.array(contextSchema).length(1) }),
z.object({ data: z.array(dataSchema).length(1) }),
- z.object({ tools: z.array(toolSchema).length(1) }),
z.object({ mcpServers: z.array(mcpServerSchema).length(1) }),
z.object({ rules: z.array(z.string()).length(1) }),
z.object({ prompts: z.array(promptSchema).length(1) }),
diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts
index 1fd6247a6..ff3f6bec3 100644
--- a/packages/config-yaml/src/schemas/models.ts
+++ b/packages/config-yaml/src/schemas/models.ts
@@ -31,6 +31,14 @@ export const modelRolesSchema = z.enum([
]);
export type ModelRole = z.infer;
+// TODO consider just using array of strings for model capabilities
+// To allow more dynamic string parsing
+export const modelCapabilitySchema = z.union([
+ z.literal("tool_use"),
+ z.literal("image_input"),
+]);
+export type ModelCapability = z.infer;
+
export const completionOptionsSchema = z.object({
contextLength: z.number().optional(),
maxTokens: z.number().optional(),
@@ -61,6 +69,7 @@ const baseModelFields = {
apiKey: z.string().optional(),
apiBase: z.string().optional(),
roles: modelRolesSchema.array().optional(),
+ capabilities: modelCapabilitySchema.array().optional(),
defaultCompletionOptions: completionOptionsSchema.optional(),
requestOptions: requestOptionsSchema.optional(),
embedOptions: embedOptionsSchema.optional(),
diff --git a/packages/llm-info/src/providers/vertexai.ts b/packages/llm-info/src/providers/vertexai.ts
index 5e589679f..99faaf844 100644
--- a/packages/llm-info/src/providers/vertexai.ts
+++ b/packages/llm-info/src/providers/vertexai.ts
@@ -30,17 +30,17 @@ export const Gemini: ModelProvider = {
},
// embed
{
- model: "text-embedding-004",
+ model: "text-embedding-005",
displayName: "Vertex Text Embedding",
recommendedFor: ["embed"],
},
//autocomplete
{
- model: "code-gecko",
- displayName: "VertexAI Code Gecko",
- recommendedFor: ["autocomplete"],
- maxCompletionTokens: 64,
- }
+ model: "code-gecko",
+ displayName: "VertexAI Code Gecko",
+ recommendedFor: ["autocomplete"],
+ maxCompletionTokens: 64,
+ },
],
id: "gemini",
displayName: "Gemini",
diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json
index b2d293852..f11313bad 100644
--- a/packages/openai-adapters/package.json
+++ b/packages/openai-adapters/package.json
@@ -1,6 +1,6 @@
{
"name": "@continuedev/openai-adapters",
- "version": "1.0.15",
+ "version": "1.0.16",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/packages/openai-adapters/src/apis/Anthropic.ts b/packages/openai-adapters/src/apis/Anthropic.ts
index d8c5b0c44..04b0fbce9 100644
--- a/packages/openai-adapters/src/apis/Anthropic.ts
+++ b/packages/openai-adapters/src/apis/Anthropic.ts
@@ -71,6 +71,32 @@ export class AnthropicApi implements BaseLlmApi {
msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[],
): any[] {
const messages = msgs.map((message) => {
+ if (message.role === "tool") {
+ return {
+ role: "user",
+ content: [
+ {
+ type: "tool_result",
+ tool_use_id: message.tool_call_id,
+ content:
+ typeof message.content === "string"
+ ? message.content
+ : message.content.map((part) => part.text).join(""),
+ },
+ ],
+ };
+ } else if (message.role === "assistant" && message.tool_calls) {
+ return {
+ role: "assistant",
+ content: message.tool_calls.map((toolCall) => ({
+ type: "tool_use",
+ id: toolCall.id,
+ name: toolCall.function?.name,
+ input: JSON.parse(toolCall.function?.arguments || "{}"),
+ })),
+ };
+ }
+
if (!Array.isArray(message.content)) {
return message;
}
diff --git a/packages/openai-adapters/src/apis/Gemini.ts b/packages/openai-adapters/src/apis/Gemini.ts
index ae2235d25..c17527674 100644
--- a/packages/openai-adapters/src/apis/Gemini.ts
+++ b/packages/openai-adapters/src/apis/Gemini.ts
@@ -86,11 +86,50 @@ export class GeminiApi implements BaseLlmApi {
}
const isV1API = url.includes("/v1/");
+
+ const toolCallIdToNameMap = new Map();
const contents = oaiBody.messages
.map((msg) => {
if (msg.role === "system" && !isV1API) {
return null; // Don't include system message in contents
}
+
+ if (msg.role == "assistant" && msg.tool_calls?.length) {
+ for (const toolCall of msg.tool_calls) {
+ toolCallIdToNameMap.set(toolCall.id, toolCall.function.name);
+ }
+
+ return {
+ role: "model",
+ parts: msg.tool_calls.map((toolCall) => ({
+ functionCall: {
+ name: toolCall.function.name,
+ args: JSON.parse(toolCall.function.arguments || "{}"),
+ },
+ })),
+ };
+ }
+
+ if (msg.role === "tool") {
+ return {
+ role: "user",
+ parts: [
+ {
+ functionResponse: {
+ name: msg.tool_call_id,
+ response: {
+ name: toolCallIdToNameMap.get(msg.tool_call_id),
+ content:
+ typeof msg.content === "string"
+ ? msg.content
+ : msg.content.map((part) => part.text).join(""),
+ },
+ },
+ },
+ ],
+ };
+ }
+
if (!msg.content) {
return null;
}
@@ -246,9 +285,10 @@ export class GeminiApi implements BaseLlmApi {
`models/${body.model}:streamGenerateContent?key=${this.config.apiKey}`,
this.apiBase,
).toString();
+ const convertedBody = this._convertBody(body, apiURL);
const resp = await customFetch(this.config.requestOptions)(apiURL, {
method: "POST",
- body: JSON.stringify(this._convertBody(body, apiURL)),
+ body: JSON.stringify(convertedBody),
signal,
});
diff --git a/packages/openai-adapters/src/apis/OpenAI.ts b/packages/openai-adapters/src/apis/OpenAI.ts
index aa059f7db..358f52dca 100644
--- a/packages/openai-adapters/src/apis/OpenAI.ts
+++ b/packages/openai-adapters/src/apis/OpenAI.ts
@@ -14,7 +14,7 @@ import {
} from "openai/resources/index";
import { z } from "zod";
import { OpenAIConfigSchema } from "../types.js";
-import { maybeCustomFetch } from "../util.js";
+import { customFetch, maybeCustomFetch } from "../util.js";
import {
BaseLlmApi,
CreateRerankResponse,
@@ -31,7 +31,7 @@ export class OpenAIApi implements BaseLlmApi {
this.openai = new OpenAI({
apiKey: config.apiKey,
baseURL: this.apiBase,
- fetch: maybeCustomFetch(config.requestOptions),
+ fetch: customFetch(config.requestOptions),
});
}
@@ -100,7 +100,7 @@ export class OpenAIApi implements BaseLlmApi {
signal: AbortSignal,
): AsyncGenerator {
const endpoint = new URL("fim/completions", this.apiBase);
- const resp = await fetch(endpoint, {
+ const resp = await customFetch(this.config.requestOptions)(endpoint, {
method: "POST",
body: JSON.stringify({
model: body.model,
@@ -139,7 +139,7 @@ export class OpenAIApi implements BaseLlmApi {
async rerank(body: RerankCreateParams): Promise {
const endpoint = new URL("rerank", this.apiBase);
- const response = await fetch(endpoint, {
+ const response = await customFetch(this.config.requestOptions)(endpoint, {
method: "POST",
body: JSON.stringify(body),
headers: {
diff --git a/packages/openai-adapters/src/test/util.ts b/packages/openai-adapters/src/test/util.ts
index 5b1b52ab1..ba4490f2a 100644
--- a/packages/openai-adapters/src/test/util.ts
+++ b/packages/openai-adapters/src/test/util.ts
@@ -260,6 +260,65 @@ export function testChat(api: BaseLlmApi, model: string) {
const parsedArgs = JSON.parse(args);
expect(parsedArgs.name).toBe("Nate");
});
+
+ test("Tool Call second message works", async () => {
+ let response = "";
+ for await (const chunk of api.chatCompletionStream(
+ {
+ messages: [
+ {
+ role: "user",
+ content:
+ "Hi, my name is Nate. Please call the say_hello function to respond to me, then respond to me again.",
+ },
+ {
+ role: "assistant",
+ tool_calls: [
+ {
+ function: {
+ arguments: '{"name":"Nate"}',
+ name: "say_hello",
+ },
+ id: "tool_call_1",
+ type: "function",
+ },
+ ],
+ },
+ {
+ role: "tool",
+ tool_call_id: "tool_call_1",
+ content: "Nate was greeted",
+ },
+ ],
+ tools: [
+ {
+ function: {
+ name: "say_hello",
+ description: "Say Hello",
+ parameters: {
+ type: "object",
+ properties: {
+ name: {
+ type: "string",
+ description: "The name of the person to greet",
+ },
+ },
+ },
+ },
+ type: "function",
+ },
+ ],
+ stream: true,
+ model,
+ },
+ new AbortController().signal,
+ )) {
+ console.log(JSON.stringify(chunk, null, 2));
+ response += chunk.choices[0].delta.content ?? "";
+ }
+
+ expect(response.length).toBeGreaterThan(0);
+ });
}
export function testCompletion(api: BaseLlmApi, model: string) {
diff --git a/packages/openai-adapters/src/types.ts b/packages/openai-adapters/src/types.ts
index c59c8c8f7..30fd2cef0 100644
--- a/packages/openai-adapters/src/types.ts
+++ b/packages/openai-adapters/src/types.ts
@@ -54,6 +54,7 @@ export const OpenAIConfigSchema = BasePlusConfig.extend({
z.literal("vllm"),
z.literal("x-ai"),
z.literal("scaleway"),
+ z.literal("ncompass"),
]),
});
export type OpenAIConfig = z.infer;
diff --git a/scripts/install-dependencies.ps1 b/scripts/install-dependencies.ps1
index c9ded6a0e..8bf3596d0 100644
--- a/scripts/install-dependencies.ps1
+++ b/scripts/install-dependencies.ps1
@@ -25,6 +25,31 @@ if ($null -eq $node) {
& node --version
}
+# Node.js version check
+if (Test-Path ".nvmrc") {
+ $requiredNodeVersion = Get-Content ".nvmrc"
+ $currentNodeVersion = node -v
+
+ # Remove 'v' prefix from versions for comparison
+ $requiredVersion = $requiredNodeVersion.TrimStart('v')
+ $currentVersion = $currentNodeVersion.TrimStart('v')
+
+ if ($requiredVersion -ne $currentVersion) {
+ Write-Host "`n⚠️ Warning: Your Node.js version ($currentNodeVersion) does not match the required version ($requiredNodeVersion)" -ForegroundColor Yellow
+ Write-Host "Please consider switching to the correct version using: nvm use" -ForegroundColor Yellow
+
+ # Check if running in interactive mode
+ if ([Environment]::UserInteractive -and [Environment]::GetCommandLineArgs().Count -eq 0) {
+ Write-Host "Press Enter to continue with installation anyway..." -NoNewline -ForegroundColor Yellow
+ $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
+ Write-Host "`n" # Add newline after key press
+ } else {
+ Write-Host "Continuing with installation anyway...`n" -ForegroundColor Yellow
+ }
+ }
+}
+
+
# if ($null -eq $cargo) {
# Write-Host "`n...`n"
# Write-Host "Cargo`n" -ForegroundColor White
@@ -89,3 +114,5 @@ Write-Output "`nInstalling docs dependencies..." -ForegroundColor White
Push-Location docs
npm install
+
+Pop-Location
diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh
index ac23cab05..c3262e66c 100755
--- a/scripts/install-dependencies.sh
+++ b/scripts/install-dependencies.sh
@@ -5,6 +5,28 @@
# - Debug -> Extension
set -e
+# Check if node version matches .nvmrc
+if [ -f .nvmrc ]; then
+ required_node_version=$(cat .nvmrc)
+ current_node_version=$(node -v)
+
+ # Remove 'v' prefix from versions for comparison
+ required_version=${required_node_version#v}
+ current_version=${current_node_version#v}
+
+ if [ "$required_version" != "$current_version" ]; then
+ echo "⚠️ Warning: Your Node.js version ($current_node_version) does not match the required version ($required_node_version)"
+ echo "Please consider switching to the correct version using: nvm use"
+
+ if [ -t 0 ]; then
+ read -p "Press Enter to continue with installation anyway..."
+ else
+ echo "Continuing with installation anyway..."
+ fi
+ echo
+ fi
+fi
+
echo "Installing root-level dependencies..."
npm install