feat(server): adapt context model (#11028)

expose more field in listContextObject
This commit is contained in:
darkskygit
2025-03-21 05:36:45 +00:00
parent a5b975ac46
commit 5acba9d5a0
25 changed files with 537 additions and 377 deletions

View File

@@ -1,7 +1,12 @@
mutation addContextCategory($options: AddRemoveContextCategoryInput!) {
mutation addContextCategory($options: AddContextCategoryInput!) {
addContextCategory(options: $options) {
id
createdAt
type
docs {
id
createdAt
status
}
}
}

View File

@@ -1,3 +1,3 @@
mutation removeContextCategory($options: AddRemoveContextCategoryInput!) {
mutation removeContextCategory($options: RemoveContextCategoryInput!) {
removeContextCategory(options: $options)
}

View File

@@ -3,5 +3,6 @@ mutation addContextDoc($options: AddContextDocInput!) {
id
createdAt
status
error
}
}

View File

@@ -9,6 +9,7 @@ query listContextObject(
docs {
id
status
error
createdAt
}
files {
@@ -20,6 +21,22 @@ query listContextObject(
status
createdAt
}
tags {
id
docs {
id
status
}
createdAt
}
collections {
id
docs {
id
status
}
createdAt
}
}
}
}

View File

@@ -137,11 +137,16 @@ export const changePasswordMutation = {
export const addContextCategoryMutation = {
id: 'addContextCategoryMutation' as const,
op: 'addContextCategory',
query: `mutation addContextCategory($options: AddRemoveContextCategoryInput!) {
query: `mutation addContextCategory($options: AddContextCategoryInput!) {
addContextCategory(options: $options) {
id
createdAt
type
docs {
id
createdAt
status
}
}
}`,
};
@@ -149,7 +154,7 @@ export const addContextCategoryMutation = {
export const removeContextCategoryMutation = {
id: 'removeContextCategoryMutation' as const,
op: 'removeContextCategory',
query: `mutation removeContextCategory($options: AddRemoveContextCategoryInput!) {
query: `mutation removeContextCategory($options: RemoveContextCategoryInput!) {
removeContextCategory(options: $options)
}`,
};
@@ -170,6 +175,7 @@ export const addContextDocMutation = {
id
createdAt
status
error
}
}`,
};
@@ -236,6 +242,7 @@ export const listContextObjectQuery = {
docs {
id
status
error
createdAt
}
files {
@@ -247,6 +254,22 @@ export const listContextObjectQuery = {
status
createdAt
}
tags {
id
docs {
id
status
}
createdAt
}
collections {
id
docs {
id
status
}
createdAt
}
}
}
}

View File

@@ -37,6 +37,13 @@ export interface Scalars {
Upload: { input: File; output: File };
}
export interface AddContextCategoryInput {
categoryId: Scalars['String']['input'];
contextId: Scalars['String']['input'];
docs?: InputMaybe<Array<Scalars['String']['input']>>;
type: ContextCategories;
}
export interface AddContextDocInput {
contextId: Scalars['String']['input'];
docId: Scalars['String']['input'];
@@ -47,12 +54,6 @@ export interface AddContextFileInput {
contextId: Scalars['String']['input'];
}
export interface AddRemoveContextCategoryInput {
categoryId: Scalars['String']['input'];
contextId: Scalars['String']['input'];
type: ContextCategories;
}
export enum AiJobStatus {
claimed = 'claimed',
failed = 'failed',
@@ -164,6 +165,8 @@ export interface CopilotSessionsArgs {
export interface CopilotContext {
__typename?: 'CopilotContext';
/** list collections in context */
collections: Array<CopilotContextCategory>;
/** list files in context */
docs: Array<CopilotContextDoc>;
/** list files in context */
@@ -173,6 +176,8 @@ export interface CopilotContext {
matchContext: Array<ContextMatchedFileChunk>;
/** match workspace doc content */
matchWorkspaceContext: ContextMatchedDocChunk;
/** list tags in context */
tags: Array<CopilotContextCategory>;
workspaceId: Scalars['String']['output'];
}
@@ -190,6 +195,7 @@ export interface CopilotContextMatchWorkspaceContextArgs {
export interface CopilotContextCategory {
__typename?: 'CopilotContextCategory';
createdAt: Scalars['SafeInt']['output'];
docs: Array<CopilotDocType>;
id: Scalars['ID']['output'];
type: ContextCategories;
}
@@ -197,6 +203,7 @@ export interface CopilotContextCategory {
export interface CopilotContextDoc {
__typename?: 'CopilotContextDoc';
createdAt: Scalars['SafeInt']['output'];
error: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
status: Maybe<ContextEmbedStatus>;
}
@@ -223,6 +230,13 @@ export interface CopilotDocNotFoundDataType {
docId: Scalars['String']['output'];
}
export interface CopilotDocType {
__typename?: 'CopilotDocType';
createdAt: Scalars['SafeInt']['output'];
id: Scalars['ID']['output'];
status: Maybe<ContextEmbedStatus>;
}
export interface CopilotFailedToMatchContextDataType {
__typename?: 'CopilotFailedToMatchContextDataType';
content: Scalars['String']['output'];
@@ -549,6 +563,7 @@ export enum ErrorNames {
CAPTCHA_VERIFICATION_FAILED = 'CAPTCHA_VERIFICATION_FAILED',
COPILOT_ACTION_TAKEN = 'COPILOT_ACTION_TAKEN',
COPILOT_CONTEXT_FILE_NOT_SUPPORTED = 'COPILOT_CONTEXT_FILE_NOT_SUPPORTED',
COPILOT_DOCS_NOT_FOUND = 'COPILOT_DOCS_NOT_FOUND',
COPILOT_DOC_NOT_FOUND = 'COPILOT_DOC_NOT_FOUND',
COPILOT_EMBEDDING_UNAVAILABLE = 'COPILOT_EMBEDDING_UNAVAILABLE',
COPILOT_FAILED_TO_CREATE_MESSAGE = 'COPILOT_FAILED_TO_CREATE_MESSAGE',
@@ -1103,7 +1118,7 @@ export interface MutationActivateLicenseArgs {
}
export interface MutationAddContextCategoryArgs {
options: AddRemoveContextCategoryInput;
options: AddContextCategoryInput;
}
export interface MutationAddContextDocArgs {
@@ -1297,7 +1312,7 @@ export interface MutationReleaseDeletedBlobsArgs {
}
export interface MutationRemoveContextCategoryArgs {
options: AddRemoveContextCategoryInput;
options: RemoveContextCategoryInput;
}
export interface MutationRemoveContextDocArgs {
@@ -1695,6 +1710,12 @@ export interface RemoveAvatar {
success: Scalars['Boolean']['output'];
}
export interface RemoveContextCategoryInput {
categoryId: Scalars['String']['input'];
contextId: Scalars['String']['input'];
type: ContextCategories;
}
export interface RemoveContextDocInput {
contextId: Scalars['String']['input'];
docId: Scalars['String']['input'];
@@ -2423,7 +2444,7 @@ export type ChangePasswordMutation = {
};
export type AddContextCategoryMutationVariables = Exact<{
options: AddRemoveContextCategoryInput;
options: AddContextCategoryInput;
}>;
export type AddContextCategoryMutation = {
@@ -2433,11 +2454,17 @@ export type AddContextCategoryMutation = {
id: string;
createdAt: number;
type: ContextCategories;
docs: Array<{
__typename?: 'CopilotDocType';
id: string;
createdAt: number;
status: ContextEmbedStatus | null;
}>;
};
};
export type RemoveContextCategoryMutationVariables = Exact<{
options: AddRemoveContextCategoryInput;
options: RemoveContextCategoryInput;
}>;
export type RemoveContextCategoryMutation = {
@@ -2466,6 +2493,7 @@ export type AddContextDocMutation = {
id: string;
createdAt: number;
status: ContextEmbedStatus | null;
error: string | null;
};
};
@@ -2550,6 +2578,7 @@ export type ListContextObjectQuery = {
__typename?: 'CopilotContextDoc';
id: string;
status: ContextEmbedStatus | null;
error: string | null;
createdAt: number;
}>;
files: Array<{
@@ -2562,6 +2591,26 @@ export type ListContextObjectQuery = {
status: ContextEmbedStatus;
createdAt: number;
}>;
tags: Array<{
__typename?: 'CopilotContextCategory';
id: string;
createdAt: number;
docs: Array<{
__typename?: 'CopilotDocType';
id: string;
status: ContextEmbedStatus | null;
}>;
}>;
collections: Array<{
__typename?: 'CopilotContextCategory';
id: string;
createdAt: number;
docs: Array<{
__typename?: 'CopilotDocType';
id: string;
status: ContextEmbedStatus | null;
}>;
}>;
}>;
};
} | null;