config/addContextProvider message
This commit is contained in:
parent
ada10398f7
commit
82fd94d6b1
6 changed files with 58 additions and 4 deletions
13
core/core.ts
13
core/core.ts
|
|
@ -12,7 +12,12 @@ import {
|
|||
setupLocalConfigAfterFreeTrial,
|
||||
setupQuickstartConfig,
|
||||
} from "./config/onboarding";
|
||||
import { addModel, addOpenAIKey, deleteModel } from "./config/util";
|
||||
import {
|
||||
addContextProvider,
|
||||
addModel,
|
||||
addOpenAIKey,
|
||||
deleteModel,
|
||||
} from "./config/util";
|
||||
import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache";
|
||||
import { ContinueServerClient } from "./continueServer/stubs/client";
|
||||
import { getAuthUrlForTokenPage } from "./control-plane/auth/index";
|
||||
|
|
@ -276,6 +281,10 @@ export class Core {
|
|||
return this.configHandler.listProfiles();
|
||||
});
|
||||
|
||||
on("config/addContextProvider", async (msg) => {
|
||||
addContextProvider(msg.data);
|
||||
});
|
||||
|
||||
// Context providers
|
||||
on("context/addDocs", async (msg) => {
|
||||
void this.docsService.indexAndAdd(msg.data);
|
||||
|
|
@ -794,7 +803,7 @@ export class Core {
|
|||
});
|
||||
on("indexing/setPaused", async (msg) => {
|
||||
if (msg.data.type === "docs") {
|
||||
// this.docsService.setPaused(msg.data.id, msg.data.paused);
|
||||
// this.docsService.setPaused(msg.data.id, msg.data.paused); // not supported yet
|
||||
}
|
||||
});
|
||||
on("docs/getSuggestedDocs", async (msg) => {
|
||||
|
|
|
|||
|
|
@ -345,6 +345,10 @@ export default class DocsService {
|
|||
siteIndexingConfig: SiteIndexingConfig,
|
||||
reIndex: boolean = false,
|
||||
): Promise<void> {
|
||||
if (this.config.disableIndexing) {
|
||||
console.warn("Attempting to add/index docs when indexing is disabled");
|
||||
return;
|
||||
}
|
||||
const { startUrl } = siteIndexingConfig;
|
||||
|
||||
const canUsePreindexedDocs = await this.canUsePreindexedDocs();
|
||||
|
|
@ -352,7 +356,8 @@ export default class DocsService {
|
|||
const preIndexedDoc = preIndexedDocs[startUrl];
|
||||
const isPreIndexedDoc = !!preIndexedDoc;
|
||||
if (isPreIndexedDoc) {
|
||||
console.warn("Can only use pre");
|
||||
console.warn("Can not override pre-indexed start urls");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import type {
|
|||
ChatMessage,
|
||||
ContextItem,
|
||||
ContextItemWithId,
|
||||
ContextProviderWithParams,
|
||||
ContextSubmenuItem,
|
||||
DiffLine,
|
||||
FileSymbolMap,
|
||||
|
|
@ -66,6 +67,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
{ config: BrowserSerializedContinueConfig; profileId: string },
|
||||
];
|
||||
"config/deleteModel": [{ title: string }, void];
|
||||
"config/addContextProvider": [ContextProviderWithParams, void];
|
||||
"config/reload": [undefined, BrowserSerializedContinueConfig];
|
||||
"config/listProfiles": [undefined, ProfileDescription[]];
|
||||
"config/openProfile": [{ profileId: string | undefined }, void];
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
|
|||
"history/save",
|
||||
"devdata/log",
|
||||
"config/addModel",
|
||||
"config/addContextProvider",
|
||||
"config/newPromptFile",
|
||||
"config/ideSettingsUpdate",
|
||||
"config/getSerializedProfileInfo",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class ContinueBrowser(val project: Project, url: String) {
|
|||
"history/save",
|
||||
"devdata/log",
|
||||
"config/addModel",
|
||||
"config/addContextProvider",
|
||||
"config/newPromptFile",
|
||||
"config/ideSettingsUpdate",
|
||||
"config/getSerializedProfileInfo",
|
||||
|
|
|
|||
|
|
@ -4,11 +4,24 @@ import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
|
|||
import AddDocsDialog from "../dialogs/AddDocsDialog";
|
||||
import DocsIndexingStatus from "./DocsIndexingStatus";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import { useContext, useMemo } from "react";
|
||||
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
|
||||
function DocsIndexingStatuses() {
|
||||
const dispatch = useDispatch();
|
||||
const config = useAppSelector((store) => store.config.config);
|
||||
const configDocs = config.docs ?? [];
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
const hasDocsProvider = useMemo(() => {
|
||||
return !!config.contextProviders?.some(
|
||||
(provider) => provider.title === "docs",
|
||||
);
|
||||
}, [config]);
|
||||
|
||||
const configDocs = useMemo(() => {
|
||||
return config.docs ?? [];
|
||||
}, [config]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-1">
|
||||
|
|
@ -33,6 +46,29 @@ function DocsIndexingStatuses() {
|
|||
: "No docs yet"}
|
||||
</span>
|
||||
<div className="flex max-h-[170px] flex-col gap-1 overflow-x-hidden overflow-y-scroll pr-2">
|
||||
{!hasDocsProvider && (
|
||||
<div className="flex flex-col gap-1 text-xs">
|
||||
<div className="flex flex-row gap-1">
|
||||
<div>
|
||||
<ExclamationTriangleIcon className="h-4 w-4 text-stone-500" />
|
||||
</div>
|
||||
<span className="text-stone-500">
|
||||
@docs is not in your config
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
className="cursor-pointer text-stone-500 underline"
|
||||
onClick={() => {
|
||||
ideMessenger.post("config/addContextProvider", {
|
||||
name: "docs",
|
||||
params: {},
|
||||
});
|
||||
}}
|
||||
>
|
||||
Add @docs to my config
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
{configDocs.length === 0 && (
|
||||
<SecondaryButton
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue