Changesets · Branches · Tags · Compare
| Changeset | eca53d6fa45207774a4f5a5464d8a660dc07446cef4adc2cb39c3d04057c7abd |
|---|---|
| Author | Aditya Mitra <61635505+uinstinct@users.noreply.github.com> · 2025-08-20 01:15 +05:30 |
| Committer | GitHub <noreply@github.com> · 2025-08-19 12:45 -07:00 |
| Parents | c22645941871 |
6 files changed
added core/config/createNewAssistantFile.ts +62 −0
| @@ -0,0 +1,62 @@ | ||
| 1 | +import { IDE } from ".."; | |
| 2 | +import { joinPathsToUri } from "../util/uri"; | |
| 3 | + | |
| 4 | +const DEFAULT_ASSISTANT_FILE = `# This is an example assistant configuration file | |
| 5 | +# It is used to define custom AI assistants within Continue | |
| 6 | +# Each assistant file can be accessed by selecting it from the assistant dropdown | |
| 7 | + | |
| 8 | +# To learn more, see the full assistant reference: https://docs.continue.dev/reference | |
| 9 | + | |
| 10 | +name: Example Assistant | |
| 11 | +version: 1.0.0 | |
| 12 | +schema: v1 | |
| 13 | + | |
| 14 | +# Models define which AI models this assistant can use | |
| 15 | +models: | |
| 16 | + - name: my gpt-5 | |
| 17 | + provider: openai | |
| 18 | + model: gpt-5 | |
| 19 | + apiKey: YOUR_API_KEY_HERE | |
| 20 | + | |
| 21 | +# Context providers define what information the assistant can access | |
| 22 | +context: | |
| 23 | + - provider: code | |
| 24 | + - provider: docs | |
| 25 | + - provider: diff | |
| 26 | + - provider: terminal | |
| 27 | + - provider: problems | |
| 28 | + - provider: folder | |
| 29 | + - provider: codebase | |
| 30 | +`; | |
| 31 | + | |
| 32 | +export async function createNewAssistantFile( | |
| 33 | + ide: IDE, | |
| 34 | + assistantPath: string | undefined, | |
| 35 | +): Promise<void> { | |
| 36 | + const workspaceDirs = await ide.getWorkspaceDirs(); | |
| 37 | + if (workspaceDirs.length === 0) { | |
| 38 | + throw new Error( | |
| 39 | + "No workspace directories found. Make sure you've opened a folder in your IDE.", | |
| 40 | + ); | |
| 41 | + } | |
| 42 | + | |
| 43 | + const baseDirUri = joinPathsToUri( | |
| 44 | + workspaceDirs[0], | |
| 45 | + assistantPath ?? ".continue/assistants", | |
| 46 | + ); | |
| 47 | + | |
| 48 | + // Find the first available filename | |
| 49 | + let counter = 0; | |
| 50 | + let assistantFileUri: string; | |
| 51 | + do { | |
| 52 | + const suffix = counter === 0 ? "" : `-${counter}`; | |
| 53 | + assistantFileUri = joinPathsToUri( | |
| 54 | + baseDirUri, | |
| 55 | + `new-assistant${suffix}.yaml`, | |
| 56 | + ); | |
| 57 | + counter++; | |
| 58 | + } while (await ide.fileExists(assistantFileUri)); | |
| 59 | + | |
| 60 | + await ide.writeFile(assistantFileUri, DEFAULT_ASSISTANT_FILE); | |
| 61 | + await ide.openFile(assistantFileUri); | |
| 62 | +} |
modified core/core.ts +8 −0
| @@ -51,6 +51,7 @@ | ||
| 51 | 51 | import { BLOCK_TYPES, ConfigYaml } from "@continuedev/config-yaml"; |
| 52 | 52 | import { getDiffFn, GitDiffCache } from "./autocomplete/snippets/gitDiffCache"; |
| 53 | 53 | import { stringifyMcpPrompt } from "./commands/slash/mcpSlashCommand"; |
| 54 | +import { createNewAssistantFile } from "./config/createNewAssistantFile"; | |
| 54 | 55 | import { isLocalDefinitionFile } from "./config/loadLocalAssistants"; |
| 55 | 56 | import { CodebaseRulesCache } from "./config/markdown/loadCodebaseRules"; |
| 56 | 57 | import { |
| @@ -354,6 +355,13 @@ | ||
| 354 | 355 | ); |
| 355 | 356 | }); |
| 356 | 357 | |
| 358 | + on("config/newAssistantFile", async (msg) => { | |
| 359 | + await createNewAssistantFile(this.ide, undefined); | |
| 360 | + await this.configHandler.reloadConfig( | |
| 361 | + "Assistant file created (config/newAssistantFile message)", | |
| 362 | + ); | |
| 363 | + }); | |
| 364 | + | |
| 357 | 365 | on("config/addLocalWorkspaceBlock", async (msg) => { |
| 358 | 366 | await createNewWorkspaceBlockFile(this.ide, msg.data.blockType); |
| 359 | 367 | await this.configHandler.reloadConfig( |
modified core/protocol/core.ts +2 −1
| @@ -49,8 +49,8 @@ | ||
| 49 | 49 | ControlPlaneSessionInfo, |
| 50 | 50 | } from "../control-plane/AuthTypes"; |
| 51 | 51 | import { FreeTrialStatus } from "../control-plane/client"; |
| 52 | -import { NextEditOutcome } from "../nextEdit/types"; | |
| 53 | 52 | import { ProcessedItem } from "../nextEdit/NextEditPrefetchQueue"; |
| 53 | +import { NextEditOutcome } from "../nextEdit/types"; | |
| 54 | 54 | |
| 55 | 55 | export enum OnboardingModes { |
| 56 | 56 | API_KEY = "API Key", |
| @@ -86,6 +86,7 @@ | ||
| 86 | 86 | ]; |
| 87 | 87 | "config/addLocalWorkspaceBlock": [{ blockType: BlockType }, void]; |
| 88 | 88 | "config/newPromptFile": [undefined, void]; |
| 89 | + "config/newAssistantFile": [undefined, void]; | |
| 89 | 90 | "config/ideSettingsUpdate": [IdeSettings, void]; |
| 90 | 91 | "config/getSerializedProfileInfo": [ |
| 91 | 92 | undefined, |
modified core/protocol/passThrough.ts +1 −0
| @@ -18,6 +18,7 @@ | ||
| 18 | 18 | "devdata/log", |
| 19 | 19 | "config/addModel", |
| 20 | 20 | "config/newPromptFile", |
| 21 | + "config/newAssistantFile", | |
| 21 | 22 | "config/ideSettingsUpdate", |
| 22 | 23 | "config/addLocalWorkspaceBlock", |
| 23 | 24 | "config/getSerializedProfileInfo", |
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt +1 −0
| @@ -83,6 +83,7 @@ | ||
| 83 | 83 | "devdata/log", |
| 84 | 84 | "config/addModel", |
| 85 | 85 | "config/newPromptFile", |
| 86 | + "config/newAssistantFile", | |
| 86 | 87 | "config/ideSettingsUpdate", |
| 87 | 88 | "config/addLocalWorkspaceBlock", |
| 88 | 89 | "config/getSerializedProfileInfo", |
modified gui/src/components/AssistantAndOrgListbox/index.tsx +39 −31
| @@ -1,4 +1,9 @@ | ||
| 1 | -import { ArrowPathIcon, PlusIcon } from "@heroicons/react/24/outline"; | |
| 1 | +import { | |
| 2 | + ArrowPathIcon, | |
| 3 | + ArrowRightEndOnRectangleIcon, | |
| 4 | + ArrowRightStartOnRectangleIcon, | |
| 5 | + PlusIcon, | |
| 6 | +} from "@heroicons/react/24/outline"; | |
| 2 | 7 | import { AuthType, isOnPremSession } from "core/control-plane/AuthTypes"; |
| 3 | 8 | import { useContext, useEffect, useRef } from "react"; |
| 4 | 9 | import { useAuth } from "../../context/Auth"; |
| @@ -10,7 +15,7 @@ | ||
| 10 | 15 | } from "../../redux/slices/profilesSlice"; |
| 11 | 16 | import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util"; |
| 12 | 17 | import { cn } from "../../util/cn"; |
| 13 | -import { useLump } from "../mainInput/Lump/LumpContext"; | |
| 18 | +import { ToolTip } from "../gui/Tooltip"; | |
| 14 | 19 | import { |
| 15 | 20 | Listbox, |
| 16 | 21 | ListboxOption, |
| @@ -27,7 +32,6 @@ | ||
| 27 | 32 | const listboxRef = useRef<HTMLDivElement>(null); |
| 28 | 33 | const currentOrg = useAppSelector(selectCurrentOrg); |
| 29 | 34 | const ideMessenger = useContext(IdeMessengerContext); |
| 30 | - const { isToolbarExpanded } = useLump(); | |
| 31 | 35 | const { |
| 32 | 36 | profiles, |
| 33 | 37 | selectedProfile, |
| @@ -38,7 +42,6 @@ | ||
| 38 | 42 | refreshProfiles, |
| 39 | 43 | } = useAuth(); |
| 40 | 44 | const configLoading = useAppSelector((store) => store.config.loading); |
| 41 | - const smallFont = useFontSize(-3); | |
| 42 | 45 | const tinyFont = useFontSize(-4); |
| 43 | 46 | const shouldRenderOrgInfo = |
| 44 | 47 | session && organizations.length > 1 && !isOnPremSession(session); |
| @@ -50,10 +53,14 @@ | ||
| 50 | 53 | } |
| 51 | 54 | |
| 52 | 55 | function onNewAssistant() { |
| 53 | - void ideMessenger.request("controlPlane/openUrl", { | |
| 54 | - path: "/new", | |
| 55 | - orgSlug: currentOrg?.slug, | |
| 56 | - }); | |
| 56 | + if (session) { | |
| 57 | + void ideMessenger.request("controlPlane/openUrl", { | |
| 58 | + path: "/new", | |
| 59 | + orgSlug: currentOrg?.slug, | |
| 60 | + }); | |
| 61 | + } else { | |
| 62 | + void ideMessenger.request("config/newAssistantFile", undefined); | |
| 63 | + } | |
| 57 | 64 | close(); |
| 58 | 65 | } |
| 59 | 66 | |
| @@ -108,12 +115,29 @@ | ||
| 108 | 115 | <div className="relative" ref={listboxRef}> |
| 109 | 116 | <SelectedAssistantButton selectedProfile={selectedProfile} /> |
| 110 | 117 | <Transition> |
| 111 | - <ListboxOptions className="-translate-x-1.5 pb-0"> | |
| 112 | - <div className="border-border border-x-0 border-t-0 border-solid px-2 py-3"> | |
| 113 | - <div className="flex flex-col gap-2 pb-1 pl-1"> | |
| 114 | - {session && session?.AUTH_TYPE !== AuthType.OnPrem && ( | |
| 115 | - <span className="text-description-muted flex items-center pb-1"> | |
| 116 | - {session?.account.id} | |
| 118 | + <ListboxOptions | |
| 119 | + className="-translate-x-1.5 pb-0" | |
| 120 | + style={{ zIndex: 200 }} | |
| 121 | + > | |
| 122 | + <div className="border-border border-x-0 border-t-0 border-solid px-2 py-2"> | |
| 123 | + <div className="flex flex-col gap-2 pl-1"> | |
| 124 | + {session ? ( | |
| 125 | + <span className="text-description-muted flex items-center justify-between gap-x-1"> | |
| 126 | + {session?.AUTH_TYPE !== AuthType.OnPrem && | |
| 127 | + session?.account.id} | |
| 128 | + <ArrowRightStartOnRectangleIcon | |
| 129 | + className="h-3 w-3 cursor-pointer hover:brightness-125" | |
| 130 | + onClick={onLogout} | |
| 131 | + data-tooltip-id="logout-tooltip" | |
| 132 | + /> | |
| 133 | + <ToolTip id="logout-tooltip">Logout</ToolTip> | |
| 134 | + </span> | |
| 135 | + ) : ( | |
| 136 | + <span | |
| 137 | + className="text-description-muted flex cursor-pointer items-center justify-end gap-x-1 hover:brightness-125" | |
| 138 | + onClick={() => login(false)} | |
| 139 | + > | |
| 140 | + Log In <ArrowRightEndOnRectangleIcon className="h-3 w-3" /> | |
| 117 | 141 | </span> |
| 118 | 142 | )} |
| 119 | 143 | {shouldRenderOrgInfo && ( |
| @@ -138,7 +162,7 @@ | ||
| 138 | 162 | value="new-assistant" |
| 139 | 163 | fontSizeModifier={-2} |
| 140 | 164 | className="border-border border-b px-2 py-1.5" |
| 141 | - onClick={session ? onNewAssistant : () => login(false)} | |
| 165 | + onClick={onNewAssistant} | |
| 142 | 166 | > |
| 143 | 167 | <span |
| 144 | 168 | className="text-description flex flex-row items-center" |
| @@ -170,22 +194,6 @@ | ||
| 170 | 194 | </span> |
| 171 | 195 | </ListboxOption> |
| 172 | 196 | |
| 173 | - {session && ( | |
| 174 | - <ListboxOption | |
| 175 | - value="log-out" | |
| 176 | - fontSizeModifier={-2} | |
| 177 | - className="border-border border-b px-3 py-1.5" | |
| 178 | - onClick={onLogout} | |
| 179 | - > | |
| 180 | - <div | |
| 181 | - className="text-description flex flex-row items-center" | |
| 182 | - style={{ fontSize: tinyFont }} | |
| 183 | - > | |
| 184 | - Log out | |
| 185 | - </div> | |
| 186 | - </ListboxOption> | |
| 187 | - )} | |
| 188 | - | |
| 189 | 197 | <div |
| 190 | 198 | className="text-description border-border flex items-center justify-between gap-1.5 border-x-0 border-b-0 border-t border-solid px-2 py-2" |
| 191 | 199 | style={{ fontSize: tinyFont }} |