mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 10:52:40 +08:00
chore(server): merge duplicate queries (#10857)
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
|||||||
getCopilotHistoryIdsQuery,
|
getCopilotHistoryIdsQuery,
|
||||||
getCopilotSessionsQuery,
|
getCopilotSessionsQuery,
|
||||||
type GraphQLQuery,
|
type GraphQLQuery,
|
||||||
listContextDocsAndFilesQuery,
|
listContextObjectQuery,
|
||||||
listContextQuery,
|
listContextQuery,
|
||||||
matchContextQuery,
|
matchContextQuery,
|
||||||
type QueryOptions,
|
type QueryOptions,
|
||||||
@@ -295,7 +295,7 @@ export class CopilotClient {
|
|||||||
contextId: string
|
contextId: string
|
||||||
) {
|
) {
|
||||||
const res = await this.gql({
|
const res = await this.gql({
|
||||||
query: listContextDocsAndFilesQuery,
|
query: listContextObjectQuery,
|
||||||
variables: {
|
variables: {
|
||||||
workspaceId,
|
workspaceId,
|
||||||
sessionId,
|
sessionId,
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
query listContextDocsAndFiles($workspaceId: String!, $sessionId: String!, $contextId: String!) {
|
|
||||||
currentUser {
|
|
||||||
copilot(workspaceId: $workspaceId) {
|
|
||||||
contexts(sessionId: $sessionId, contextId: $contextId) {
|
|
||||||
docs {
|
|
||||||
id
|
|
||||||
status
|
|
||||||
createdAt
|
|
||||||
}
|
|
||||||
files {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
blobId
|
|
||||||
chunkSize
|
|
||||||
error
|
|
||||||
status
|
|
||||||
createdAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
query listContextFiles(
|
query listContextObject(
|
||||||
$workspaceId: String!
|
$workspaceId: String!
|
||||||
$sessionId: String!
|
$sessionId: String!
|
||||||
$contextId: String!
|
$contextId: String!
|
||||||
@@ -8,6 +8,7 @@ query listContextFiles(
|
|||||||
contexts(sessionId: $sessionId, contextId: $contextId) {
|
contexts(sessionId: $sessionId, contextId: $contextId) {
|
||||||
docs {
|
docs {
|
||||||
id
|
id
|
||||||
|
status
|
||||||
createdAt
|
createdAt
|
||||||
}
|
}
|
||||||
files {
|
files {
|
||||||
@@ -179,32 +179,6 @@ export const addContextFileMutation = {
|
|||||||
file: true,
|
file: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listContextFilesQuery = {
|
|
||||||
id: 'listContextFilesQuery' as const,
|
|
||||||
op: 'listContextFiles',
|
|
||||||
query: `query listContextFiles($workspaceId: String!, $sessionId: String!, $contextId: String!) {
|
|
||||||
currentUser {
|
|
||||||
copilot(workspaceId: $workspaceId) {
|
|
||||||
contexts(sessionId: $sessionId, contextId: $contextId) {
|
|
||||||
docs {
|
|
||||||
id
|
|
||||||
createdAt
|
|
||||||
}
|
|
||||||
files {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
blobId
|
|
||||||
chunkSize
|
|
||||||
error
|
|
||||||
status
|
|
||||||
createdAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const matchContextQuery = {
|
export const matchContextQuery = {
|
||||||
id: 'matchContextQuery' as const,
|
id: 'matchContextQuery' as const,
|
||||||
op: 'matchContext',
|
op: 'matchContext',
|
||||||
@@ -232,10 +206,10 @@ export const removeContextFileMutation = {
|
|||||||
}`,
|
}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listContextDocsAndFilesQuery = {
|
export const listContextObjectQuery = {
|
||||||
id: 'listContextDocsAndFilesQuery' as const,
|
id: 'listContextObjectQuery' as const,
|
||||||
op: 'listContextDocsAndFiles',
|
op: 'listContextObject',
|
||||||
query: `query listContextDocsAndFiles($workspaceId: String!, $sessionId: String!, $contextId: String!) {
|
query: `query listContextObject($workspaceId: String!, $sessionId: String!, $contextId: String!) {
|
||||||
currentUser {
|
currentUser {
|
||||||
copilot(workspaceId: $workspaceId) {
|
copilot(workspaceId: $workspaceId) {
|
||||||
contexts(sessionId: $sessionId, contextId: $contextId) {
|
contexts(sessionId: $sessionId, contextId: $contextId) {
|
||||||
|
|||||||
@@ -2363,40 +2363,6 @@ export type AddContextFileMutation = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ListContextFilesQueryVariables = Exact<{
|
|
||||||
workspaceId: Scalars['String']['input'];
|
|
||||||
sessionId: Scalars['String']['input'];
|
|
||||||
contextId: Scalars['String']['input'];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
export type ListContextFilesQuery = {
|
|
||||||
__typename?: 'Query';
|
|
||||||
currentUser: {
|
|
||||||
__typename?: 'UserType';
|
|
||||||
copilot: {
|
|
||||||
__typename?: 'Copilot';
|
|
||||||
contexts: Array<{
|
|
||||||
__typename?: 'CopilotContext';
|
|
||||||
docs: Array<{
|
|
||||||
__typename?: 'CopilotContextDoc';
|
|
||||||
id: string;
|
|
||||||
createdAt: number;
|
|
||||||
}>;
|
|
||||||
files: Array<{
|
|
||||||
__typename?: 'CopilotContextFile';
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
blobId: string;
|
|
||||||
chunkSize: number;
|
|
||||||
error: string | null;
|
|
||||||
status: ContextEmbedStatus;
|
|
||||||
createdAt: number;
|
|
||||||
}>;
|
|
||||||
}>;
|
|
||||||
};
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type MatchContextQueryVariables = Exact<{
|
export type MatchContextQueryVariables = Exact<{
|
||||||
contextId: Scalars['String']['input'];
|
contextId: Scalars['String']['input'];
|
||||||
content: Scalars['String']['input'];
|
content: Scalars['String']['input'];
|
||||||
@@ -2432,13 +2398,13 @@ export type RemoveContextFileMutation = {
|
|||||||
removeContextFile: boolean;
|
removeContextFile: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ListContextDocsAndFilesQueryVariables = Exact<{
|
export type ListContextObjectQueryVariables = Exact<{
|
||||||
workspaceId: Scalars['String']['input'];
|
workspaceId: Scalars['String']['input'];
|
||||||
sessionId: Scalars['String']['input'];
|
sessionId: Scalars['String']['input'];
|
||||||
contextId: Scalars['String']['input'];
|
contextId: Scalars['String']['input'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type ListContextDocsAndFilesQuery = {
|
export type ListContextObjectQuery = {
|
||||||
__typename?: 'Query';
|
__typename?: 'Query';
|
||||||
currentUser: {
|
currentUser: {
|
||||||
__typename?: 'UserType';
|
__typename?: 'UserType';
|
||||||
@@ -4028,20 +3994,15 @@ export type Queries =
|
|||||||
variables: ListBlobsQueryVariables;
|
variables: ListBlobsQueryVariables;
|
||||||
response: ListBlobsQuery;
|
response: ListBlobsQuery;
|
||||||
}
|
}
|
||||||
| {
|
|
||||||
name: 'listContextFilesQuery';
|
|
||||||
variables: ListContextFilesQueryVariables;
|
|
||||||
response: ListContextFilesQuery;
|
|
||||||
}
|
|
||||||
| {
|
| {
|
||||||
name: 'matchContextQuery';
|
name: 'matchContextQuery';
|
||||||
variables: MatchContextQueryVariables;
|
variables: MatchContextQueryVariables;
|
||||||
response: MatchContextQuery;
|
response: MatchContextQuery;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
name: 'listContextDocsAndFilesQuery';
|
name: 'listContextObjectQuery';
|
||||||
variables: ListContextDocsAndFilesQueryVariables;
|
variables: ListContextObjectQueryVariables;
|
||||||
response: ListContextDocsAndFilesQuery;
|
response: ListContextObjectQuery;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
name: 'listContextQuery';
|
name: 'listContextQuery';
|
||||||
|
|||||||
Reference in New Issue
Block a user