From 2336638996e423e7c9da98215fb4eb81db367b56 Mon Sep 17 00:00:00 2001 From: darkskygit Date: Fri, 12 Apr 2024 12:16:42 +0000 Subject: [PATCH] fix: cannot query chat history (#6539) --- .../backend/server/src/plugins/copilot/session.ts | 12 +++++++++++- packages/frontend/graphql/src/schema.ts | 8 ++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/backend/server/src/plugins/copilot/session.ts b/packages/backend/server/src/plugins/copilot/session.ts index f29076d11d..50f6116c18 100644 --- a/packages/backend/server/src/plugins/copilot/session.ts +++ b/packages/backend/server/src/plugins/copilot/session.ts @@ -187,7 +187,16 @@ export class ChatSessionService { userId: true, workspaceId: true, docId: true, - messages: true, + messages: { + select: { + role: true, + content: true, + createdAt: true, + }, + orderBy: { + createdAt: 'asc', + }, + }, prompt: { select: { name: true, @@ -197,6 +206,7 @@ export class ChatSessionService { select: { role: true, content: true, + createdAt: true, }, orderBy: { idx: 'asc', diff --git a/packages/frontend/graphql/src/schema.ts b/packages/frontend/graphql/src/schema.ts index 7ffd1f1222..e1e2ab9bbf 100644 --- a/packages/frontend/graphql/src/schema.ts +++ b/packages/frontend/graphql/src/schema.ts @@ -28,6 +28,8 @@ export interface Scalars { Float: { input: number; output: number }; /** A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format. */ DateTime: { input: string; output: string }; + /** The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */ + JSON: { input: string; output: string }; /** The `SafeInt` scalar type represents non-fractional signed whole numeric values that are considered safe as defined by the ECMAScript specification. */ SafeInt: { input: number; output: number }; /** The `Upload` scalar type represents a file upload. */ @@ -36,14 +38,12 @@ export interface Scalars { export interface CreateChatMessageInput { attachments: InputMaybe>; - content: Scalars['String']['input']; - params: InputMaybe; + content: InputMaybe; + params: InputMaybe; sessionId: Scalars['String']['input']; } export interface CreateChatSessionInput { - /** An mark identifying which view to use to display the session */ - action: InputMaybe; docId: Scalars['String']['input']; /** The prompt name to use for the session */ promptName: Scalars['String']['input'];