feat(server): refactor copilot (#14892)

#### PR Dependency Tree


* **PR #14892** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
DarkSky
2026-05-04 00:36:47 +08:00
committed by GitHub
parent fa8f1a096c
commit d64f368623
239 changed files with 35859 additions and 16777 deletions
@@ -7,19 +7,16 @@ import {
clearEmbeddingChunk,
type Models,
} from '../../../models';
import { CopilotContextService } from '../context/service';
import { workspaceSyncRequiredError } from './doc-sync';
import { toolError } from './error';
import { defineTool } from './tool';
import type {
ContextSession,
CopilotChatOptions,
CopilotContextService,
} from './types';
import type { CopilotChatOptions } from './types';
export const buildDocSearchGetter = (
ac: AccessController,
context: CopilotContextService,
docContext: ContextSession | null,
sessionId: string | undefined,
models: Models
) => {
const searchDocs = async (
@@ -48,7 +45,11 @@ export const buildDocSearchGetter = (
);
const [chunks, contextChunks] = await Promise.all([
context.matchWorkspaceAll(options.workspace, query, 10, signal),
docContext?.matchFiles(query, 10, signal) ?? [],
sessionId
? context
.getBySessionId(sessionId)
.then(current => current?.matchFiles(query, 10, signal) ?? [])
: [],
]);
const docChunks = await ac