From e0f88451e10d9b91c7ace386862ca47540b04d63 Mon Sep 17 00:00:00 2001 From: Wu Yue Date: Fri, 11 Jul 2025 11:42:52 +0800 Subject: [PATCH] feat(core): render session title in ai session history (#13147) Close [AI-331](https://linear.app/affine-design/issue/AI-331) ## Summary by CodeRabbit * **Improvements** * Session history now displays the session title (or "New chat" if unavailable) instead of the session ID for a clearer user experience. * **Performance** * Recent copilot chat session lists now load faster by excluding message details from the initial query. --- .../common/graphql/src/graphql/copilot-session-list-recent.gql | 2 +- packages/common/graphql/src/graphql/index.ts | 2 +- .../ai/components/ai-chat-toolbar/ai-session-history.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/common/graphql/src/graphql/copilot-session-list-recent.gql b/packages/common/graphql/src/graphql/copilot-session-list-recent.gql index 4c013d5dcf..47e7a6b202 100644 --- a/packages/common/graphql/src/graphql/copilot-session-list-recent.gql +++ b/packages/common/graphql/src/graphql/copilot-session-list-recent.gql @@ -11,7 +11,7 @@ query getCopilotRecentSessions( options: { fork: false sessionOrder: desc - withMessages: true + withMessages: false } ) { ...PaginatedCopilotChats diff --git a/packages/common/graphql/src/graphql/index.ts b/packages/common/graphql/src/graphql/index.ts index c9413d19b7..50d85c995e 100644 --- a/packages/common/graphql/src/graphql/index.ts +++ b/packages/common/graphql/src/graphql/index.ts @@ -1073,7 +1073,7 @@ export const getCopilotRecentSessionsQuery = { copilot(workspaceId: $workspaceId) { chats( pagination: {first: $limit} - options: {fork: false, sessionOrder: desc, withMessages: true} + options: {fork: false, sessionOrder: desc, withMessages: false} ) { ...PaginatedCopilotChats } diff --git a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-toolbar/ai-session-history.ts b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-toolbar/ai-session-history.ts index f96476e296..a7f56b392e 100644 --- a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-toolbar/ai-session-history.ts +++ b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-toolbar/ai-session-history.ts @@ -225,7 +225,7 @@ export class AISessionHistory extends WithDisposable(ShadowlessElement) { }} >
- ${session.sessionId} + ${session.title || 'New chat'} Click to open this chat