mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
feat(server): add typed list session gql (#12979)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced new API endpoints and GraphQL queries to retrieve Copilot chat sessions by workspace, document, and pinned status, with detailed session and message information. * Added support for filtering and querying Copilot chat histories with new options such as pinned status and message ordering. * **Bug Fixes** * Improved filtering logic for listing and retrieving chat sessions, ensuring accurate results for workspace, document, and pinned session queries. * **Tests** * Expanded and refactored test coverage for session listing, filtering, and new query options to ensure reliability and correctness of Copilot session retrieval. * Updated snapshot data to reflect new session types and filtering capabilities. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -3390,6 +3390,129 @@ export type GetCopilotHistoryIdsQuery = {
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type GetCopilotDocSessionsQueryVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
docId: Scalars['String']['input'];
|
||||
options?: InputMaybe<QueryChatHistoriesInput>;
|
||||
}>;
|
||||
|
||||
export type GetCopilotDocSessionsQuery = {
|
||||
__typename?: 'Query';
|
||||
currentUser: {
|
||||
__typename?: 'UserType';
|
||||
copilot: {
|
||||
__typename?: 'Copilot';
|
||||
histories: Array<{
|
||||
__typename?: 'CopilotHistories';
|
||||
sessionId: string;
|
||||
pinned: boolean;
|
||||
tokens: number;
|
||||
action: string | null;
|
||||
createdAt: string;
|
||||
messages: Array<{
|
||||
__typename?: 'ChatMessage';
|
||||
id: string | null;
|
||||
role: string;
|
||||
content: string;
|
||||
attachments: Array<string> | null;
|
||||
createdAt: string;
|
||||
streamObjects: Array<{
|
||||
__typename?: 'StreamObject';
|
||||
type: string;
|
||||
textDelta: string | null;
|
||||
toolCallId: string | null;
|
||||
toolName: string | null;
|
||||
args: Record<string, string> | null;
|
||||
result: Record<string, string> | null;
|
||||
}> | null;
|
||||
}>;
|
||||
}>;
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type GetCopilotPinnedSessionsQueryVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
docId?: InputMaybe<Scalars['String']['input']>;
|
||||
messageOrder?: InputMaybe<ChatHistoryOrder>;
|
||||
withPrompt?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
}>;
|
||||
|
||||
export type GetCopilotPinnedSessionsQuery = {
|
||||
__typename?: 'Query';
|
||||
currentUser: {
|
||||
__typename?: 'UserType';
|
||||
copilot: {
|
||||
__typename?: 'Copilot';
|
||||
histories: Array<{
|
||||
__typename?: 'CopilotHistories';
|
||||
sessionId: string;
|
||||
pinned: boolean;
|
||||
tokens: number;
|
||||
action: string | null;
|
||||
createdAt: string;
|
||||
messages: Array<{
|
||||
__typename?: 'ChatMessage';
|
||||
id: string | null;
|
||||
role: string;
|
||||
content: string;
|
||||
attachments: Array<string> | null;
|
||||
createdAt: string;
|
||||
streamObjects: Array<{
|
||||
__typename?: 'StreamObject';
|
||||
type: string;
|
||||
textDelta: string | null;
|
||||
toolCallId: string | null;
|
||||
toolName: string | null;
|
||||
args: Record<string, string> | null;
|
||||
result: Record<string, string> | null;
|
||||
}> | null;
|
||||
}>;
|
||||
}>;
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type GetCopilotWorkspaceSessionsQueryVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
options?: InputMaybe<QueryChatHistoriesInput>;
|
||||
}>;
|
||||
|
||||
export type GetCopilotWorkspaceSessionsQuery = {
|
||||
__typename?: 'Query';
|
||||
currentUser: {
|
||||
__typename?: 'UserType';
|
||||
copilot: {
|
||||
__typename?: 'Copilot';
|
||||
histories: Array<{
|
||||
__typename?: 'CopilotHistories';
|
||||
sessionId: string;
|
||||
pinned: boolean;
|
||||
tokens: number;
|
||||
action: string | null;
|
||||
createdAt: string;
|
||||
messages: Array<{
|
||||
__typename?: 'ChatMessage';
|
||||
id: string | null;
|
||||
role: string;
|
||||
content: string;
|
||||
attachments: Array<string> | null;
|
||||
createdAt: string;
|
||||
streamObjects: Array<{
|
||||
__typename?: 'StreamObject';
|
||||
type: string;
|
||||
textDelta: string | null;
|
||||
toolCallId: string | null;
|
||||
toolName: string | null;
|
||||
args: Record<string, string> | null;
|
||||
result: Record<string, string> | null;
|
||||
}> | null;
|
||||
}>;
|
||||
}>;
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type GetCopilotHistoriesQueryVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
docId?: InputMaybe<Scalars['String']['input']>;
|
||||
@@ -5252,6 +5375,21 @@ export type Queries =
|
||||
variables: GetCopilotHistoryIdsQueryVariables;
|
||||
response: GetCopilotHistoryIdsQuery;
|
||||
}
|
||||
| {
|
||||
name: 'getCopilotDocSessionsQuery';
|
||||
variables: GetCopilotDocSessionsQueryVariables;
|
||||
response: GetCopilotDocSessionsQuery;
|
||||
}
|
||||
| {
|
||||
name: 'getCopilotPinnedSessionsQuery';
|
||||
variables: GetCopilotPinnedSessionsQueryVariables;
|
||||
response: GetCopilotPinnedSessionsQuery;
|
||||
}
|
||||
| {
|
||||
name: 'getCopilotWorkspaceSessionsQuery';
|
||||
variables: GetCopilotWorkspaceSessionsQueryVariables;
|
||||
response: GetCopilotWorkspaceSessionsQuery;
|
||||
}
|
||||
| {
|
||||
name: 'getCopilotHistoriesQuery';
|
||||
variables: GetCopilotHistoriesQueryVariables;
|
||||
|
||||
Reference in New Issue
Block a user