feat(server): allow chat session dangling & pin session support (#12849)

fix AI-181
fix AI-179
fix AI-178
fix PD-2682
fix PD-2683
This commit is contained in:
DarkSky
2025-06-19 13:17:01 +08:00
committed by GitHub
parent d80bfac1d2
commit bd04930560
28 changed files with 1422 additions and 394 deletions

View File

@@ -7,6 +7,7 @@ query getCopilotHistoryIds(
copilot(workspaceId: $workspaceId) {
histories(docId: $docId, options: $options) {
sessionId
pinned
messages {
id
role

View File

@@ -7,6 +7,7 @@ query getCopilotHistories(
copilot(workspaceId: $workspaceId) {
histories(docId: $docId, options: $options) {
sessionId
pinned
tokens
action
createdAt

View File

@@ -7,6 +7,8 @@ query getCopilotSession(
session(sessionId: $sessionId) {
id
parentSessionId
docId
pinned
promptName
model
optionalModels

View File

@@ -8,6 +8,8 @@ query getCopilotSessions(
sessions(docId: $docId, options: $options) {
id
parentSessionId
docId
pinned
promptName
model
optionalModels

View File

@@ -591,6 +591,7 @@ export const getCopilotHistoryIdsQuery = {
copilot(workspaceId: $workspaceId) {
histories(docId: $docId, options: $options) {
sessionId
pinned
messages {
id
role
@@ -610,6 +611,7 @@ export const getCopilotHistoriesQuery = {
copilot(workspaceId: $workspaceId) {
histories(docId: $docId, options: $options) {
sessionId
pinned
tokens
action
createdAt
@@ -762,6 +764,8 @@ export const getCopilotSessionQuery = {
session(sessionId: $sessionId) {
id
parentSessionId
docId
pinned
promptName
model
optionalModels
@@ -788,6 +792,8 @@ export const getCopilotSessionsQuery = {
sessions(docId: $docId, options: $options) {
id
parentSessionId
docId
pinned
promptName
model
optionalModels

View File

@@ -334,6 +334,7 @@ export interface CopilotHistories {
action: Maybe<Scalars['String']['output']>;
createdAt: Scalars['DateTime']['output'];
messages: Array<ChatMessage>;
pinned: Scalars['Boolean']['output'];
sessionId: Scalars['String']['output'];
/** The number of tokens used in the session */
tokens: Scalars['Int']['output'];
@@ -434,10 +435,12 @@ export interface CopilotQuota {
export interface CopilotSessionType {
__typename?: 'CopilotSessionType';
docId: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
model: Scalars['String']['output'];
optionalModels: Array<Scalars['String']['output']>;
parentSessionId: Maybe<Scalars['ID']['output']>;
pinned: Scalars['Boolean']['output'];
promptName: Scalars['String']['output'];
}
@@ -501,7 +504,8 @@ export interface CreateChatMessageInput {
}
export interface CreateChatSessionInput {
docId: Scalars['String']['input'];
docId?: InputMaybe<Scalars['String']['input']>;
pinned?: InputMaybe<Scalars['Boolean']['input']>;
/** The prompt name to use for the session */
promptName: Scalars['String']['input'];
workspaceId: Scalars['String']['input'];
@@ -746,6 +750,7 @@ export enum ErrorNames {
COPILOT_PROVIDER_SIDE_ERROR = 'COPILOT_PROVIDER_SIDE_ERROR',
COPILOT_QUOTA_EXCEEDED = 'COPILOT_QUOTA_EXCEEDED',
COPILOT_SESSION_DELETED = 'COPILOT_SESSION_DELETED',
COPILOT_SESSION_INVALID_INPUT = 'COPILOT_SESSION_INVALID_INPUT',
COPILOT_SESSION_NOT_FOUND = 'COPILOT_SESSION_NOT_FOUND',
COPILOT_TRANSCRIPTION_AUDIO_NOT_PROVIDED = 'COPILOT_TRANSCRIPTION_AUDIO_NOT_PROVIDED',
COPILOT_TRANSCRIPTION_JOB_EXISTS = 'COPILOT_TRANSCRIPTION_JOB_EXISTS',
@@ -2336,8 +2341,12 @@ export interface UpdateAppConfigInput {
}
export interface UpdateChatSessionInput {
/** The workspace id of the session */
docId?: InputMaybe<Scalars['String']['input']>;
/** Whether to pin the session */
pinned?: InputMaybe<Scalars['Boolean']['input']>;
/** The prompt name to use for the session */
promptName: Scalars['String']['input'];
promptName?: InputMaybe<Scalars['String']['input']>;
sessionId: Scalars['String']['input'];
}
@@ -3349,6 +3358,7 @@ export type GetCopilotHistoryIdsQuery = {
histories: Array<{
__typename?: 'CopilotHistories';
sessionId: string;
pinned: boolean;
messages: Array<{
__typename?: 'ChatMessage';
id: string | null;
@@ -3375,6 +3385,7 @@ export type GetCopilotHistoriesQuery = {
histories: Array<{
__typename?: 'CopilotHistories';
sessionId: string;
pinned: boolean;
tokens: number;
action: string | null;
createdAt: string;
@@ -3553,6 +3564,8 @@ export type GetCopilotSessionQuery = {
__typename?: 'CopilotSessionType';
id: string;
parentSessionId: string | null;
docId: string | null;
pinned: boolean;
promptName: string;
model: string;
optionalModels: Array<string>;
@@ -3586,6 +3599,8 @@ export type GetCopilotSessionsQuery = {
__typename?: 'CopilotSessionType';
id: string;
parentSessionId: string | null;
docId: string | null;
pinned: boolean;
promptName: string;
model: string;
optionalModels: Array<string>;