From 0156409dac5a445b055ede921c1c07706759ff4e Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 12 Mar 2025 22:28:15 -0700 Subject: [PATCH] feat: use s3 for global docs cache on all docs --- CONTRIBUTING.md | 5 - core/context/providers/DocsContextProvider.ts | 54 +-- core/index.d.ts | 7 +- core/indexing/docs/DocsService.ts | 213 +++++----- .../docs/{preIndexed.ts => docsCache.ts} | 17 +- core/indexing/docs/preIndexedDocs.ts | 368 ------------------ docs/docs/customize/deep-dives/docs.mdx | 6 - .../current/customize/deep-dives/docs.md | 6 - gui/src/components/dialogs/AddDocsDialog.tsx | 11 +- .../components/indexing/DocsDetailsDialog.tsx | 34 +- gui/src/components/mainInput/MentionList.tsx | 2 +- gui/src/pages/gui/Chat.tsx | 6 - 12 files changed, 153 insertions(+), 576 deletions(-) rename core/indexing/docs/{preIndexed.ts => docsCache.ts} (59%) delete mode 100644 core/indexing/docs/preIndexedDocs.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f7e1634f..73997880a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,6 @@ - [Writing Context Providers](#writing-context-providers) - [Adding an LLM Provider](#adding-an-llm-provider) - [Adding Models](#adding-models) - - [Adding Pre-indexed Documentation](#adding-pre-indexed-documentation) - [📐 Continue Architecture](#-continue-architecture) - [Continue VS Code Extension](#continue-vs-code-extension) - [Continue JetBrains Extension](#continue-jetbrains-extension) @@ -212,10 +211,6 @@ While any model that works with a supported provider can be used with Continue, - LLM Providers: Since many providers use their own custom strings to identify models, you'll have to add the translation from Continue's model name (the one you added to `index.d.ts`) and the model string for each of these providers: [Ollama](./core/llm/llms/Ollama.ts), [Together](./core/llm/llms/Together.ts), and [Replicate](./core/llm/llms/Replicate.ts). You can find their full model lists here: [Ollama](https://ollama.ai/library), [Together](https://docs.together.ai/docs/inference-models), [Replicate](https://replicate.com/collections/streaming-language-models). - [Prompt Templates](./core/llm/index.ts) - In this file you'll find the `autodetectTemplateType` function. Make sure that for the model name you just added, this function returns the correct template type. This is assuming that the chat template for that model is already built in Continue. If not, you will have to add the template type and corresponding edit and chat templates. -### Adding Pre-indexed Documentation - -Continue's @docs context provider lets you easily reference entire documentation sites and then uses embeddings to add the most relevant pages to context. To make the experience as smooth as possible, we pre-index many of the most popular documentation sites. If you'd like to add new documentation to this list, just add an object to the list in [preIndexedDocs.ts](./core/indexing/docs/preIndexedDocs.ts). `startUrl` is where the crawler will start and `rootUrl` will filter out any pages not on that site and under the path of `rootUrl`. - ## 📐 Continue Architecture Continue consists of 2 parts that are split so that it can be extended to work in other IDEs as easily as possible: diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index 3b9fa0cf4..360e68670 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -9,7 +9,6 @@ import { LoadSubmenuItemsArgs, } from "../.."; import DocsService from "../../indexing/docs/DocsService"; -import preIndexedDocs from "../../indexing/docs/preIndexedDocs"; import { INSTRUCTIONS_BASE_ITEM } from "./utils"; @@ -64,23 +63,12 @@ class DocsContextProvider extends BaseContextProvider { return chunksCopy; } - private _sortByPreIndexedDocs( + private _sortAlphabetically( submenuItems: ContextSubmenuItem[], ): ContextSubmenuItem[] { - // Sort submenuItems such that the objects with titles which don't occur in configs occur first, and alphabetized + // Sort submenu items alphabetically by title return submenuItems.sort((a, b) => { - const aTitleInConfigs = a.metadata?.preIndexed ?? false; - const bTitleInConfigs = b.metadata?.preIndexed ?? false; - - // Primary criterion: Items not in configs come first - if (!aTitleInConfigs && bTitleInConfigs) { - return -1; - } else if (aTitleInConfigs && !bTitleInConfigs) { - return 1; - } else { - // Secondary criterion: Alphabetical order when both items are in the same category - return a.title.toString().localeCompare(b.title.toString()); - } + return a.title.toString().localeCompare(b.title.toString()); }); } @@ -165,13 +153,13 @@ class DocsContextProvider extends BaseContextProvider { } await docsService.isInitialized; - // Create map of docs url -> submenu item - const submenuItemsMap = new Map(); + // Create an array to hold submenu items + const submenuItems: ContextSubmenuItem[] = []; - // Add custom docs from config + // Get all indexed docs from the database const docs = (await docsService.listMetadata()) ?? []; for (const { startUrl, title, favicon } of docs) { - submenuItemsMap.set(startUrl, { + submenuItems.push({ title, id: startUrl, description: new URL(startUrl).hostname, @@ -179,32 +167,8 @@ class DocsContextProvider extends BaseContextProvider { }); } - // Add pre-indexed docs if supported - const canUsePreindexedDocs = await docsService.canUsePreindexedDocs(); - if (canUsePreindexedDocs) { - for (const { startUrl, title } of Object.values(preIndexedDocs)) { - // Skip if overridden in config - if (docs.find((d) => d.startUrl === startUrl)) { - continue; - } - submenuItemsMap.set(startUrl, { - title, - id: startUrl, - description: new URL(startUrl).hostname, - metadata: { - preIndexed: true, - }, - }); - } - } - - // Create array and sort if pre-indexed is supported - const submenuItems = Array.from(submenuItemsMap.values()); - if (canUsePreindexedDocs) { - return this._sortByPreIndexedDocs(submenuItems); - } - - return submenuItems; + // Sort alphabetically + return this._sortAlphabetically(submenuItems); } } diff --git a/core/index.d.ts b/core/index.d.ts index f9daec503..b85b96545 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -164,7 +164,11 @@ export interface ILLM extends LLMOptions { } export interface ModelInstaller { - installModel(modelName: string, signal: AbortSignal, progressReporter?: (task: string, increment: number, total: number) => void): Promise; + installModel( + modelName: string, + signal: AbortSignal, + progressReporter?: (task: string, increment: number, total: number) => void, + ): Promise; } export type ContextProviderType = "normal" | "query" | "submenu"; @@ -240,7 +244,6 @@ export interface DocsIndexingDetails { config: SiteIndexingConfig; indexingStatus: IndexingStatus | undefined; chunks: Chunk[]; - isPreIndexedDoc: boolean; } export interface IContextProvider { diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 75f92b145..42f485068 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -39,11 +39,10 @@ import DocsCrawler, { DocsCrawlerType, PageData } from "./crawlers/DocsCrawler"; import { runLanceMigrations, runSqliteMigrations } from "./migrations"; import { downloadFromS3, - getS3Filename, + getS3CacheKey, S3Buckets, SiteIndexingResults, -} from "./preIndexed"; -import preIndexedDocs from "./preIndexedDocs"; +} from "./docsCache"; import type * as LanceType from "vectordb"; @@ -89,7 +88,7 @@ export default class DocsService { static lanceTableName = "docs"; static sqlitebTableName = "docs"; - static preIndexedDocsEmbeddingsProvider = + static defaultEmbeddingsProvider = new TransformersJsEmbeddingsProvider(); public isInitialized: Promise; @@ -250,12 +249,8 @@ export default class DocsService { return false; } - /* - * Currently, we generate and host embeddings for pre-indexed docs using transformers. - * However, we don't ship transformers with the JetBrains extension. - * So, we only include pre-indexed docs in the submenu for non-JetBrains IDEs. - */ - async canUsePreindexedDocs() { + // Determine if transformers.js embeddings are supported in this environment + async canUseTransformersEmbeddings() { const ideInfo = await this.ideInfoPromise; if (ideInfo.ideType === "jetbrains") { return false; @@ -263,28 +258,26 @@ export default class DocsService { return true; } - // Determines if using preIndexed and returns proper embeddings provider - async getEmbeddingsProvider(startUrl: string) { - // Conditions for using a pre-indexed doc - - // Must be in pre indexed docs file - const preIndexedDoc = preIndexedDocs[startUrl]; - if (preIndexedDoc) { - // Most not be overriden by config - if (!this.config?.docs?.find((doc) => doc.startUrl === startUrl)) { - // Must be supported - const canUsePreindexedDocs = await this.canUsePreindexedDocs(); - if (canUsePreindexedDocs) { - return { - provider: DocsService.preIndexedDocsEmbeddingsProvider, - isPreindexed: true, - }; - } - } + // Get the appropriate embeddings provider + async getEmbeddingsProvider() { + // First check if there's a config selected embeddings provider + if (this.config.selectedModelByRole.embed) { + return { + provider: this.config.selectedModelByRole.embed, + }; } + + // Fall back to transformers if supported + const canUseTransformers = await this.canUseTransformersEmbeddings(); + if (canUseTransformers) { + return { + provider: DocsService.defaultEmbeddingsProvider, + }; + } + + // No provider available return { - provider: this.config.selectedModelByRole.embed, - isPreindexed: false, + provider: undefined, }; } @@ -392,16 +385,39 @@ export default class DocsService { return; } - const { isPreindexed, provider } = - await this.getEmbeddingsProvider(startUrl); - if (isPreindexed) { - console.warn("Attempted to indexAndAdd pre-indexed doc"); - return; - } + const { provider } = await this.getEmbeddingsProvider(); if (!provider) { console.warn("@docs indexAndAdd: no embeddings provider found"); return; } + + // Try to fetch from cache first before crawling + if (!forceReindex) { + try { + const cacheHit = await this.tryFetchFromCache(startUrl, provider.embeddingId); + if (cacheHit) { + console.log(`Successfully loaded cached embeddings for ${startUrl}`); + // Update status to complete + this.handleStatusUpdate({ + type: "docs", + id: startUrl, + embeddingsProviderId: provider.embeddingId, + isReindexing: false, + title: siteIndexingConfig.title, + debugInfo: "Loaded from cache", + icon: siteIndexingConfig.faviconUrl, + url: startUrl, + progress: 1, + description: "Complete", + status: "complete", + }); + return; + } + } catch (e) { + console.log(`Error trying to fetch from cache: ${e}`); + // Continue with regular indexing + } + } const startedWithEmbedder = provider.embeddingId; @@ -705,36 +721,49 @@ export default class DocsService { } } - // When user requests a pre-indexed doc for the first time - // And pre-indexed embeddings are supported - // Fetch pre-indexed embeddings from S3, add to Lance, and then search those - private async fetchAndAddPreIndexedDocEmbeddings(title: string) { - const data = await downloadFromS3( - S3Buckets.continueIndexedDocs, - getS3Filename( - DocsService.preIndexedDocsEmbeddingsProvider.embeddingId, - title, - ), - ); + /** + * Try to fetch embeddings from the S3 cache for any document URL + * @param startUrl The URL of the documentation site + * @param embeddingsProviderId The ID of the embeddings provider + * @returns True if cache hit and successfully loaded, false otherwise + */ + private async tryFetchFromCache( + startUrl: string, + embeddingsProviderId: string + ): Promise { + try { + // Generate a cache key for this URL and embeddings provider + const cacheKey = getS3CacheKey(embeddingsProviderId, startUrl); + + // Attempt to download from S3 cache + const data = await downloadFromS3( + S3Buckets.docsEmbeddingsCache, + cacheKey + ); - const siteEmbeddings = JSON.parse(data) as SiteIndexingResults; - const startUrl = new URL(siteEmbeddings.url).toString(); + // Parse the cached data + const siteEmbeddings = JSON.parse(data) as SiteIndexingResults; + + // Try to get a favicon for the site + const favicon = await fetchFavicon(new URL(startUrl)); - const faviconUrl = preIndexedDocs[startUrl].faviconUrl; - const favicon = - typeof faviconUrl === "string" - ? await getFaviconBase64(faviconUrl) - : undefined; + // Add the cached embeddings to our database + await this.add({ + favicon, + siteIndexingConfig: { + startUrl, + title: siteEmbeddings.title || new URL(startUrl).hostname, + }, + chunks: siteEmbeddings.chunks, + embeddings: siteEmbeddings.chunks.map((c) => c.embedding), + }); - await this.add({ - favicon, - siteIndexingConfig: { - startUrl, - title: siteEmbeddings.title, - }, - chunks: siteEmbeddings.chunks, - embeddings: siteEmbeddings.chunks.map((c) => c.embedding), - }); + return true; + } catch (e) { + // Cache miss or error - silently fail + console.log(`Cache miss for ${startUrl} with provider ${embeddingsProviderId}`); + return false; + } } // Retrieve docs embeds based on user input @@ -743,8 +772,7 @@ export default class DocsService { startUrl: string, nRetrieve: number, ) { - const { isPreindexed, provider } = - await this.getEmbeddingsProvider(startUrl); + const { provider } = await this.getEmbeddingsProvider(); if (!provider) { void this.ide.showToast( @@ -755,15 +783,11 @@ export default class DocsService { return []; } - if (isPreindexed) { - void Telemetry.capture("docs_pre_indexed_doc_used", { - doc: preIndexedDocs[startUrl]!["title"], - }); - } - + // Try to get embeddings for the query const [vector] = await provider.embed([query]); - - return await this.retrieveChunks(startUrl, vector, nRetrieve, isPreindexed); + + // Retrieve chunks using the query vector + return await this.retrieveChunks(startUrl, vector, nRetrieve); } private lanceDBRowToChunk(row: LanceDbDocsRow): Chunk { @@ -783,8 +807,7 @@ export default class DocsService { const db = await this.getOrCreateSqliteDb(); try { - const { isPreindexed, provider } = - await this.getEmbeddingsProvider(startUrl); + const { provider } = await this.getEmbeddingsProvider(); if (!provider) { throw new Error("No embeddings model set"); @@ -819,22 +842,26 @@ export default class DocsService { config: siteIndexingConfig, indexingStatus: this.statuses.get(startUrl), chunks: rows.map(this.lanceDBRowToChunk), - isPreIndexedDoc: isPreindexed, }; } catch (e) { console.warn("Error getting details", e); throw e; } } - // This is split into its own function so that it can be recursive - // in the case of fetching preindexed docs from s3 + // This function attempts to retrieve chunks by vector similarity + // It will also attempt to fetch from cache if no results are found async retrieveChunks( startUrl: string, vector: number[], nRetrieve: number, - isPreindexed: boolean, isRetry: boolean = false, ): Promise { + // Get the appropriate embeddings provider + const { provider } = await this.getEmbeddingsProvider(); + if (!provider) { + return []; + } + // Lance doesn't have an embeddingsprovider column, instead it includes it in the table name const table = await this.getOrCreateLanceTable({ initializationVector: vector, @@ -852,15 +879,19 @@ export default class DocsService { console.warn("Error retrieving chunks from LanceDB", e); } - // No docs are found for preindexed? try fetching once - if (docs.length === 0 && isPreindexed) { - if (isRetry) { - return []; + // If no docs are found and this isn't a retry, try fetching from S3 cache + if (docs.length === 0 && !isRetry) { + try { + // Try to fetch the document from the S3 cache + const cacheHit = await this.tryFetchFromCache(startUrl, provider.embeddingId); + + if (cacheHit) { + // If cache hit, retry the search once + return await this.retrieveChunks(startUrl, vector, nRetrieve, true); + } + } catch (e) { + console.warn("Error trying to fetch from cache:", e); } - await this.fetchAndAddPreIndexedDocEmbeddings( - preIndexedDocs[startUrl]!["title"], - ); - return await this.retrieveChunks(startUrl, vector, nRetrieve, true, true); } return docs.map(this.lanceDBRowToChunk); @@ -933,11 +964,9 @@ export default class DocsService { const currentlyIndexedDocs = await this.listMetadata(); const currentStartUrls = currentlyIndexedDocs.map((doc) => doc.startUrl); - // Anything found in sqlite but not in new config should be deleted if not preindexed + // Anything found in sqlite but not in new config should be deleted const deletedDocs = currentlyIndexedDocs.filter( - (doc) => - !preIndexedDocs[doc.startUrl] && - !newConfigStartUrls.includes(doc.startUrl), + (doc) => !newConfigStartUrls.includes(doc.startUrl), ); // Anything found in old config, new config, AND sqlite that doesn't match should be reindexed @@ -1063,7 +1092,7 @@ export default class DocsService { const conn = await lance.connect(getLanceDbPath()); const tableNames = await conn.tableNames(); - const { provider } = await this.getEmbeddingsProvider(startUrl); + const { provider } = await this.getEmbeddingsProvider(); if (!provider) { throw new Error( diff --git a/core/indexing/docs/preIndexed.ts b/core/indexing/docs/docsCache.ts similarity index 59% rename from core/indexing/docs/preIndexed.ts rename to core/indexing/docs/docsCache.ts index b66d21e70..6f29b4af8 100644 --- a/core/indexing/docs/preIndexed.ts +++ b/core/indexing/docs/docsCache.ts @@ -2,15 +2,18 @@ import request from "request"; import { Chunk } from "../../"; -export function getS3Filename( - embeddingsProviderId: string, - title: string, -): string { - return `_TransformersJsEmbeddingsProvider::all-MiniLM-L6-v2/${title}`; +/** + * Generate a standardized S3 cache key for any doc URL. + * This creates a predictable cache key format based on the embedding provider and URL. + */ +export function getS3CacheKey(embeddingsProviderId: string, url: string): string { + // URL-encode and normalize the URL to use as cache key + const normalizedUrl = encodeURIComponent(url); + return `${embeddingsProviderId}/${normalizedUrl}`; } export enum S3Buckets { - continueIndexedDocs = "continue-indexed-docs", + docsEmbeddingsCache = "continue-indexed-docs", // Keeping same bucket name for compatibility } const AWS_REGION = "us-west-1"; @@ -27,7 +30,7 @@ export async function downloadFromS3( }); download.on("response", (response: any) => { if (response.statusCode !== 200) { - reject(new Error("There was an error retreiving the pre-indexed doc")); + reject(new Error("There was an error retrieving the cached document")); } }); diff --git a/core/indexing/docs/preIndexedDocs.ts b/core/indexing/docs/preIndexedDocs.ts deleted file mode 100644 index 5342396fd..000000000 --- a/core/indexing/docs/preIndexedDocs.ts +++ /dev/null @@ -1,368 +0,0 @@ -import { SiteIndexingConfig } from "../../"; - -const preIndexedDocs: Record< - SiteIndexingConfig["startUrl"], - SiteIndexingConfig -> = { - "https://jinja.palletsprojects.com/en/3.1.x/": { - title: "Jinja", - startUrl: "https://jinja.palletsprojects.com/en/3.1.x/", - rootUrl: "https://jinja.palletsprojects.com/en/3.1.x/", - faviconUrl: "https://jinja.palletsprojects.com/favicon.ico", - }, - "https://react.dev/reference/": { - title: "React", - startUrl: "https://react.dev/reference/", - rootUrl: "https://react.dev/reference/", - faviconUrl: "https://react.dev/favicon.ico", - }, - "https://posthog.com/docs": { - title: "PostHog", - startUrl: "https://posthog.com/docs", - rootUrl: "https://posthog.com/docs", - faviconUrl: "https://posthog.com/favicon.ico", - }, - "https://expressjs.com/en/5x/api.html": { - title: "Express", - startUrl: "https://expressjs.com/en/5x/api.html", - rootUrl: "https://expressjs.com/en/5x/", - faviconUrl: "https://expressjs.com/favicon.ico", - }, - "https://platform.openai.com/docs/": { - title: "OpenAI", - startUrl: "https://platform.openai.com/docs/", - rootUrl: "https://platform.openai.com/docs/", - faviconUrl: "https://platform.openai.com/favicon.ico", - }, - "https://www.prisma.io/docs": { - title: "Prisma", - startUrl: "https://www.prisma.io/docs", - rootUrl: "https://www.prisma.io/docs", - faviconUrl: "https://www.prisma.io/favicon.ico", - }, - "https://boto3.amazonaws.com/v1/documentation/api/latest/index.html": { - title: "Boto3", - startUrl: - "https://boto3.amazonaws.com/v1/documentation/api/latest/index.html", - rootUrl: "https://boto3.amazonaws.com/v1/documentation/api/latest/", - faviconUrl: "https://boto3.amazonaws.com/favicon.ico", - }, - "https://pytorch.org/docs/stable/": { - title: "Pytorch", - startUrl: "https://pytorch.org/docs/stable/", - rootUrl: "https://pytorch.org/docs/stable/", - faviconUrl: "https://pytorch.org/favicon.ico", - }, - "https://redis.io/docs/": { - title: "Redis", - startUrl: "https://redis.io/docs/", - rootUrl: "https://redis.io/docs/", - faviconUrl: "https://redis.io/favicon.ico", - }, - "https://axios-http.com/docs/intro": { - title: "Axios", - startUrl: "https://axios-http.com/docs/intro", - rootUrl: "https://axios-http.com/docs", - faviconUrl: "https://axios-http.com/favicon.ico", - }, - "https://redwoodjs.com/docs/introduction": { - title: "Redwood JS", - startUrl: "https://redwoodjs.com/docs/introduction", - rootUrl: "https://redwoodjs.com/docs", - faviconUrl: "https://redwoodjs.com/favicon.ico", - }, - "https://graphql.org/learn/": { - title: "GraphQL", - startUrl: "https://graphql.org/learn/", - rootUrl: "https://graphql.org/learn/", - faviconUrl: "https://graphql.org/favicon.ico", - }, - "https://www.typescriptlang.org/docs/": { - title: "Typescript", - startUrl: "https://www.typescriptlang.org/docs/", - rootUrl: "https://www.typescriptlang.org/docs/", - faviconUrl: "https://www.typescriptlang.org/favicon.ico", - }, - "https://jestjs.io/docs/getting-started": { - title: "Jest", - startUrl: "https://jestjs.io/docs/getting-started", - rootUrl: "https://jestjs.io/docs", - faviconUrl: "https://jestjs.io/favicon.ico", - }, - "https://tailwindcss.com/docs/installation": { - title: "Tailwind CSS", - startUrl: "https://tailwindcss.com/docs/installation", - rootUrl: "https://tailwindcss.com/docs", - faviconUrl: "https://tailwindcss.com/favicon.ico", - }, - "https://vuejs.org/guide/introduction.html": { - title: "Vue.js", - startUrl: "https://vuejs.org/guide/introduction.html", - rootUrl: "https://vuejs.org", - faviconUrl: "https://vuejs.org/favicon.ico", - }, - "https://svelte.dev/docs/introduction": { - title: "Svelte", - startUrl: "https://svelte.dev/docs/introduction", - rootUrl: "https://svelte.dev/docs", - faviconUrl: "https://svelte.dev/favicon.ico", - }, - "https://docs.github.com/en/actions": { - title: "GitHub Actions", - startUrl: "https://docs.github.com/en/actions", - rootUrl: "https://docs.github.com/en/actions", - faviconUrl: "https://docs.github.com/favicon.ico", - }, - "https://nodejs.org/docs/latest/api/": { - title: "NodeJS", - startUrl: "https://nodejs.org/docs/latest/api/", - rootUrl: "https://nodejs.org/docs/latest/api/", - faviconUrl: "https://nodejs.org/favicon.ico", - }, - "https://socket.io/docs/v4/": { - title: "Socket.io", - startUrl: "https://socket.io/docs/v4/", - rootUrl: "https://socket.io/docs/v4/", - faviconUrl: "https://socket.io/favicon.ico", - }, - "https://docs.gradle.org/current/userguide/userguide.html": { - title: "Gradle", - startUrl: "https://docs.gradle.org/current/userguide/userguide.html", - rootUrl: "https://docs.gradle.org/current", - faviconUrl: "https://docs.gradle.org/favicon.ico", - }, - "https://redux-toolkit.js.org/introduction/getting-started": { - title: "Redux Toolkit", - startUrl: "https://redux-toolkit.js.org/introduction/getting-started", - rootUrl: "https://redux-toolkit.js.org", - faviconUrl: "https://redux-toolkit.js.org/favicon.ico", - }, - "https://docs.trychroma.com/": { - title: "Chroma", - startUrl: "https://docs.trychroma.com/", - rootUrl: "https://docs.trychroma.com/", - faviconUrl: "https://docs.trychroma.com/favicon.ico", - }, - "https://www.sqlite.org/docs.html": { - title: "SQLite", - startUrl: "https://www.sqlite.org/docs.html", - rootUrl: "https://www.sqlite.org", - faviconUrl: "https://www.sqlite.org/favicon.ico", - }, - "https://redux.js.org/introduction/getting-started": { - title: "Redux", - startUrl: "https://redux.js.org/introduction/getting-started", - rootUrl: "https://redux.js.org", - faviconUrl: "https://redux.js.org/favicon.ico", - }, - "https://prettier.io/docs/en/": { - title: "Prettier", - startUrl: "https://prettier.io/docs/en/", - rootUrl: "https://prettier.io/docs/en/", - faviconUrl: "https://prettier.io/favicon.ico", - }, - "https://code.visualstudio.com/api": { - title: "VS Code Extension API", - startUrl: "https://code.visualstudio.com/api", - rootUrl: "https://code.visualstudio.com/api", - faviconUrl: "https://code.visualstudio.com/favicon.ico", - }, - "https://docs.continue.dev/intro": { - title: "Continue", - startUrl: "https://docs.continue.dev/intro", - rootUrl: "https://docs.continue.dev", - faviconUrl: "https://docs.continue.dev/favicon.ico", - }, - "https://api.jquery.com/": { - title: "jQuery", - startUrl: "https://api.jquery.com/", - rootUrl: "https://api.jquery.com/", - faviconUrl: "https://api.jquery.com/favicon.ico", - }, - "https://docs.python.org/3/": { - title: "Python", - startUrl: "https://docs.python.org/3/", - rootUrl: "https://docs.python.org/3/", - faviconUrl: "https://docs.python.org/favicon.ico", - }, - "https://doc.rust-lang.org/book/": { - title: "Rust", - startUrl: "https://doc.rust-lang.org/book/", - rootUrl: "https://doc.rust-lang.org/book/", - faviconUrl: "https://doc.rust-lang.org/favicon.ico", - }, - "https://plugins.jetbrains.com/docs/intellij/welcome.html": { - title: "IntelliJ Platform SDK", - startUrl: "https://plugins.jetbrains.com/docs/intellij/welcome.html", - rootUrl: "https://plugins.jetbrains.com/docs/intellij", - faviconUrl: "https://plugins.jetbrains.com/favicon.ico", - }, - "https://docs.docker.com/": { - title: "Docker", - startUrl: "https://docs.docker.com/", - rootUrl: "https://docs.docker.com/", - faviconUrl: "https://docs.docker.com/favicon.ico", - }, - "https://docs.npmjs.com/": { - title: "NPM", - startUrl: "https://docs.npmjs.com/", - rootUrl: "https://docs.npmjs.com/", - faviconUrl: "https://docs.npmjs.com/favicon.ico", - }, - "https://tiptap.dev/docs/editor/introduction": { - title: "TipTap", - startUrl: "https://tiptap.dev/docs/editor/introduction", - rootUrl: "https://tiptap.dev/docs", - faviconUrl: "https://tiptap.dev/favicon.ico", - }, - "https://esbuild.github.io/": { - title: "esbuild", - startUrl: "https://esbuild.github.io/", - rootUrl: "https://esbuild.github.io/", - faviconUrl: "https://esbuild.github.io/favicon.ico", - }, - "https://tree-sitter.github.io/tree-sitter/": { - title: "Tree Sitter", - startUrl: "https://tree-sitter.github.io/tree-sitter/", - rootUrl: "https://tree-sitter.github.io/tree-sitter/", - faviconUrl: "https://tree-sitter.github.io/favicon.ico", - }, - "https://docs.netlify.com/": { - title: "Netlify", - startUrl: "https://docs.netlify.com/", - rootUrl: "https://docs.netlify.com/", - faviconUrl: "https://docs.netlify.com/favicon.ico", - }, - "https://replicate.com/docs": { - title: "Replicate", - startUrl: "https://replicate.com/docs", - rootUrl: "https://replicate.com/docs", - faviconUrl: "https://replicate.com/favicon.ico", - }, - "https://www.w3schools.com/html/default.asp": { - title: "HTML", - startUrl: "https://www.w3schools.com/html/default.asp", - rootUrl: "https://www.w3schools.com/html", - faviconUrl: "https://www.w3schools.com/favicon.ico", - }, - "https://www.w3schools.com/css/default.asp": { - title: "CSS", - startUrl: "https://www.w3schools.com/css/default.asp", - rootUrl: "https://www.w3schools.com/css", - faviconUrl: "https://www.w3schools.com/favicon.ico", - }, - "https://python.langchain.com/docs/get_started/introduction": { - title: "Langchain", - startUrl: "https://python.langchain.com/docs/get_started/introduction", - rootUrl: "https://python.langchain.com/docs", - faviconUrl: "https://python.langchain.com/favicon.ico", - }, - "https://developer.woocommerce.com/docs/": { - title: "WooCommerce", - startUrl: "https://developer.woocommerce.com/docs/", - rootUrl: "https://developer.woocommerce.com/docs/", - faviconUrl: "https://developer.woocommerce.com/favicon.ico", - }, - "https://developer.wordpress.org/reference/": { - title: "WordPress", - startUrl: "https://developer.wordpress.org/reference/", - rootUrl: "https://developer.wordpress.org/reference/", - faviconUrl: "https://developer.wordpress.org/favicon.ico", - }, - "https://doc.qt.io/qtforpython-6/quickstart.html": { - title: "PySide6", - startUrl: "https://doc.qt.io/qtforpython-6/quickstart.html", - rootUrl: "https://doc.qt.io/qtforpython-6/api.html", - faviconUrl: "https://doc.qt.io/favicon.ico", - }, - "https://getbootstrap.com/docs/5.3/getting-started/introduction/": { - title: "Bootstrap", - startUrl: "https://getbootstrap.com/docs/5.3/getting-started/introduction/", - rootUrl: "https://getbootstrap.com/docs/5.3/", - faviconUrl: "https://getbootstrap.com/favicon.ico", - }, - "https://alpinejs.dev/start-here": { - title: "Alpine.js", - startUrl: "https://alpinejs.dev/start-here", - rootUrl: "https://alpinejs.dev/", - faviconUrl: "https://alpinejs.dev/favicon.ico", - }, - "https://learn.microsoft.com/en-us/dotnet/csharp/": { - title: "C# Language Reference", - startUrl: "https://learn.microsoft.com/en-us/dotnet/csharp/", - rootUrl: "https://learn.microsoft.com/en-us/dotnet/csharp/", - faviconUrl: "https://learn.microsoft.com/favicon.ico", - }, - "https://docs.godotengine.org/en/latest/": { - title: "Godot", - startUrl: "https://docs.godotengine.org/en/latest/", - rootUrl: "https://docs.godotengine.org/en/latest/", - faviconUrl: "https://godotengine.org/favicon.ico", - }, - "https://docs.amplify.aws/react/start/": { - title: "AWS Amplify (Gen 2)", - startUrl: "https://docs.amplify.aws/react/start/", - rootUrl: "https://docs.amplify.aws/react/", - faviconUrl: "https://docs.amplify.aws/favicon.ico", - }, - "https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/": { - title: "AWS SDK for JavaScript v3", - startUrl: "https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/", - rootUrl: "https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/", - faviconUrl: "https://docs.aws.amazon.com/favicon.ico", - }, - "https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html": { - title: "AWS CDK v2", - startUrl: - "https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html", - rootUrl: "https://docs.aws.amazon.com/cdk/api/v2/docs/", - faviconUrl: "https://docs.aws.amazon.com/cdk/api/v2/img/favicon-32x32.png", - }, - "https://awscli.amazonaws.com/v2/documentation/api/latest/index.html": { - title: "AWS CLI commands", - startUrl: - "https://awscli.amazonaws.com/v2/documentation/api/latest/index.html", - rootUrl: "https://awscli.amazonaws.com/v2/documentation/api/latest/", - faviconUrl: "https://docs.aws.amazon.com/favicon.ico", - }, - "https://llama-stack.readthedocs.io/": { - title: "Llama Stack", - startUrl: "https://llama-stack.readthedocs.io/", - rootUrl: "https://llama-stack.readthedocs.io/", - }, - "https://go.dev/doc": { - title: "Go", - startUrl: "https://go.dev/doc", - rootUrl: "https://go.dev", - faviconUrl: "https://go.dev/favicon.ico", - }, - "https://api.flutter.dev": { - title: "Flutter", - startUrl: "https://api.flutter.dev", - rootUrl: "https://api.flutter.dev", - faviconUrl: "https://api.flutter.dev/flutter/static-assets/favicon.png", - }, - "https://api.dart.dev": { - title: "Dart", - startUrl: "https://api.dart.dev", - rootUrl: "https://api.dart.dev", - faviconUrl: "https://api.dart.dev/static-assets/favicon.png", - }, - "https://docs.asksage.ai/": { - title: "Ask Sage", - startUrl: "https://docs.asksage.ai/", - rootUrl: "https://docs.asksage.ai/", - }, - "https://angular.dev/": { - title: "Angular", - startUrl: "https://angular.dev/", - rootUrl: "https://angular.dev/", - }, - "https://docs.djangoproject.com/": { - title: "Django", - startUrl: "https://docs.djangoproject.com/", - rootUrl: "https://docs.djangoproject.com/", - } -}; - -export default preIndexedDocs; diff --git a/docs/docs/customize/deep-dives/docs.mdx b/docs/docs/customize/deep-dives/docs.mdx index ee806263e..880d7516c 100644 --- a/docs/docs/customize/deep-dives/docs.mdx +++ b/docs/docs/customize/deep-dives/docs.mdx @@ -54,12 +54,6 @@ The `@Docs` context provider works by 3. Storing the embeddings locally on your machine 4. Embedding chat input to include similar documentation chunks as context -## Pre-indexed Documentation Sites - -In VS Code, Continue offers a selection of pre-indexed documentation sites for popular frameworks and libraries. You can view the list of [available pre-indexed sites and request additions here](https://github.com/continuedev/continue/blob/main/core/indexing/docs/preIndexedDocs.ts). - -Pre-indexed docs are only available in VS Code because the VS Code extension ships with the Transformers.js embedder built in, while Jetbrains currently does not. You can override a pre-indexed doc to index it with your own embeddings provider by adding it to your config (unique by `startUrl`). Otherwise, it will always use Transformers.js for queries. - ## Indexing Your Own Documentation ### Hub `docs` Blocks diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/docs.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/docs.md index e14ac4afc..151eb87e8 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/docs.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/docs.md @@ -31,12 +31,6 @@ toc_max_heading_level: 5 3. 本地保存嵌入在你的机器上 4. 通过 `@Docs` 上下文提供者提供访问索引内容 -## 预先索引文档网站 - -我们提供一个流行的框架和库的预先索引文档网站的选择。你可以 [在这里查看可用的预先索引网站和请求附加内容](https://github.com/continuedev/continue/blob/main/core/indexing/docs/preIndexedDocs.ts) 列表。 - -## 索引你自己的文档 - ### 通过 `@Docs` 上下文提供者 为了添加一个单独的文档网站,我们推荐使用 `@Docs` 上下文提供者。 diff --git a/gui/src/components/dialogs/AddDocsDialog.tsx b/gui/src/components/dialogs/AddDocsDialog.tsx index d421d94c4..d79c0a144 100644 --- a/gui/src/components/dialogs/AddDocsDialog.tsx +++ b/gui/src/components/dialogs/AddDocsDialog.tsx @@ -157,14 +157,9 @@ function AddDocsDialog() { {docsIndexingStatuses.length > 0 && ( <> -
-
- -

- Closing this dialog will not affect indexing progress -

-
-
+

+ Closing this dialog will not affect indexing progress +

)} diff --git a/gui/src/components/indexing/DocsDetailsDialog.tsx b/gui/src/components/indexing/DocsDetailsDialog.tsx index f8d0a54e9..d51ccb00f 100644 --- a/gui/src/components/indexing/DocsDetailsDialog.tsx +++ b/gui/src/components/indexing/DocsDetailsDialog.tsx @@ -1,37 +1,12 @@ -import { - CheckIcon, - InformationCircleIcon, - PencilIcon, - PlusIcon, -} from "@heroicons/react/24/outline"; -import { - DocsIndexingDetails, - IndexingStatus, - PackageDocsResult, - SiteIndexingConfig, -} from "core"; -import preIndexedDocs from "core/indexing/docs/preIndexedDocs"; +import { DocsIndexingDetails } from "core"; import { usePostHog } from "posthog-js/react"; -import { - useCallback, - useContext, - useEffect, - useLayoutEffect, - useMemo, - useRef, - useState, -} from "react"; +import { useCallback, useContext, useEffect, useState } from "react"; import { useDispatch } from "react-redux"; -import { Input, SecondaryButton } from ".."; +import { Tooltip } from "react-tooltip"; +import { SecondaryButton } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useAppSelector } from "../../redux/hooks"; -import { updateConfig } from "../../redux/slices/configSlice"; -import { updateIndexingStatus } from "../../redux/slices/indexingSlice"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; -import FileIcon from "../FileIcon"; -import { ToolTip } from "../gui/Tooltip"; -import DocsIndexingPeeks from "../indexing/DocsIndexingPeeks"; -import { Tooltip } from "react-tooltip"; interface DocsDetailsDialogProps { startUrl: string; @@ -89,7 +64,6 @@ function DocsDetailsDialog({ startUrl }: DocsDetailsDialogProps) { comp = (

{`Title: ${data.config.title}`}

-

{`Pre-indexed doc: ${data.isPreIndexedDoc}`}

{!data.chunks?.length ? (
No article chunks
) : ( diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 94324b75e..e8fe0b30e 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -226,7 +226,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { tr.delete(start, tr.selection.from).scrollIntoView(), ); }, - description: "Add a new documentation source", + description: "", }); } else if (subMenuTitle === ".prompt files") { items.push({ diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 9fe39d41e..49f6d44b2 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -25,7 +25,6 @@ import FreeTrialOverDialog from "../../components/dialogs/FreeTrialOverDialog"; import { ExploreHubCard } from "../../components/ExploreHubCard"; import { useFindWidget } from "../../components/find/FindWidget"; import TimelineItem from "../../components/gui/TimelineItem"; -import ChatIndexingPeeks from "../../components/indexing/ChatIndexingPeeks"; import ContinueInputBox from "../../components/mainInput/ContinueInputBox"; import { NewSessionButton } from "../../components/mainInput/NewSessionButton"; import resolveEditorContent from "../../components/mainInput/resolveInput"; @@ -554,11 +553,6 @@ export function Chat() {
-
- -
); }