diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index ccc9e8a44..578e0974b 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -1,7 +1,7 @@ name: PR checks on: - pull_request_target: + pull_request: branches: - main paths: @@ -22,21 +22,10 @@ on: - ".github/workflows/**" jobs: - validate-pr: - runs-on: ubuntu-latest - environment: tests-requiring-secrets - steps: - - uses: actions/checkout@v4 - install-root: - needs: validate-pr runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - # This is important - it switches from the base repo to the fork - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -57,9 +46,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -86,12 +72,8 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: tests-requiring-secrets steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -122,9 +104,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -157,9 +136,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -191,9 +167,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -231,9 +204,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -268,9 +238,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -303,9 +270,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -321,6 +285,7 @@ jobs: cd core npm test env: + IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} @@ -333,9 +298,6 @@ jobs: test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Cache node modules uses: actions/cache@v3 @@ -363,9 +325,6 @@ jobs: needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -399,9 +358,6 @@ jobs: needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -443,7 +399,6 @@ jobs: ] runs-on: ubuntu-latest # Tests requiring secrets need approval from maintainers - environment: tests-requiring-secrets strategy: fail-fast: false matrix: @@ -451,9 +406,6 @@ jobs: command: ["e2e:ci:run", "e2e:ci:run-yaml"] steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -492,6 +444,7 @@ jobs: chmod 600 ~/.ssh/id_rsa ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config + if: ${{ github.event.pull_request.head.repo.fork == false }} - name: Set up Xvfb run: | @@ -501,7 +454,7 @@ jobs: - name: Run e2e tests run: | cd extensions/vscode - TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} + IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} env: DISPLAY: :99 @@ -517,9 +470,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-node@v4 with: @@ -552,10 +502,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - uses: actions/cache@v4 with: path: core/node_modules diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..81efb94b6 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,16 @@ +# Security Policy + +## Reporting a Vulnerability + +If you discover a security vulnerability, please do not open a public issue. Instead, please report it by emailing security@continue.dev. We will be highly responsive to all security concerns and ask that you give us sufficient time to investigate and address the vulnerability before disclosing it publicly. + +Please include the following details in your report: + +- A description of the vulnerability +- Steps to reproduce the issue +- Your assessment of the potential impact +- Any possible mitigations + +## Contact + +For any other questions or concerns related to security, please contact us at security@continue.dev. diff --git a/binary/package-lock.json b/binary/package-lock.json index 316fddcd2..84b831ecf 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -48,7 +48,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.621.0", "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.16", + "@continuedev/config-yaml": "^1.0.23", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/core/autocomplete/CompletionProvider.ts b/core/autocomplete/CompletionProvider.ts index 77aadbdf5..32e8a4127 100644 --- a/core/autocomplete/CompletionProvider.ts +++ b/core/autocomplete/CompletionProvider.ts @@ -246,6 +246,7 @@ export class CompletionProvider { completionOptions, cacheHit, filepath: helper.filepath, + numLines: completion.split("\n").length, completionId: helper.input.completionId, gitRepo: await this.ide.getRepoName(helper.filepath), uniqueId: await this.ide.getUniqueId(), diff --git a/core/autocomplete/util/types.ts b/core/autocomplete/util/types.ts index b6379dd61..3959bff9c 100644 --- a/core/autocomplete/util/types.ts +++ b/core/autocomplete/util/types.ts @@ -1,10 +1,4 @@ -import { - Position, - Range, - RangeInFile, - RangeInFileWithContents, - TabAutocompleteOptions, -} from "../.."; +import { Position, Range, RangeInFile, TabAutocompleteOptions } from "../.."; import { AutocompleteCodeSnippet } from "../snippets/types"; export type RecentlyEditedRange = RangeInFile & { @@ -42,6 +36,7 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions { modelName: string; completionOptions: any; cacheHit: boolean; + numLines: number; filepath: string; gitRepo?: string; completionId: string; diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index edcf62071..e1c2a17e4 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -1,9 +1,17 @@ import * as fs from "node:fs"; +import { + AssistantUnrolled, + ConfigResult, + FullSlug, +} from "@continuedev/config-yaml"; +import * as YAML from "yaml"; + import { ControlPlaneClient, ControlPlaneSessionInfo, } from "../control-plane/client.js"; +import { getControlPlaneEnv, useHub } from "../control-plane/env.js"; import { BrowserSerializedContinueConfig, ContinueConfig, @@ -15,15 +23,8 @@ import { import Ollama from "../llm/llms/Ollama.js"; import { GlobalContext } from "../util/GlobalContext.js"; import { getConfigJsonPath, getConfigYamlPath } from "../util/paths.js"; - -import { - AssistantUnrolled, - ConfigResult, - FullSlug, -} from "@continuedev/config-yaml"; -import * as YAML from "yaml"; -import { getControlPlaneEnv, useHub } from "../control-plane/env.js"; import { localPathToUri } from "../util/pathToUri.js"; + import { LOCAL_ONBOARDING_CHAT_MODEL, ONBOARDING_LOCAL_MODEL_TITLE, @@ -135,6 +136,7 @@ export class ConfigHandler { { ...assistant.configResult, config: renderedConfig }, assistant.ownerSlug, assistant.packageSlug, + assistant.iconUrl, assistant.configResult.config?.version ?? "latest", this.controlPlaneClient, this.ide, @@ -336,11 +338,11 @@ export class ConfigHandler { this.updateListeners.push(listener); } - async reloadConfig() { + async reloadConfig(additionalContextProviders: IContextProvider[] = []) { // TODO: this isn't right, there are two different senses in which you want to "reload" const { config, errors, configLoadInterrupted } = - await this.currentProfile.reloadConfig(); + await this.currentProfile.reloadConfig(additionalContextProviders); if (config) { this.inactiveProfiles.forEach((profile) => profile.clearConfig()); @@ -390,6 +392,6 @@ export class ConfigHandler { registerCustomContextProvider(contextProvider: IContextProvider) { this.additionalContextProviders.push(contextProvider); - void this.reloadConfig(); + void this.reloadConfig(this.additionalContextProviders); } } diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts index fa76c6b55..fc18f34b0 100644 --- a/core/config/ProfileLifecycleManager.ts +++ b/core/config/ProfileLifecycleManager.ts @@ -3,6 +3,7 @@ import { ConfigValidationError, FullSlug, } from "@continuedev/config-yaml"; + import { BrowserSerializedContinueConfig, ContinueConfig, @@ -18,9 +19,16 @@ export interface ProfileDescription { profileType: "control-plane" | "local" | "platform"; title: string; id: string; + iconUrl: string; errors: ConfigValidationError[] | undefined; } +export interface OrganizationDescription { + id: string; + iconUrl: string; + name: string; +} + export class ProfileLifecycleManager { private savedConfigResult: ConfigResult | undefined; private savedBrowserConfigResult?: ConfigResult; @@ -42,12 +50,12 @@ export class ProfileLifecycleManager { } // Clear saved config and reload - async reloadConfig(): Promise> { + async reloadConfig(additionalContextProviders: IContextProvider[] = []): Promise> { this.savedConfigResult = undefined; this.savedBrowserConfigResult = undefined; this.pendingConfigPromise = undefined; - return this.loadConfig([], true); + return this.loadConfig(additionalContextProviders, true); } async loadConfig( diff --git a/core/config/profile/ControlPlaneProfileLoader.ts b/core/config/profile/ControlPlaneProfileLoader.ts index dfb111e1f..6df837cf4 100644 --- a/core/config/profile/ControlPlaneProfileLoader.ts +++ b/core/config/profile/ControlPlaneProfileLoader.ts @@ -1,4 +1,5 @@ import { ConfigJson } from "@continuedev/config-types"; +import { ConfigResult } from "@continuedev/config-yaml"; import { ControlPlaneClient } from "../../control-plane/client.js"; import { @@ -7,9 +8,8 @@ import { IdeSettings, SerializedContinueConfig, } from "../../index.js"; - -import { ConfigResult } from "@continuedev/config-yaml"; import { ProfileDescription } from "../ProfileLifecycleManager.js"; + import doLoadConfig from "./doLoadConfig.js"; import { IProfileLoader } from "./IProfileLoader.js"; @@ -32,6 +32,7 @@ export default class ControlPlaneProfileLoader implements IProfileLoader { this.description = { id: workspaceId, profileType: "control-plane", + iconUrl: "", fullSlug: { ownerSlug: "", packageSlug: "", diff --git a/core/config/profile/LocalProfileLoader.ts b/core/config/profile/LocalProfileLoader.ts index cb8694bbc..3196faff4 100644 --- a/core/config/profile/LocalProfileLoader.ts +++ b/core/config/profile/LocalProfileLoader.ts @@ -1,8 +1,9 @@ import { ConfigResult } from "@continuedev/config-yaml"; + import { ControlPlaneClient } from "../../control-plane/client.js"; import { ContinueConfig, IDE, IdeSettings } from "../../index.js"; - import { ProfileDescription } from "../ProfileLifecycleManager.js"; + import doLoadConfig from "./doLoadConfig.js"; import { IProfileLoader } from "./IProfileLoader.js"; @@ -16,6 +17,7 @@ export default class LocalProfileLoader implements IProfileLoader { packageSlug: "", versionSlug: "", }, + iconUrl: "", title: "Local Config", errors: undefined, }; diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts index 12e166c2d..7650cb0e3 100644 --- a/core/config/profile/PlatformProfileLoader.ts +++ b/core/config/profile/PlatformProfileLoader.ts @@ -1,10 +1,10 @@ +import { ConfigResult } from "@continuedev/config-yaml"; import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas/index.js"; import { ControlPlaneClient } from "../../control-plane/client.js"; import { ContinueConfig, IDE, IdeSettings } from "../../index.js"; - -import { ConfigResult } from "@continuedev/config-yaml"; import { ProfileDescription } from "../ProfileLifecycleManager.js"; + import doLoadConfig from "./doLoadConfig.js"; import { IProfileLoader } from "./IProfileLoader.js"; @@ -27,6 +27,7 @@ export default class PlatformProfileLoader implements IProfileLoader { private configResult: ConfigResult, private readonly ownerSlug: string, private readonly packageSlug: string, + private readonly iconUrl: string, versionSlug: string, private readonly controlPlaneClient: ControlPlaneClient, private readonly ide: IDE, @@ -44,6 +45,7 @@ export default class PlatformProfileLoader implements IProfileLoader { }, title: `${ownerSlug}/${packageSlug}@${versionSlug}`, errors: configResult.errors, + iconUrl: this.iconUrl, }; } diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 5ee0620a6..86f975965 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -124,12 +124,14 @@ export default async function doLoadConfig( if (newConfig.analytics) { await TeamAnalytics.setup( - newConfig.analytics as any, // TODO: Need to get rid of index.d.ts once and for all + newConfig.analytics, uniqueId, ideInfo.extensionVersion, controlPlaneClient, controlPlaneProxyInfo, ); + } else { + await TeamAnalytics.shutdown(); } newConfig = await injectControlPlaneProxyInfo( diff --git a/core/control-plane/TeamAnalytics.ts b/core/control-plane/TeamAnalytics.ts index c9f543bb4..732567206 100644 --- a/core/control-plane/TeamAnalytics.ts +++ b/core/control-plane/TeamAnalytics.ts @@ -1,7 +1,5 @@ import os from "node:os"; -import { Analytics } from "@continuedev/config-types"; - import ContinueProxyAnalyticsProvider from "./analytics/ContinueProxyAnalyticsProvider.js"; import { ControlPlaneProxyInfo, @@ -10,9 +8,10 @@ import { import LogStashAnalyticsProvider from "./analytics/LogStashAnalyticsProvider.js"; import PostHogAnalyticsProvider from "./analytics/PostHogAnalyticsProvider.js"; import { ControlPlaneClient } from "./client.js"; +import { AnalyticsConfig } from "../index.js"; function createAnalyticsProvider( - config: Analytics, + config: AnalyticsConfig, ): IAnalyticsProvider | undefined { // @ts-ignore switch (config.provider) { @@ -42,7 +41,7 @@ export class TeamAnalytics { } static async setup( - config: Analytics, + config: AnalyticsConfig, uniqueId: string, extensionVersion: string, controlPlaneClient: ControlPlaneClient, @@ -52,22 +51,27 @@ export class TeamAnalytics { TeamAnalytics.os = os.platform(); TeamAnalytics.extensionVersion = extensionVersion; - if (!config) { - await TeamAnalytics.provider?.shutdown(); - TeamAnalytics.provider = undefined; - } else { - TeamAnalytics.provider = createAnalyticsProvider(config); - await TeamAnalytics.provider?.setup( - config, - uniqueId, - controlPlaneProxyInfo, - ); + TeamAnalytics.provider = createAnalyticsProvider(config); + await TeamAnalytics.provider?.setup( + config, + uniqueId, + controlPlaneProxyInfo, + ); - if (config.provider === "continue-proxy") { - ( - TeamAnalytics.provider as ContinueProxyAnalyticsProvider - ).controlPlaneClient = controlPlaneClient; - } + if (config.provider === "continue-proxy") { + ( + TeamAnalytics.provider as ContinueProxyAnalyticsProvider + ).controlPlaneClient = controlPlaneClient; + } + } + + static async shutdown() { + if (TeamAnalytics.provider) { + await TeamAnalytics.provider.shutdown(); + TeamAnalytics.provider = undefined; + TeamAnalytics.os = undefined; + TeamAnalytics.extensionVersion = undefined; + TeamAnalytics.uniqueId = "NOT_UNIQUE"; } } } diff --git a/core/control-plane/analytics/IAnalyticsProvider.ts b/core/control-plane/analytics/IAnalyticsProvider.ts index c069695d0..6631a7c50 100644 --- a/core/control-plane/analytics/IAnalyticsProvider.ts +++ b/core/control-plane/analytics/IAnalyticsProvider.ts @@ -1,4 +1,4 @@ -import { Analytics } from "@continuedev/config-types"; +import { AnalyticsConfig } from "../.."; export interface AnalyticsMetadata { extensionVersion: string; @@ -13,7 +13,7 @@ export interface ControlPlaneProxyInfo { export interface IAnalyticsProvider { capture(event: string, properties: { [key: string]: any }): Promise; setup( - config: Analytics, + config: AnalyticsConfig, uniqueId: string, controlPlaneProxyInfo?: ControlPlaneProxyInfo, ): Promise; diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index 6200bc8de..7c15c8910 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -1,8 +1,4 @@ import { ConfigJson } from "@continuedev/config-types"; -import fetch, { RequestInit, Response } from "node-fetch"; - -import { IdeSettings, ModelDescription } from "../index.js"; - import { AssistantUnrolled, ConfigResult, @@ -10,6 +6,11 @@ import { FullSlug, SecretResult, } from "@continuedev/config-yaml"; +import fetch, { RequestInit, Response } from "node-fetch"; + +import { OrganizationDescription } from "../config/ProfileLifecycleManager.js"; +import { IdeSettings, ModelDescription } from "../index.js"; + import { getControlPlaneEnv } from "./env.js"; export interface ControlPlaneSessionInfo { @@ -32,10 +33,6 @@ export const TRIAL_PROXY_URL = "https://proxy-server-blue-l6vsfbzhba-uw.a.run.app"; export class ControlPlaneClient { - private static ACCESS_TOKEN_VALID_FOR_MS = 1000 * 60 * 5; // 5 minutes - - private lastAccessTokenRefresh = 0; - constructor( private readonly sessionInfoPromise: Promise< ControlPlaneSessionInfo | undefined @@ -107,7 +104,7 @@ export class ControlPlaneClient { } } - public async listAssistants(): Promise< + public async listAssistants(organizationId?: string): Promise< { configResult: ConfigResult; ownerSlug: string; @@ -121,7 +118,11 @@ export class ControlPlaneClient { } try { - const resp = await this.request("ide/list-assistants", { + const url = organizationId + ? `ide/list-assistants?organizationId=${organizationId}` + : "ide/list-assistants"; + + const resp = await this.request(url, { method: "GET", }); return (await resp.json()) as any; @@ -130,6 +131,31 @@ export class ControlPlaneClient { } } + public async listOrganizations(): Promise> { + return [ + { + id: "1", + iconUrl: + "https://cdn.prod.website-files.com/663e06c56841363663ffbbcf/663e1b9fb023f0b622ad3608_log-text.svg", + name: "Continue", + }, + ]; + // const userId = await this.userId; + // if (!userId) { + // return []; + // } + + // try { + // const resp = await this.request("ide/list-organizations", { + // method: "GET", + // }); + // const { organizations } = (await resp.json()) as any; + // return organizations; + // } catch (e) { + // return []; + // } + } + public async listAssistantFullSlugs(): Promise { const userId = await this.userId; if (!userId) { diff --git a/core/core.ts b/core/core.ts index 4db77443c..52e5a58cd 100644 --- a/core/core.ts +++ b/core/core.ts @@ -19,6 +19,7 @@ import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFile import { ContinueServerClient } from "./continueServer/stubs/client"; import { getAuthUrlForTokenPage } from "./control-plane/auth/index"; import { ControlPlaneClient } from "./control-plane/client"; +import { getControlPlaneEnv } from "./control-plane/env"; import { streamDiffLines } from "./edit/streamDiffLines"; import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer"; import DocsService from "./indexing/docs/DocsService"; @@ -52,7 +53,6 @@ import { type IndexingProgressUpdate, } from "."; -import { getControlPlaneEnv } from "./control-plane/env"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import type { IMessenger, Message } from "./protocol/messenger"; @@ -289,6 +289,7 @@ export class Core { on("config/ideSettingsUpdate", (msg) => { this.configHandler.updateIdeSettings(msg.data); }); + on("config/listProfiles", (msg) => { return this.configHandler.listProfiles(); }); @@ -307,6 +308,10 @@ export class Core { await this.messenger.request("openUrl", `${env.APP_URL}${msg.data.path}`); }); + on("controlPlane/listOrganizations", async (msg) => { + return await this.controlPlaneClient.listOrganizations(); + }); + // Context providers on("context/addDocs", async (msg) => { void this.docsService.indexAndAdd(msg.data); diff --git a/core/index.d.ts b/core/index.d.ts index 040233c62..06242206c 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1110,7 +1110,7 @@ export interface ExperimentalConfig { } export interface AnalyticsConfig { - type: string; + provider: string; url?: string; clientKey?: string; } diff --git a/core/indexing/docs/crawlers/DefaultCrawler.ts b/core/indexing/docs/crawlers/DefaultCrawler.ts index 0f0d9e593..d5e717fc0 100644 --- a/core/indexing/docs/crawlers/DefaultCrawler.ts +++ b/core/indexing/docs/crawlers/DefaultCrawler.ts @@ -26,7 +26,7 @@ export class DefaultCrawler { }); if (!resp.ok) { const text = await resp.text(); - throw new Error(`Failed to crawl site: ${text}`); + throw new Error(`Failed to crawl site (${resp.status}): ${text}`); } const json = (await resp.json()) as PageData[]; return json; diff --git a/core/indexing/docs/crawlers/DocsCrawler.test.ts b/core/indexing/docs/crawlers/DocsCrawler.test.ts index d3a246cf9..96c6dc24d 100644 --- a/core/indexing/docs/crawlers/DocsCrawler.test.ts +++ b/core/indexing/docs/crawlers/DocsCrawler.test.ts @@ -152,11 +152,15 @@ describe("DocsCrawler", () => { ); commonDocsSites.forEach((url) => { - test(`Default crawler common site: ${url}`, async () => { - const { pages, crawler } = await runCrawl(url); - expect(pages.length).toBeGreaterThanOrEqual(1); - expect(crawler).toEqual("default"); - }); + test( + `Default crawler common site: ${url}`, + async () => { + const { pages, crawler } = await runCrawl(url); + expect(pages.length).toBeGreaterThanOrEqual(1); + expect(crawler).toEqual("default"); + }, + TIMEOUT_MS, + ); }); }); diff --git a/core/llm/llm.test.ts b/core/llm/llm.test.ts index 09777dae0..53729022a 100644 --- a/core/llm/llm.test.ts +++ b/core/llm/llm.test.ts @@ -26,7 +26,13 @@ function testLLM( skip, testFim, testToolCall, - }: { skip?: boolean; testFim?: boolean; testToolCall?: boolean }, + timeout, + }: { + skip?: boolean; + testFim?: boolean; + testToolCall?: boolean; + timeout?: number; + }, ) { if (skip) { return; @@ -37,45 +43,29 @@ function testLLM( }); describe(llm.providerName + "/" + llm.model, () => { - test("Stream Chat works", async () => { - let total = ""; - for await (const chunk of llm.streamChat( - [{ role: "user", content: "Hi" }], - new AbortController().signal, - )) { - total += chunk.content; - } - - expect(total.length).toBeGreaterThan(0); - return; - }); - - test("Stream Complete works", async () => { - let total = ""; - for await (const chunk of llm.streamComplete( - "Hi", - new AbortController().signal, - )) { - total += chunk; - } - - expect(total.length).toBeGreaterThan(0); - return; - }); - - test("Complete works", async () => { - const completion = await llm.complete("Hi", new AbortController().signal); - - expect(completion.length).toBeGreaterThan(0); - return; - }); - - if (testFim) { - test("FIM works", async () => { + test( + "Stream Chat works", + async () => { let total = ""; - for await (const chunk of llm.streamFim( + for await (const chunk of llm.streamChat( + [{ role: "user", content: "Hi" }], + new AbortController().signal, + )) { + total += chunk.content; + } + + expect(total.length).toBeGreaterThan(0); + return; + }, + timeout, + ); + + test( + "Stream Complete works", + async () => { + let total = ""; + for await (const chunk of llm.streamComplete( "Hi", - "name is ChatGPT.", new AbortController().signal, )) { total += chunk; @@ -83,72 +73,120 @@ function testLLM( expect(total.length).toBeGreaterThan(0); return; - }); + }, + timeout, + ); + + test( + "Complete works", + async () => { + const completion = await llm.complete( + "Hi", + new AbortController().signal, + ); + + expect(completion.length).toBeGreaterThan(0); + return; + }, + timeout, + ); + + if (testFim) { + test( + "FIM works", + async () => { + let total = ""; + for await (const chunk of llm.streamFim( + "Hi", + "name is ChatGPT.", + new AbortController().signal, + )) { + total += chunk; + } + + expect(total.length).toBeGreaterThan(0); + return; + }, + timeout, + ); } if (testToolCall) { - test("Tool Call works", async () => { - let args = ""; - let isFirstChunk = true; - for await (const chunk of llm.streamChat( - [{ role: "user", content: "Hi, my name is Nate." }], - new AbortController().signal, - { - tools: [ - { - displayTitle: "Say Hello", - function: { - name: "say_hello", - description: "Say Hello", - parameters: { - type: "object", - properties: { - name: { - type: "string", - description: "The name of the person to greet", + test( + "Tool Call works", + async () => { + let args = ""; + let isFirstChunk = true; + for await (const chunk of llm.streamChat( + [{ role: "user", content: "Hi, my name is Nate." }], + new AbortController().signal, + { + tools: [ + { + displayTitle: "Say Hello", + function: { + name: "say_hello", + description: "Say Hello", + parameters: { + type: "object", + properties: { + name: { + type: "string", + description: "The name of the person to greet", + }, }, }, }, + type: "function", + wouldLikeTo: "Say hello", + readonly: true, }, + ], + toolChoice: { type: "function", - wouldLikeTo: "Say hello", - readonly: true, - }, - ], - toolChoice: { - type: "function", - function: { - name: "say_hello", + function: { + name: "say_hello", + }, }, }, - }, - )) { - const typedChunk = chunk as AssistantChatMessage; - if (!typedChunk.toolCalls) { - continue; + )) { + const typedChunk = chunk as AssistantChatMessage; + if (!typedChunk.toolCalls) { + continue; + } + const toolCall = typedChunk.toolCalls[0]; + args += toolCall.function?.arguments ?? ""; + + expect(chunk.role).toBe("assistant"); + expect(chunk.content).toBe(""); + expect(typedChunk.toolCalls).toHaveLength(1); + + if (isFirstChunk) { + isFirstChunk = false; + expect(toolCall.id).toBeDefined(); + expect(toolCall.function!.name).toBe("say_hello"); + } } - const toolCall = typedChunk.toolCalls[0]; - args += toolCall.function?.arguments ?? ""; - expect(chunk.role).toBe("assistant"); - expect(chunk.content).toBe(""); - expect(typedChunk.toolCalls).toHaveLength(1); - - if (isFirstChunk) { - isFirstChunk = false; - expect(toolCall.id).toBeDefined(); - expect(toolCall.function!.name).toBe("say_hello"); - } - } - - const parsedArgs = JSON.parse(args); - expect(parsedArgs.name).toBe("Nate"); - }); + const parsedArgs = JSON.parse(args); + expect(parsedArgs.name).toBe("Nate"); + }, + timeout, + ); } }); } describe("LLM", () => { + if (process.env.IGNORE_API_KEY_TESTS === "true") { + test("Skipping API key tests", () => { + console.log( + "Skipping API key tests due to IGNORE_API_KEY_TESTS being set", + ); + }); + return; + } + testLLM( new Anthropic({ model: "claude-3-5-sonnet-latest", @@ -165,7 +203,7 @@ describe("LLM", () => { }); testLLM( new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "o1-preview" }), - { skip: false }, + { skip: false, timeout: 20000 }, ); testLLM(new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "o1" }), { skip: false, diff --git a/core/llm/llms/Asksage.ts b/core/llm/llms/Asksage.ts index f3b445df4..59554efe5 100644 --- a/core/llm/llms/Asksage.ts +++ b/core/llm/llms/Asksage.ts @@ -24,6 +24,7 @@ class Asksage extends BaseLLM { "gpt4-32k": "gpt4-32k", "gpt-o1": "gpt-o1", // Works "gpt-o1-mini": "gpt-o1-mini", // Works + "gpt-o3-mini": "gpt-o3-mini", // Stub "gpt-3.5-turbo": "gpt35-16k", // Works "aws-bedrock-claude-35-sonnet-gov": "aws-bedrock-claude-35-sonnet-gov", // Works "claude-3-5-sonnet-latest": "claude-35-sonnet", // Works diff --git a/core/llm/llms/Gemini.ts b/core/llm/llms/Gemini.ts index c0940dbfd..4c0fb189b 100644 --- a/core/llm/llms/Gemini.ts +++ b/core/llm/llms/Gemini.ts @@ -251,9 +251,45 @@ class Gemini extends BaseLLM { return; } } + // Helper function to recursively clean JSON Schema objects + const cleanJsonSchema = (schema: any): any => { + if (!schema || typeof schema !== 'object') return schema; + + if (Array.isArray(schema)) { + return schema.map(cleanJsonSchema); + } + + const { + $schema, + additionalProperties, + default: defaultValue, + ...rest + } = schema; + + // Recursively clean nested properties + if (rest.properties) { + rest.properties = Object.entries(rest.properties).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: cleanJsonSchema(value), + }), + {} + ); + } + + // Clean items in arrays + if (rest.items) { + rest.items = cleanJsonSchema(rest.items); + } + + return rest; + }; + + // Clean the parameters and convert type to uppercase + const cleanedParams = cleanJsonSchema(tool.function.parameters); fn.parameters = { + ...cleanedParams, type: tool.function.parameters.type.toUpperCase(), - ...tool.function.parameters, }; } functions.push(fn); @@ -311,11 +347,16 @@ class Gemini extends BaseLLM { const supportedParts: MessagePart[] = []; const toolCalls: ToolCallDelta[] = []; + // Process all parts first to maintain order + const processedParts: Array<{ + type: 'content' | 'tool' | 'toolCall', + data: any + }> = []; + for (const part of content.parts) { if ("text" in part) { supportedParts.push({ type: "text", text: part.text }); } else if ("inlineData" in part) { - // TODO does this image url conversion actually work? supportedParts.push({ type: "imageUrl", imageUrl: { @@ -323,38 +364,56 @@ class Gemini extends BaseLLM { }, }); } else if ("functionCall" in part) { - // Handle function call - toolCalls.push({ - type: "function", - id: "", // Not supported by gemini - function: { - name: part.functionCall.name, - arguments: - typeof part.functionCall.args === "string" - ? part.functionCall.args - : JSON.stringify(part.functionCall.args), - }, + // Queue function call + processedParts.push({ + type: 'toolCall', + data: { + type: "function", + id: "", // Not supported by gemini + function: { + name: part.functionCall.name, + arguments: + typeof part.functionCall.args === "string" + ? part.functionCall.args + : JSON.stringify(part.functionCall.args), + }, + } }); } else if ("functionResponse" in part) { - // TODO hypothetically order could be off here - // Where function response is in the middle of something - yield { - role: "tool", - content: part.functionResponse.response.output as string, - toolCallId: part.functionResponse.name, - }; + // Queue function response + processedParts.push({ + type: 'tool', + data: { + role: "tool", + content: part.functionResponse.response.output as string, + toolCallId: part.functionResponse.name, + } + }); } else { console.warn("Unsupported gemini part type received", part); } } - if (supportedParts.length || toolCalls.length) { - // Incrementally stream the content to make it smoother + + // If we have supported content parts, yield them first + if (supportedParts.length) { yield { role: "assistant", - content: supportedParts.length ? supportedParts : "", - ...(toolCalls.length ? { toolCalls } : {}), + content: supportedParts, }; } + + // Then process tool calls and responses in order + for (const part of processedParts) { + if (part.type === 'toolCall') { + yield { + role: "assistant", + content: "", + toolCalls: [part.data], + }; + } else if (part.type === 'tool') { + yield part.data; + } + } } else { // Handle the case where the expected data structure is not found console.warn("Unexpected response format:", data); diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index 41b3c755b..e0acc961e 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -49,6 +49,7 @@ const CHAT_ONLY_MODELS = [ "gpt-4o-mini", "o1-preview", "o1-mini", + "o3-mini" ]; const formatMessageForO1 = (messages: ChatCompletionMessageParam[]) => { @@ -92,8 +93,8 @@ class OpenAI extends BaseLLM { return model; } - private isO1Model(model?: string): boolean { - return !!model && model.startsWith("o1"); + private isO3orO1Model(model?: string): boolean { + return !!model && (model.startsWith("o1") || model.startsWith("o3")); } protected supportsPrediction(model: string): boolean { @@ -144,8 +145,8 @@ class OpenAI extends BaseLLM { finalOptions.stop = options.stop?.slice(0, this.getMaxStopWords()); - // OpenAI o1-preview and o1-mini: - if (this.isO1Model(options.model)) { + // OpenAI o1-preview and o1-mini or o3-mini: + if (this.isO3orO1Model(options.model)) { // a) use max_completion_tokens instead of max_tokens finalOptions.max_completion_tokens = options.maxTokens; finalOptions.max_tokens = undefined; @@ -239,8 +240,8 @@ class OpenAI extends BaseLLM { ): ChatCompletionCreateParams { body.stop = body.stop?.slice(0, this.getMaxStopWords()); - // OpenAI o1-preview and o1-mini: - if (this.isO1Model(body.model)) { + // OpenAI o1-preview and o1-mini or o3-mini: + if (this.isO3orO1Model(body.model)) { // a) use max_completion_tokens instead of max_tokens body.max_completion_tokens = body.max_tokens; body.max_tokens = undefined; diff --git a/core/protocol/core.ts b/core/protocol/core.ts index ce24dfcbb..64bc5f5d4 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -1,4 +1,10 @@ import { ConfigResult } from "@continuedev/config-yaml"; + +import { AutocompleteInput } from "../autocomplete/util/types"; +import { ProfileDescription } from "../config/ConfigHandler"; +import { OrganizationDescription } from "../config/ProfileLifecycleManager"; +import { SharedConfigSchema } from "../config/sharedConfig"; + import type { BrowserSerializedContinueConfig, ChatMessage, @@ -21,9 +27,6 @@ import type { SiteIndexingConfig, ToolCall, } from "../"; -import { AutocompleteInput } from "../autocomplete/util/types"; -import { ProfileDescription } from "../config/ConfigHandler"; -import { SharedConfigSchema } from "../config/sharedConfig"; export type OnboardingModes = | "Local" @@ -195,4 +198,5 @@ export type ToCoreFromIdeOrWebviewProtocol = { ]; "clipboardCache/add": [{ content: string }, void]; "controlPlane/openUrl": [{ path: string }, void]; + "controlPlane/listOrganizations": [undefined, OrganizationDescription[]]; }; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 0ce81bfe8..edf079157 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -61,6 +61,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "didChangeSelectedProfile", "tools/call", "controlPlane/openUrl", + "controlPlane/listOrganizations", ]; // Message types to pass through from core to webview diff --git a/core/tools/definitions/searchWeb.ts b/core/tools/definitions/searchWeb.ts index e5f2844cd..c5868f3e0 100644 --- a/core/tools/definitions/searchWeb.ts +++ b/core/tools/definitions/searchWeb.ts @@ -13,9 +13,9 @@ export const searchWebTool: Tool = { "Performs a web search, returning top results. This tool should only be called for questions that require external knowledge. Common programming questions do not require web search.", parameters: { type: "object", - required: ["repo_url"], + required: ["query"], properties: { - repo_url: { + query: { type: "string", description: "The natural language search query", }, diff --git a/docs/docs/chat/model-setup.mdx b/docs/docs/chat/model-setup.mdx index e7e6ca94a..327f780d0 100644 --- a/docs/docs/chat/model-setup.mdx +++ b/docs/docs/chat/model-setup.mdx @@ -99,6 +99,21 @@ If you prefer to use a model from [OpenAI](../customize/model-providers/top-leve ] ``` +### Grok-2 from xAI + +If you prefer to use a model from [xAI](../customize/model-providers/top-level/xAI.md), then we recommend Grok-2. + +```json title="config.json" + "models": [ + { + "title": "Grok-2", + "provider": "xAI", + "model": "grok-2-latest", + "apiKey": "[XAI_API_KEY]" + } + ] +``` + ### Gemini 1.5 Pro from Google If you prefer to use a model from [Google](../customize/model-providers/top-level/gemini.md), then we recommend Gemini 1.5 Pro. diff --git a/docs/docs/customize/model-providers/more/asksage.md b/docs/docs/customize/model-providers/more/asksage.md index e21133cb8..204d29421 100644 --- a/docs/docs/customize/model-providers/more/asksage.md +++ b/docs/docs/customize/model-providers/more/asksage.md @@ -60,6 +60,7 @@ The current Models available provided by Ask Sage are: | 8 | GPT-4-32K | Yes | ✅ | | 9 | GPT-o1 | Yes | ✅ | | 10 | GPT-o1-mini | Yes | ✅ | +| 10 | GPT-o3-mini | Yes | ✅ | | 11 | GPT-3.5-turbo | Yes | ✅ | | 12 | Calude 3.5 Sonnet Gov | Yes | ✅ | | 13 | Calude 3 Opus | Yes | ✅ | diff --git a/docs/docs/customize/model-providers/top-level/xAI.md b/docs/docs/customize/model-providers/top-level/xAI.md index fbdfa83ad..550cc0641 100644 --- a/docs/docs/customize/model-providers/top-level/xAI.md +++ b/docs/docs/customize/model-providers/top-level/xAI.md @@ -11,15 +11,15 @@ You can get an API key from the [xAI console](https://console.x.ai/) ## Chat model -We recommend configuring **grok-beta** as your chat model. +We recommend configuring **grok-2-latest** as your chat model. For information on other available models, visit [xAI Documentation](https://docs.x.ai/docs/models). ```json title="config.json" { "models": [ { - "title": "Grok Beta", + "title": "Grok 2", "provider": "xAI", - "model": "grok-beta", + "model": "grok-2-latest", "apiKey": "[API_KEY]" } ] diff --git a/docs/docs/customize/model-types/chat.md b/docs/docs/customize/model-types/chat.md index fb6a91f15..d94f2ce2d 100644 --- a/docs/docs/customize/model-types/chat.md +++ b/docs/docs/customize/model-types/chat.md @@ -14,5 +14,6 @@ If you have the ability to use any model, we recommend [Claude 3.5 Sonnet](../mo Otherwise, some of the next best options are: - [GPT-4o](../model-providers/top-level/openai.md) +- [Grok-2](../model-providers/top-level/xAI.md) - [Gemini 1.5 Pro](../model-providers/top-level/gemini.md) - [Llama3.1 405B](../tutorials/llama3.1.md) diff --git a/docs/docs/reference.md b/docs/docs/reference.md index b492f47e9..a14da2944 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -16,9 +16,9 @@ Each model has specific configuration options tailored to its provider and funct **Properties:** - `title` (**required**): The title to assign to your model, shown in dropdowns, etc. -- `provider` (**required**): The provider of the model, which determines the type and interaction method. Options inclued `openai`, `ollama`, etc., see intelliJ suggestions. +- `provider` (**required**): The provider of the model, which determines the type and interaction method. Options inclued `openai`, `ollama`, `xAI`, etc., see IntelliJ suggestions. - `model` (**required**): The name of the model, used for prompt template auto-detection. Use `AUTODETECT` special name to get all available models. -- `apiKey`: API key required by providers like OpenAI, Anthropic, and Cohere. +- `apiKey`: API key required by providers like OpenAI, Anthropic, Cohere, and xAI. - `apiBase`: The base URL of the LLM API. - `contextLength`: Maximum context length of the model, typically in tokens (default: 2048). - `maxStopWords`: Maximum number of stop words allowed, to avoid API errors with extensive lists. diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 1d62950bc..7028aa723 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension pluginName=continue-intellij-extension pluginRepositoryUrl=https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion=0.0.86 +pluginVersion=0.0.87 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild=223 # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension 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 2388ce8ab..873add597 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 @@ -117,7 +117,9 @@ class MessageTypes { "profiles/switch", "didChangeSelectedProfile", "tools/call", - "controlPlane/openUrl" + "controlPlane/openUrl", + "controlPlane/listOrganizations" + ) } } \ No newline at end of file diff --git a/extensions/vscode/e2e/tests/SSH.test.ts b/extensions/vscode/e2e/tests/SSH.test.ts index 8683a35d3..f6b924b8e 100644 --- a/extensions/vscode/e2e/tests/SSH.test.ts +++ b/extensions/vscode/e2e/tests/SSH.test.ts @@ -1,18 +1,24 @@ import { EditorView, - TextEditor, InputBox, - Workbench, Key, - VSBrowser, + TextEditor, + Workbench, } from "vscode-extension-tester"; -import { DEFAULT_TIMEOUT } from "../constants"; -import { TestUtils } from "../TestUtils"; -import { SSHSelectors } from "../selectors/SSH.selectors"; import { AutocompleteActions } from "../actions/Autocomplete.actions"; +import { DEFAULT_TIMEOUT } from "../constants"; +import { SSHSelectors } from "../selectors/SSH.selectors"; +import { TestUtils } from "../TestUtils"; describe("SSH", function () { + if (process.env.IGNORE_SSH_TESTS === "true") { + it("Skipping SSH tests", () => { + console.log("Skipping SSH tests due to IGNORE_SSH_TESTS being set"); + }); + return; + } + it("Should display completions", async () => { await TestUtils.waitForSuccess(async () => { await new Workbench().executeCommand( diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 3149ab142..816822f52 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.255", + "version": "0.9.259", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.255", + "version": "0.9.259", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 257b6a4d4..c688eda3f 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.258", + "version": "0.9.259", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -214,7 +214,7 @@ "command": "continue.toggleFullScreen", "category": "Continue", "title": "Toggle Full Screen", - "icon": "$(fullscreen)", + "icon": "$(link-external)", "group": "Continue" }, { diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index cadaa5830..747c2ddab 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -29,16 +29,6 @@ const LayoutTopDiv = styled(CustomScrollbarDiv)` border-radius: ${defaultBorderRadius}; position: relative; overflow-x: hidden; - - &::after { - position: absolute; - content: ""; - width: 100%; - height: 1px; - background-color: rgba(136, 136, 136, 0.3); - top: 0; - left: 0; - } `; const GridDiv = styled.div` diff --git a/gui/src/components/PageHeader.tsx b/gui/src/components/PageHeader.tsx index 23e108c38..04317c947 100644 --- a/gui/src/components/PageHeader.tsx +++ b/gui/src/components/PageHeader.tsx @@ -1,20 +1,32 @@ import { ArrowLeftIcon } from "@heroicons/react/24/outline"; export interface PageHeaderProps { - onClick: () => void; - title: string; + onTitleClick?: () => void; + title?: string; + rightContent?: React.ReactNode; } -export default function PageHeader({ onClick, title }: PageHeaderProps) { +export default function PageHeader({ + onTitleClick, + title, + rightContent, +}: PageHeaderProps) { return ( -
-
- - {title} +
+
+ {title && ( +
+ + + {title} + +
+ )}
+
{rightContent}
); } diff --git a/gui/src/components/gui/NumberInput.tsx b/gui/src/components/gui/NumberInput.tsx index ce27c1cf8..5ea817b84 100644 --- a/gui/src/components/gui/NumberInput.tsx +++ b/gui/src/components/gui/NumberInput.tsx @@ -40,6 +40,7 @@ const NumberInput: React.FC = ({ />
+

Continue Config

-

Other Settings

-
+

No config profile selected

+
+
+ ); + } + + return ( +
+ navigate("/")} title="Chat" /> + +
+ {hubEnabled && !!session && ( +
+
+

Account

+ {selectedOrganization?.name && ( + + You are currently signed in to{" "} + + {selectedOrganization?.name} + + + )} +
+ + +
+ )} + +
+

Configuration

+ + + Open configuration file + +
+ +
+
+

User settings

+
+ +
@@ -202,7 +247,7 @@ function ConfigPage() { text="Use Chromium for Docs Crawling" /> -