Merge pull request #4183 from continuedev/nate/org-switcher

Improvements to org/assistant switcher
This commit is contained in:
Nate Sesti 2025-02-15 15:23:24 -08:00 • committed by GitHub
commit 62978d19ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 61 additions and 50 deletions

View file

@ -138,7 +138,7 @@ export class ConfigHandler {
}
}
private async loadPlatformProfiles() {
async loadPlatformProfiles() {
// Get the profiles and create their lifecycle managers
this.controlPlaneClient
.listAssistants(this.selectedOrgId)
@ -229,6 +229,22 @@ export class ConfigHandler {
return false;
}
private async reloadHubAssistants() {
const newFullSlugsList =
await this.controlPlaneClient.listAssistantFullSlugs(this.selectedOrgId);
if (newFullSlugsList) {
const shouldReload = this.fullSlugsListsDiffer(
newFullSlugsList,
this.lastFullSlugsList,
);
if (shouldReload) {
await this.loadPlatformProfiles();
}
this.lastFullSlugsList = newFullSlugsList;
}
}
private async fetchControlPlaneProfiles() {
if (await useHub(this.ideSettingsPromise)) {
clearInterval(this.platformProfilesRefreshInterval);
@ -236,23 +252,10 @@ export class ConfigHandler {
// Every 5 seconds we ask the platform whether there are any assistant updates in the last 5 seconds
// If so, we do the full (more expensive) reload
this.platformProfilesRefreshInterval = setInterval(async () => {
const newFullSlugsList =
await this.controlPlaneClient.listAssistantFullSlugs(
this.selectedOrgId,
);
if (newFullSlugsList) {
const shouldReload = this.fullSlugsListsDiffer(
newFullSlugsList,
this.lastFullSlugsList,
);
if (shouldReload) {
await this.loadPlatformProfiles();
}
this.lastFullSlugsList = newFullSlugsList;
}
}, PlatformProfileLoader.RELOAD_INTERVAL);
this.platformProfilesRefreshInterval = setInterval(
this.reloadHubAssistants.bind(this),
PlatformProfileLoader.RELOAD_INTERVAL,
);
} else {
this.controlPlaneClient
.listWorkspaces()

View file

@ -936,6 +936,7 @@ export class Core {
on("didChangeSelectedOrg", (msg) => {
void this.configHandler.setSelectedOrgId(msg.data.id);
void this.configHandler.reloadConfig();
void this.configHandler.loadPlatformProfiles();
});
on("didChangeControlPlaneSessionInfo", async (msg) => {

View file

@ -26,6 +26,8 @@ import {
} from "../../util/paths";
import { Telemetry } from "../../util/posthog";
import { ConfigResult } from "@continuedev/config-yaml";
import { GlobalContext } from "../../util/GlobalContext";
import {
ArticleWithChunks,
htmlPageToArticleWithChunks,
@ -40,8 +42,6 @@ import {
SiteIndexingResults,
} from "./preIndexed";
import preIndexedDocs from "./preIndexedDocs";
import { ConfigResult } from "@continuedev/config-yaml";
import { GlobalContext } from "../../util/GlobalContext";
// Purposefully lowercase because lancedb converts
export interface LanceDbDocsRow {
@ -436,10 +436,6 @@ export default class DocsService {
await provider.embed(["continue-test-run"]);
} catch (e) {
console.error("Failed to test embeddings connection", e);
void this.ide.showToast(
"error",
"Failed to test embeddings connection. check your embeddings model configuration",
);
return;
}

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.267",
"version": "0.9.268",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -1,15 +1,15 @@
import { useDispatch } from "react-redux";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import { useAppSelector } from "../../redux/hooks";
import { useEffect } from "react";
import { selectUsePlatform } from "../../redux/selectors";
import { PlatformOnboardingCard } from "../OnboardingCard/platform/PlatformOnboardingCard";
import { useDispatch } from "react-redux";
import { useAppSelector } from "../../redux/hooks";
import { selectUseHub } from "../../redux/selectors";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import { OnboardingCard } from "../OnboardingCard";
import { PlatformOnboardingCard } from "../OnboardingCard/platform/PlatformOnboardingCard";
function FreeTrialOverDialog() {
const dispatch = useDispatch();
const history = useAppSelector((store) => store.session.history);
const usePlatform = useAppSelector(selectUsePlatform);
const usePlatform = useAppSelector(selectUseHub);
useEffect(() => {
if (history.length === 0) {

View file

@ -1,23 +1,21 @@
import { Popover } from "@headlessui/react";
import { ChevronDownIcon } from "@heroicons/react/24/outline";
import { useEffect, useRef } from "react";
import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline";
import { useContext, useEffect, useRef } from "react";
import { useAuth } from "../../../context/Auth";
import { IdeMessengerContext } from "../../../context/IdeMessenger";
import { useAppDispatch } from "../../../redux/hooks";
import {
getFontSize,
isLocalProfile,
isMetaEquivalentKeyPressed,
} from "../../../util";
import PopoverTransition from "../../mainInput/InputToolbar/PopoverTransition";
import { AssistantSelectOptions } from "./AssistantSelectOptions";
import AssistantIcon from "./AssistantIcon";
import { getProfileDisplayText } from "./utils";
import { cycleProfile } from "../../../redux/thunks/profileAndOrg";
import { getFontSize, isMetaEquivalentKeyPressed } from "../../../util";
import PopoverTransition from "../../mainInput/InputToolbar/PopoverTransition";
import AssistantIcon from "./AssistantIcon";
import { AssistantSelectOptions } from "./AssistantSelectOptions";
import { getProfileDisplayText } from "./utils";
export default function AssistantSelect() {
const dispatch = useAppDispatch();
const buttonRef = useRef<HTMLButtonElement>(null);
const { selectedProfile } = useAuth();
const { selectedProfile, selectedOrganization } = useAuth();
const ideMessenger = useContext(IdeMessengerContext);
useEffect(() => {
let lastToggleTime = 0;
@ -45,7 +43,20 @@ export default function AssistantSelect() {
}, []);
if (!selectedProfile) {
return null;
return (
<div
onClick={() => {
ideMessenger.request("controlPlane/openUrl", {
path: "/new?type=assistant",
orgSlug: selectedOrganization?.slug,
});
}}
className="text-lightgray hover:bg mb-1 mr-3 flex cursor-pointer items-center gap-1"
style={{ fontSize: `${getFontSize() - 2}px` }}
>
<PlusIcon className="h-4 w-4" /> Create your first assistant
</div>
);
}
return (

View file

@ -42,7 +42,7 @@ import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useTutorialCard } from "../../hooks/useTutorialCard";
import { useWebviewListener } from "../../hooks/useWebviewListener";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import { selectUsePlatform } from "../../redux/selectors";
import { selectUseHub } from "../../redux/selectors";
import { selectCurrentToolCall } from "../../redux/selectors/selectCurrentToolCall";
import { selectDefaultModel } from "../../redux/slices/configSlice";
import { submitEdit } from "../../redux/slices/editModeState";
@ -222,7 +222,7 @@ export function Chat() {
selectIsSingleRangeEditOrInsertion,
);
const lastSessionId = useAppSelector((state) => state.session.lastSessionId);
const usePlatform = useAppSelector(selectUsePlatform);
const useHub = useAppSelector(selectUseHub);
useEffect(() => {
// Cmd + Backspace to delete current step
@ -365,7 +365,7 @@ export function Chat() {
useAutoScroll(stepsDivRef, history);
const showPageHeader = isInEditMode || usePlatform;
const showPageHeader = isInEditMode || useHub;
return (
<>
@ -382,7 +382,7 @@ export function Chat() {
}
: undefined
}
rightContent={usePlatform && <AssistantSelect />}
rightContent={useHub && <AssistantSelect />}
/>
)}
@ -567,7 +567,7 @@ export function Chat() {
<>
{onboardingCard.show && (
<div className="mx-2 mt-10">
{usePlatform ? (
{useHub ? (
<PlatformOnboardingCard isDialog={false} />
) : (
<OnboardingCard isDialog={false} />

View file

@ -43,7 +43,7 @@ export const selectUseActiveFile = createSelector(
(defaultContext) => defaultContext?.includes("activeFile" as any),
);
export const selectUsePlatform = createSelector(
export const selectUseHub = createSelector(
[(state: RootState) => state.config.config.usePlatform],
(usePlatform) => usePlatform,
);