mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
feat(server): update gql endpoint & workspace doc match test (#11104)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
ChatHistoryOrder,
|
||||
ContextMatchedDocChunk,
|
||||
ContextMatchedFileChunk,
|
||||
CopilotContextCategory,
|
||||
CopilotContextDoc,
|
||||
@@ -312,7 +313,10 @@ declare global {
|
||||
contextId: string,
|
||||
content: string,
|
||||
limit?: number
|
||||
) => Promise<ContextMatchedFileChunk[] | undefined>;
|
||||
) => Promise<{
|
||||
files?: ContextMatchedFileChunk[];
|
||||
docs?: ContextMatchedDocChunk[];
|
||||
}>;
|
||||
}
|
||||
|
||||
// TODO(@Peng): should be refactored to get rid of implement details (like messages, action, role, etc.)
|
||||
|
||||
@@ -556,9 +556,12 @@ export class ChatPanelInput extends SignalWatcher(WithDisposable(LitElement)) {
|
||||
|
||||
private async _getMatchedContexts(userInput: string) {
|
||||
const contextId = await this.getContextId();
|
||||
const matched = contextId
|
||||
? (await AIProvider.context?.matchContext(contextId, userInput)) || []
|
||||
: [];
|
||||
// TODO(@akumatus): adapt workspace docs
|
||||
const { files: matched = [] } =
|
||||
(contextId &&
|
||||
(await AIProvider.context?.matchContext(contextId, userInput))) ||
|
||||
{};
|
||||
|
||||
const contexts = this.chatContextValue.chips.reduce(
|
||||
(acc, chip, index) => {
|
||||
if (chip.state !== 'finished') {
|
||||
|
||||
@@ -341,7 +341,9 @@ export class CopilotClient {
|
||||
limit,
|
||||
},
|
||||
});
|
||||
return res.currentUser?.copilot?.contexts?.[0]?.matchContext;
|
||||
const { matchFiles: files, matchWorkspaceDocs: docs } =
|
||||
res.currentUser?.copilot?.contexts?.[0] || {};
|
||||
return { files, docs };
|
||||
}
|
||||
|
||||
async chatText({
|
||||
|
||||
Reference in New Issue
Block a user