feat: allow sort and filter forked session (#7519)

This commit is contained in:
DarkSky
2024-07-18 11:08:47 +08:00
committed by GitHub
parent ccac7a883c
commit dcb9d75db7
10 changed files with 166 additions and 26 deletions

View File

@@ -0,0 +1,18 @@
query getCopilotHistoryIds(
$workspaceId: String!
$docId: String
$options: QueryChatHistoriesInput
) {
currentUser {
copilot(workspaceId: $workspaceId) {
histories(docId: $docId, options: $options) {
sessionId
messages {
id
role
createdAt
}
}
}
}
}

View File

@@ -279,6 +279,28 @@ query getCopilotHistories($workspaceId: String!, $docId: String, $options: Query
}`,
};
export const getCopilotHistoryIdsQuery = {
id: 'getCopilotHistoryIdsQuery' as const,
operationName: 'getCopilotHistoryIds',
definitionName: 'currentUser',
containsFile: false,
query: `
query getCopilotHistoryIds($workspaceId: String!, $docId: String, $options: QueryChatHistoriesInput) {
currentUser {
copilot(workspaceId: $workspaceId) {
histories(docId: $docId, options: $options) {
sessionId
messages {
id
role
createdAt
}
}
}
}
}`,
};
export const getCopilotSessionsQuery = {
id: 'getCopilotSessionsQuery' as const,
operationName: 'getCopilotSessions',

View File

@@ -44,6 +44,11 @@ export interface BlobNotFoundDataType {
workspaceId: Scalars['String']['output'];
}
export enum ChatHistoryOrder {
asc = 'asc',
desc = 'desc',
}
export interface ChatMessage {
__typename?: 'ChatMessage';
attachments: Maybe<Array<Scalars['String']['output']>>;
@@ -847,8 +852,11 @@ export interface QueryWorkspaceArgs {
export interface QueryChatHistoriesInput {
action: InputMaybe<Scalars['Boolean']['input']>;
fork: InputMaybe<Scalars['Boolean']['input']>;
limit: InputMaybe<Scalars['Int']['input']>;
messageOrder: InputMaybe<ChatHistoryOrder>;
sessionId: InputMaybe<Scalars['String']['input']>;
sessionOrder: InputMaybe<ChatHistoryOrder>;
skip: InputMaybe<Scalars['Int']['input']>;
}
@@ -1438,6 +1446,32 @@ export type GetCopilotHistoriesQuery = {
} | null;
};
export type GetCopilotHistoryIdsQueryVariables = Exact<{
workspaceId: Scalars['String']['input'];
docId: InputMaybe<Scalars['String']['input']>;
options: InputMaybe<QueryChatHistoriesInput>;
}>;
export type GetCopilotHistoryIdsQuery = {
__typename?: 'Query';
currentUser: {
__typename?: 'UserType';
copilot: {
__typename?: 'Copilot';
histories: Array<{
__typename?: 'CopilotHistories';
sessionId: string;
messages: Array<{
__typename?: 'ChatMessage';
id: string | null;
role: string;
createdAt: string;
}>;
}>;
};
} | null;
};
export type GetCopilotSessionsQueryVariables = Exact<{
workspaceId: Scalars['String']['input'];
}>;
@@ -2191,6 +2225,11 @@ export type Queries =
variables: GetCopilotHistoriesQueryVariables;
response: GetCopilotHistoriesQuery;
}
| {
name: 'getCopilotHistoryIdsQuery';
variables: GetCopilotHistoryIdsQueryVariables;
response: GetCopilotHistoryIdsQuery;
}
| {
name: 'getCopilotSessionsQuery';
variables: GetCopilotSessionsQueryVariables;