feat(server): update gql endpoint & workspace doc match test (#11104)

This commit is contained in:
darkskygit
2025-03-25 10:09:22 +00:00
parent bf4107feac
commit 1bb324eeed
20 changed files with 355 additions and 139 deletions

View File

@@ -0,0 +1,20 @@
query matchContext($contextId: String!, $content: String!, $limit: SafeInt, $threshold: Float) {
currentUser {
copilot {
contexts(contextId: $contextId) {
matchFiles(content: $content, limit: $limit, threshold: $threshold) {
fileId
chunk
content
distance
}
matchWorkspaceDocs(content: $content, limit: $limit, threshold: $threshold) {
docId
chunk
content
distance
}
}
}
}
}

View File

@@ -1,8 +1,8 @@
query matchWorkspaceContext($contextId: String!, $content: String!, $limit: SafeInt) {
query matchWorkspaceDocs($contextId: String!, $content: String!, $limit: SafeInt) {
currentUser {
copilot {
contexts(contextId: $contextId) {
matchWorkspaceContext(content: $content, limit: $limit) {
matchWorkspaceDocs(content: $content, limit: $limit) {
docId
chunk
content

View File

@@ -1,8 +1,8 @@
query matchContext($contextId: String!, $content: String!, $limit: SafeInt) {
query matchFiles($contextId: String!, $content: String!, $limit: SafeInt) {
currentUser {
copilot {
contexts(contextId: $contextId) {
matchContext(content: $content, limit: $limit) {
matchFiles(content: $content, limit: $limit) {
fileId
chunk
content

View File

@@ -205,25 +205,6 @@ export const addContextFileMutation = {
file: true,
};
export const matchContextQuery = {
id: 'matchContextQuery' as const,
op: 'matchContext',
query: `query matchContext($contextId: String!, $content: String!, $limit: SafeInt) {
currentUser {
copilot {
contexts(contextId: $contextId) {
matchContext(content: $content, limit: $limit) {
fileId
chunk
content
distance
}
}
}
}
}`,
};
export const removeContextFileMutation = {
id: 'removeContextFileMutation' as const,
op: 'removeContextFile',
@@ -295,14 +276,20 @@ export const listContextQuery = {
}`,
};
export const matchWorkspaceContextQuery = {
id: 'matchWorkspaceContextQuery' as const,
op: 'matchWorkspaceContext',
query: `query matchWorkspaceContext($contextId: String!, $content: String!, $limit: SafeInt) {
export const matchContextQuery = {
id: 'matchContextQuery' as const,
op: 'matchContext',
query: `query matchContext($contextId: String!, $content: String!, $limit: SafeInt, $threshold: Float) {
currentUser {
copilot {
contexts(contextId: $contextId) {
matchWorkspaceContext(content: $content, limit: $limit) {
matchFiles(content: $content, limit: $limit, threshold: $threshold) {
fileId
chunk
content
distance
}
matchWorkspaceDocs(content: $content, limit: $limit, threshold: $threshold) {
docId
chunk
content
@@ -314,6 +301,44 @@ export const matchWorkspaceContextQuery = {
}`,
};
export const matchWorkspaceDocsQuery = {
id: 'matchWorkspaceDocsQuery' as const,
op: 'matchWorkspaceDocs',
query: `query matchWorkspaceDocs($contextId: String!, $content: String!, $limit: SafeInt) {
currentUser {
copilot {
contexts(contextId: $contextId) {
matchWorkspaceDocs(content: $content, limit: $limit) {
docId
chunk
content
distance
}
}
}
}
}`,
};
export const matchFilesQuery = {
id: 'matchFilesQuery' as const,
op: 'matchFiles',
query: `query matchFiles($contextId: String!, $content: String!, $limit: SafeInt) {
currentUser {
copilot {
contexts(contextId: $contextId) {
matchFiles(content: $content, limit: $limit) {
fileId
chunk
content
distance
}
}
}
}
}`,
};
export const getWorkspaceEmbeddingStatusQuery = {
id: 'getWorkspaceEmbeddingStatusQuery' as const,
op: 'getWorkspaceEmbeddingStatus',

View File

@@ -172,24 +172,25 @@ export interface CopilotContext {
/** list files in context */
files: Array<CopilotContextFile>;
id: Scalars['ID']['output'];
/** match file context */
matchContext: Array<ContextMatchedFileChunk>;
/** match workspace doc content */
matchWorkspaceContext: ContextMatchedDocChunk;
/** match file in context */
matchFiles: Array<ContextMatchedFileChunk>;
/** match workspace docs */
matchWorkspaceDocs: Array<ContextMatchedDocChunk>;
/** list tags in context */
tags: Array<CopilotContextCategory>;
workspaceId: Scalars['String']['output'];
}
export interface CopilotContextMatchContextArgs {
export interface CopilotContextMatchFilesArgs {
content: Scalars['String']['input'];
limit?: InputMaybe<Scalars['SafeInt']['input']>;
threshold?: InputMaybe<Scalars['Float']['input']>;
}
export interface CopilotContextMatchWorkspaceContextArgs {
export interface CopilotContextMatchWorkspaceDocsArgs {
content: Scalars['String']['input'];
limit?: InputMaybe<Scalars['SafeInt']['input']>;
threshold?: InputMaybe<Scalars['Float']['input']>;
}
export interface CopilotContextCategory {
@@ -2562,32 +2563,6 @@ export type AddContextFileMutation = {
};
};
export type MatchContextQueryVariables = Exact<{
contextId: Scalars['String']['input'];
content: Scalars['String']['input'];
limit?: InputMaybe<Scalars['SafeInt']['input']>;
}>;
export type MatchContextQuery = {
__typename?: 'Query';
currentUser: {
__typename?: 'UserType';
copilot: {
__typename?: 'Copilot';
contexts: Array<{
__typename?: 'CopilotContext';
matchContext: Array<{
__typename?: 'ContextMatchedFileChunk';
fileId: string;
chunk: number;
content: string;
distance: number | null;
}>;
}>;
};
} | null;
};
export type RemoveContextFileMutationVariables = Exact<{
options: RemoveContextFileInput;
}>;
@@ -2677,13 +2652,14 @@ export type ListContextQuery = {
} | null;
};
export type MatchWorkspaceContextQueryVariables = Exact<{
export type MatchContextQueryVariables = Exact<{
contextId: Scalars['String']['input'];
content: Scalars['String']['input'];
limit?: InputMaybe<Scalars['SafeInt']['input']>;
threshold?: InputMaybe<Scalars['Float']['input']>;
}>;
export type MatchWorkspaceContextQuery = {
export type MatchContextQuery = {
__typename?: 'Query';
currentUser: {
__typename?: 'UserType';
@@ -2691,13 +2667,72 @@ export type MatchWorkspaceContextQuery = {
__typename?: 'Copilot';
contexts: Array<{
__typename?: 'CopilotContext';
matchWorkspaceContext: {
matchFiles: Array<{
__typename?: 'ContextMatchedFileChunk';
fileId: string;
chunk: number;
content: string;
distance: number | null;
}>;
matchWorkspaceDocs: Array<{
__typename?: 'ContextMatchedDocChunk';
docId: string;
chunk: number;
content: string;
distance: number | null;
};
}>;
}>;
};
} | null;
};
export type MatchWorkspaceDocsQueryVariables = Exact<{
contextId: Scalars['String']['input'];
content: Scalars['String']['input'];
limit?: InputMaybe<Scalars['SafeInt']['input']>;
}>;
export type MatchWorkspaceDocsQuery = {
__typename?: 'Query';
currentUser: {
__typename?: 'UserType';
copilot: {
__typename?: 'Copilot';
contexts: Array<{
__typename?: 'CopilotContext';
matchWorkspaceDocs: Array<{
__typename?: 'ContextMatchedDocChunk';
docId: string;
chunk: number;
content: string;
distance: number | null;
}>;
}>;
};
} | null;
};
export type MatchFilesQueryVariables = Exact<{
contextId: Scalars['String']['input'];
content: Scalars['String']['input'];
limit?: InputMaybe<Scalars['SafeInt']['input']>;
}>;
export type MatchFilesQuery = {
__typename?: 'Query';
currentUser: {
__typename?: 'UserType';
copilot: {
__typename?: 'Copilot';
contexts: Array<{
__typename?: 'CopilotContext';
matchFiles: Array<{
__typename?: 'ContextMatchedFileChunk';
fileId: string;
chunk: number;
content: string;
distance: number | null;
}>;
}>;
};
} | null;
@@ -4315,11 +4350,6 @@ export type Queries =
variables: ListBlobsQueryVariables;
response: ListBlobsQuery;
}
| {
name: 'matchContextQuery';
variables: MatchContextQueryVariables;
response: MatchContextQuery;
}
| {
name: 'listContextObjectQuery';
variables: ListContextObjectQueryVariables;
@@ -4331,9 +4361,19 @@ export type Queries =
response: ListContextQuery;
}
| {
name: 'matchWorkspaceContextQuery';
variables: MatchWorkspaceContextQueryVariables;
response: MatchWorkspaceContextQuery;
name: 'matchContextQuery';
variables: MatchContextQueryVariables;
response: MatchContextQuery;
}
| {
name: 'matchWorkspaceDocsQuery';
variables: MatchWorkspaceDocsQueryVariables;
response: MatchWorkspaceDocsQuery;
}
| {
name: 'matchFilesQuery';
variables: MatchFilesQueryVariables;
response: MatchFilesQuery;
}
| {
name: 'getWorkspaceEmbeddingStatusQuery';