Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: cannot query chat history (#6539)

darkskygit2336638996e4
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<Array<Scalars['String']['input']>>;
- content: Scalars['String']['input'];
- params: InputMaybe<Scalars['String']['input']>;
+ content: InputMaybe<Scalars['String']['input']>;
+ params: InputMaybe<Scalars['JSON']['input']>;
sessionId: Scalars['String']['input'];
}
export interface CreateChatSessionInput {
- /** An mark identifying which view to use to display the session */
- action: InputMaybe<Scalars['String']['input']>;
docId: Scalars['String']['input'];
/** The prompt name to use for the session */
promptName: Scalars['String']['input'];