feat(core): add get session graphql api (#12237)

Close [AI-116](https://linear.app/affine-design/issue/AI-116)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added the ability to retrieve detailed information for a specific Copilot session by its ID, including model metadata and optional models, via the user interface and API.
  - Session data now includes additional fields such as the model used and a list of optional models.
  - Enhanced GraphQL queries and UI components to support fetching and displaying these new session details.

- **Improvements**
  - Session lists now provide richer information, including model details, for each session.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
akumatus
2025-05-15 04:55:50 +00:00
parent 6052743671
commit fcc9b31da9
10 changed files with 173 additions and 20 deletions

View File

@@ -174,6 +174,8 @@ export interface Copilot {
histories: Array<CopilotHistories>;
/** Get the quota of the user in the workspace */
quota: CopilotQuota;
/** Get the session by id */
session: CopilotSessionType;
/**
* Get the session id list in the workspace
* @deprecated Use `sessions` instead
@@ -199,6 +201,10 @@ export interface CopilotHistoriesArgs {
options?: InputMaybe<QueryChatHistoriesInput>;
}
export interface CopilotSessionArgs {
sessionId: Scalars['String']['input'];
}
export interface CopilotSessionIdsArgs {
docId?: InputMaybe<Scalars['String']['input']>;
options?: InputMaybe<QueryChatSessionsInput>;
@@ -415,6 +421,8 @@ export interface CopilotQuota {
export interface CopilotSessionType {
__typename?: 'CopilotSessionType';
id: Scalars['ID']['output'];
model: Scalars['String']['output'];
optionalModels: Array<Scalars['String']['output']>;
parentSessionId: Maybe<Scalars['ID']['output']>;
promptName: Scalars['String']['output'];
}
@@ -3453,6 +3461,29 @@ export type ForkCopilotSessionMutation = {
forkCopilotSession: string;
};
export type GetCopilotSessionQueryVariables = Exact<{
workspaceId: Scalars['String']['input'];
sessionId: Scalars['String']['input'];
}>;
export type GetCopilotSessionQuery = {
__typename?: 'Query';
currentUser: {
__typename?: 'UserType';
copilot: {
__typename?: 'Copilot';
session: {
__typename?: 'CopilotSessionType';
id: string;
parentSessionId: string | null;
promptName: string;
model: string;
optionalModels: Array<string>;
};
};
} | null;
};
export type UpdateCopilotSessionMutationVariables = Exact<{
options: UpdateChatSessionInput;
}>;
@@ -3479,6 +3510,8 @@ export type GetCopilotSessionsQuery = {
id: string;
parentSessionId: string | null;
promptName: string;
model: string;
optionalModels: Array<string>;
}>;
};
} | null;
@@ -4997,6 +5030,11 @@ export type Queries =
variables: CopilotQuotaQueryVariables;
response: CopilotQuotaQuery;
}
| {
name: 'getCopilotSessionQuery';
variables: GetCopilotSessionQueryVariables;
response: GetCopilotSessionQuery;
}
| {
name: 'getCopilotSessionsQuery';
variables: GetCopilotSessionsQueryVariables;