remove rootUrl, update config schema

This commit is contained in:
Dallin Romney 2025-01-15 23:22:20 -08:00
parent f968bbab6f
commit b6bbc5169f
11 changed files with 70 additions and 42 deletions

View file

@ -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;

4
core/index.d.ts vendored
View file

@ -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 {

View file

@ -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,

View file

@ -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) {

View file

@ -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.
<!-- - `rootUrl`: (Optional) The base URL of the documentation site, used to determine which pages to index. -->
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
}
],

View file

@ -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`
<!-- - `rootUrl`: Crawler will only index docs within this domain - pages that contain this URL -->
- `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",
}
]

View file

@ -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
<!-- - `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:

View file

@ -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 ,用来确定哪个页面索引。
<!-- - `rootUrl`: 文档网站的基本 URL ,用来确定哪个页面索引。 -->
- `faviconUrl`: 网站 favicon 的 URL ,用来在 UI 中进行视觉识别。
## 使用 `useChromiumForDocsCrawling` 爬取动态生成的网站

View file

@ -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`
<!-- - `rootUrl`: Crawler will only index docs within this domain - pages that contain this URL -->
- `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",
}
]

View file

@ -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"]

View file

@ -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<typeof devDataSchema>;
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({