From ccf742e158a685100eaef4da67be8d657c5de98b Mon Sep 17 00:00:00 2001 From: yiling Date: Tue, 7 Jul 2026 11:04:51 +0800 Subject: [PATCH] refactor(chatbot): make user parameter in startOrContinueChat type-safe --- packages/core/src/chat/chat.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/chat/chat.ts b/packages/core/src/chat/chat.ts index 405fc0d1..8d2db667 100644 --- a/packages/core/src/chat/chat.ts +++ b/packages/core/src/chat/chat.ts @@ -5,6 +5,8 @@ import { paginateQuery, type PaginatedData } from '@shumai/core/src/pagination' import type { ChatRequest, ChatSessionInfo, ChatMessage } from '@shumai/dtos' import { ulid } from 'ulid' +type User = Prisma.UserGetPayload> + export function mapEntryToMessage( entryRecord: Prisma.AgentSessionEntryGetPayload>, ): ChatMessage { @@ -77,9 +79,8 @@ export class ChatService { return parts.join('/') } - // eslint-disable-next-line @typescript-eslint/no-explicit-any async startOrContinueChat( - user: any, + user: User, req: ChatRequest, ): Promise<{ sessionId: string; taskId: string }> { const {