diff --git a/core/config/types.ts b/core/config/types.ts index aa1873894..e5797bdb7 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -220,18 +220,10 @@ declare global { export interface SiteIndexingConfig { title: string; startUrl: string; - rootUrl?: string; maxDepth?: number; faviconUrl?: string; } - export interface SiteIndexingConfig { - startUrl: string; - rootUrl?: string; - title: string; - maxDepth?: number; - } - export interface IContextProvider { get description(): ContextProviderDescription; diff --git a/core/index.d.ts b/core/index.d.ts index 1f47aa351..211325e23 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -223,10 +223,10 @@ export interface ContextSubmenuItemWithProvider extends ContextSubmenuItem { export interface SiteIndexingConfig { title: string; startUrl: string; - rootUrl?: string; maxDepth?: number; faviconUrl?: string; - useLocalIndexing?: boolean; + useLocalCrawling?: boolean; + rootUrl?: string; // Currently only used by preindexed docs } export interface IContextProvider { diff --git a/core/indexing/docs/DocsCrawler.ts b/core/indexing/docs/DocsCrawler.ts index 5ae3ffa90..31c117620 100644 --- a/core/indexing/docs/DocsCrawler.ts +++ b/core/indexing/docs/DocsCrawler.ts @@ -22,9 +22,9 @@ class DocsCrawler { constructor( private readonly ide: IDE, private readonly config: ContinueConfig, - private readonly maxDepth: number = 5, + private readonly maxDepth: number = 4, private readonly maxRequestsPerCrawl: number = 1000, - private readonly useLocalIndexing: boolean = false, + private readonly useLocalCrawling: boolean = false, ) { this.chromiumInstaller = new ChromiumInstaller(this.ide, this.config); } @@ -51,7 +51,7 @@ class DocsCrawler { return "github"; } - if (!this.useLocalIndexing) { + if (!this.useLocalCrawling) { try { const pageData = await new DefaultCrawler( startUrl, diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 0dfab27c5..5fa93cc0a 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -362,7 +362,7 @@ export default class DocsService { console.warn("Attempting to add/index docs when indexing is disabled"); return; } - const { startUrl, useLocalIndexing, maxDepth } = siteIndexingConfig; + const { startUrl, useLocalCrawling, maxDepth } = siteIndexingConfig; const canUsePreindexedDocs = await this.canUsePreindexedDocs(); if (canUsePreindexedDocs) { @@ -436,7 +436,7 @@ export default class DocsService { this.config, maxDepth, undefined, - useLocalIndexing, + useLocalCrawling, ); for await (const page of docsCrawler.crawl(new URL(startUrl))) { estimatedProgress += 1 / 2 ** (processedPages + 1); @@ -989,9 +989,9 @@ export default class DocsService { (doc) => doc.startUrl === siteIndexingConfig.startUrl && doc.faviconUrl === siteIndexingConfig.faviconUrl && - siteIndexingConfig.title === doc.title, - // siteIndexingConfig.maxDepth === doc.maxDepth && - // doc.rootUrl === siteIndexingConfig.rootUrl, + siteIndexingConfig.title === doc.title && + siteIndexingConfig.maxDepth === doc.maxDepth && + siteIndexingConfig.useLocalCrawling === doc.useLocalCrawling, ); if (!doesEquivalentDocExist) { diff --git a/docs/docs/customize/deep-dives/docs.md b/docs/docs/customize/deep-dives/docs.md index c2dbf5b9b..31cd8b4b8 100644 --- a/docs/docs/customize/deep-dives/docs.md +++ b/docs/docs/customize/deep-dives/docs.md @@ -88,11 +88,7 @@ For bulk documentation site adds or edits, we recommend editing your global conf } ``` -- `title`: The name of the documentation site, used for identification in the UI. -- `startUrl`: The URL where the indexing process should begin. -- `faviconUrl`: Optional. The URL of the site's favicon, used for visual identification in the UI. -- `useLocalCrawling`: Optional. Skip the default indexer and attempt local crawling for this documentation site. - +See [the config reference](../../reference) for all documentation site configuration options. Indexing will re-sync upon saving the configuration file. @@ -260,6 +256,7 @@ The following configuration example includes: "title": "My Private Docs", "startUrl": "http://10.2.1.2/docs", "faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico", + "maxDepth": 4, "useLocalCrawling": true } ], diff --git a/docs/docs/reference.md b/docs/docs/reference.md index 814f6e4af..d3c491f4c 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -234,9 +234,10 @@ List of documentation sites to index. - `title` (**required**): Title of the documentation site, displayed in dropdowns, etc. - `startUrl` (**required**): Start page for crawling - usually root or intro page for docs -- `rootUrl`: Crawler will only index docs within this domain - pages that contain this URL -- `maxDepth`: Maximum depth for crawling. Default `3` + +- `maxDepth`: Maximum link depth for crawling. Default `4` - `favicon`: URL for site favicon (default is `/favicon.ico` from `startUrl`). +- `useLocalCrawling`: Skip the default crawler and only crawl using a local crawler. Example @@ -245,7 +246,6 @@ Example { "title": "Continue", "startUrl": "https://docs.continue.dev/intro", - "rootUrl": "https://docs.continue.dev", "faviconUrl": "https://docs.continue.dev/favicon.ico", } ] diff --git a/docs/docs/yaml-reference.md b/docs/docs/yaml-reference.md index bcf8a7504..84d1f8ac9 100644 --- a/docs/docs/yaml-reference.md +++ b/docs/docs/yaml-reference.md @@ -161,8 +161,10 @@ List of documentation sites to index. - `name` (**required**): Name of the documentation site, displayed in dropdowns, etc. - `startUrl` (**required**): Start page for crawling - usually root or intro page for docs -- `rootUrl`: Crawler will only index docs within this domain - pages that contain this URL + - `favicon`: URL for site favicon (default is `/favicon.ico` from `startUrl`). +- `maxDepth`: M +- `useLocalCrawling`: Force use of local crawling Example @@ -170,7 +172,6 @@ Example docs: - name: Continue startUrl: https://docs.continue.dev/intro - rootUrl: https://docs.continue.dev favicon: https://docs.continue.dev/favicon.ico ``` @@ -276,7 +277,6 @@ context: - uses: docs with: startUrl: https://docs.example.com/introduction - rootUrl: https://docs.example.com maxDepth: 3 tools: 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 79862b38f..e14ac4afc 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 @@ -58,7 +58,6 @@ toc_max_heading_level: 5 { "title": "Continue", "startUrl": "https://docs.continue.dev/intro", - "rootUrl": "https://docs.continue.dev", "faviconUrl": "https://docs.continue.dev/favicon.ico", } ] @@ -66,7 +65,7 @@ toc_max_heading_level: 5 - `title`: 文档网站的名称,用来在 UI 中进行识别。 - `startUrl`: 索引进程开始的 URL 。 -- `rootUrl`: 文档网站的基本 URL ,用来确定哪个页面索引。 + - `faviconUrl`: 网站 favicon 的 URL ,用来在 UI 中进行视觉识别。 ## 使用 `useChromiumForDocsCrawling` 爬取动态生成的网站 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md index a224cf8a8..0eeacafec 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md @@ -233,8 +233,8 @@ List of documentation sites to index. - `title` (**required**): Title of the documentation site, displayed in dropdowns, etc. - `startUrl` (**required**): Start page for crawling - usually root or intro page for docs -- `rootUrl`: Crawler will only index docs within this domain - pages that contain this URL -- `maxDepth`: Maximum depth for crawling. Default `3` + +- `maxDepth`: Maximum link depth for crawling. Default `4` - `favicon`: URL for site favicon (default is `/favicon.ico` from `startUrl`). Example @@ -244,7 +244,6 @@ Example { "title": "Continue", "startUrl": "https://docs.continue.dev/intro", - "rootUrl": "https://docs.continue.dev", "faviconUrl": "https://docs.continue.dev/favicon.ico", } ] diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index cf9265e67..1273a7c40 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -2389,7 +2389,7 @@ "if": { "properties": { "name": { - "enum": ["codebase", "folder", "docs"] + "enum": ["codebase", "folder"] } } }, @@ -2420,6 +2420,46 @@ } } }, + { + "if": { + "properties": { + "name": { + "enum": ["docs"] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "nRetrieve": { + "title": "N Retrieve", + "description": "Number of docs results to initially retrieve from vector database", + "default": 50, + "type": "integer" + }, + "nFinal": { + "title": "N Final", + "description": "Final number of docs results to include after re-ranking", + "default": 10, + "type": "integer" + }, + "useReranking": { + "title": "Use Reranking", + "description": "Whether to use re-ranking, which will allow initial selection of nRetrieve results, then will use an LLM to select the top nFinal results. Disabling re-ranking will give faster, but less accurate, results.", + "default": true, + "type": "boolean" + }, + "githubToken": { + "type": "string", + "title": "Github Token", + "description": "Include to crawl Github repositories for documentation" + } + } + } + } + } + }, { "if": { "properties": { @@ -2563,17 +2603,17 @@ "type": "string", "description": "The starting URL for indexing the documentation" }, - "rootUrl": { - "type": "string", - "description": "The root URL of the documentation site" - }, "maxDepth": { "type": "integer", - "description": "The maximum depth to crawl the documentation site" + "description": "The maximum link depth when crawling the documentation site" }, "faviconUrl": { "type": "string", "description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL" + }, + "useLocalCrawling": { + "type": "boolean", + "description": "Only use local crawling for this documentation site" } }, "required": ["title", "startUrl"] diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index 5331140b6..5ba03b8cc 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -57,7 +57,7 @@ export const modelDescriptionSchema = z.object({ "azure", "continue-proxy", "nebius", - "scaleway" + "scaleway", ]), model: z.string(), apiKey: z.string().optional(), @@ -202,10 +202,11 @@ export type DevData = z.infer; export const siteIndexingConfigSchema = z.object({ startUrl: z.string(), - rootUrl: z.string(), + // rootUrl: z.string(), title: z.string(), maxDepth: z.string().optional(), faviconUrl: z.string().optional(), + useLocalCrawling: z.boolean().optional(), }); export const controlPlaneConfigSchema = z.object({