diff --git a/core/index.d.ts b/core/index.d.ts index 48eebe563..e46221698 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -135,6 +135,8 @@ export interface LoadSubmenuItemsArgs { export interface CustomContextProvider { title: string; + startUrl: string, + maxDepth: number displayTitle?: string; description?: string; renderInlineAs?: string; @@ -146,6 +148,10 @@ export interface CustomContextProvider { loadSubmenuItems?: ( args: LoadSubmenuItemsArgs, ) => Promise; + addDocs( + startUrl: string, + maxDepth: number + ) } export interface ContextSubmenuItem { diff --git a/core/protocol.ts b/core/protocol.ts index 64a1a3109..4879a5450 100644 --- a/core/protocol.ts +++ b/core/protocol.ts @@ -63,7 +63,7 @@ export type Protocol = { { title: string }, Promise, ]; - "context/addDocs": [siteIndexingConfig: SiteIndexingConfig, Promise]; + "context/addDocs": [siteIndexingConfig: SiteIndexingConfig, void]; "autocomplete/complete": [AutocompleteInput, Promise]; "autocomplete/cancel": [undefined, void]; "autocomplete/accept": [{ completionId: string }, void]; @@ -116,6 +116,7 @@ export type Protocol = { }, ProtocolGeneratorType, ]; + }; export interface IdeSettings { diff --git a/core/web/webviewProtocol.ts b/core/web/webviewProtocol.ts index 9cca093ed..b13242244 100644 --- a/core/web/webviewProtocol.ts +++ b/core/web/webviewProtocol.ts @@ -14,7 +14,6 @@ import { RangeInFileWithContents } from "../commands/util.js"; import { Protocol } from "../protocol.js"; export type IdeProtocol = { - listWorkspaceContents: [undefined, string[]]; getWorkspaceDirs: [undefined, string[]]; listFolders: [undefined, string[]]; writeFile: [{ path: string; contents: string }, void]; @@ -72,8 +71,6 @@ export type WebviewProtocol = Protocol & vscMediaUrl: string; }, ]; - - errorPopup: [{ message: string }, void]; "index/setPaused": [boolean, void]; "index/forceReIndex": [undefined, void]; openUrl: [string, void]; @@ -105,7 +102,6 @@ export type WebviewProtocol = Protocol & }; export type ReverseWebviewProtocol = { - addDocs: [{ startUrl: string, rootUrl: string; title: string; maxDepth?: number;}] setInactive: [undefined, void]; configUpdate: [undefined, void]; submitMessage: [{ message: any }, void]; // any -> JSONContent from TipTap diff --git a/extensions/vscode/src/webviewProtocol.ts b/extensions/vscode/src/webviewProtocol.ts index ab50d6b08..25dee3c0f 100644 --- a/extensions/vscode/src/webviewProtocol.ts +++ b/extensions/vscode/src/webviewProtocol.ts @@ -557,15 +557,14 @@ export async function showTutorial() { }); this.on("context/addDocs", (msg) => { const siteIndexingConfig: SiteIndexingConfig = { - startUrl: msg.data.url, - rootUrl: msg.data.url, + startUrl: msg.data.startUrl, + rootUrl: msg.data.rootUrl, title: msg.data.title, - maxDepth: 4 + maxDepth: msg.data.maxDepth }; - // const siteIndexingConfig = msg.data const embeddingsProvider = new TransformersJsEmbeddingsProvider(); - console.log("In vscode addDocs") + console.log("In vscode addDocs. maxDepth", siteIndexingConfig.maxDepth, " startUrl: ", siteIndexingConfig.startUrl) vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, diff --git a/gui/src/components/dialogs/AddDocsDialog.tsx b/gui/src/components/dialogs/AddDocsDialog.tsx index 6c106a2cf..a38e5e91c 100644 --- a/gui/src/components/dialogs/AddDocsDialog.tsx +++ b/gui/src/components/dialogs/AddDocsDialog.tsx @@ -8,13 +8,6 @@ import { setShowDialog } from "../../redux/slices/uiStateSlice"; import { postToIde } from "../../util/ide"; import { SiteIndexingConfig } from "core/index"; -// export interface SiteIndexingConfig { -// startUrl: string; -// rootUrl: string; -// title: string; -// maxDepth?: number; -// } - const GridDiv = styled.div` display: grid; grid-template-columns: 1fr 1fr; @@ -28,7 +21,6 @@ function AddDocsDialog() { const [docsTitle, setDocsTitle] = React.useState(""); const [urlValid, setUrlValid] = React.useState(false); const [maxDepth, setMaxDepth] = React.useState(defaultMaxDepth); - const [maxDepthValid, setMaxDepthValid] = React.useState(false) // ToDo const dispatch = useDispatch(); @@ -76,7 +68,9 @@ function AddDocsDialog() { type="text" placeholder={`Max Depth (Default=${defaultMaxDepth})`} value={maxDepth} - onChange={(e) => setMaxDepth(Number(e.target.value))} + onChange={(e) => { + setMaxDepth(Number(e.target.value)) + }} />