mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user