mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 11:24:43 +00:00
refactor(chatbot): make user parameter in startOrContinueChat type-safe
This commit is contained in:
@@ -5,6 +5,8 @@ import { paginateQuery, type PaginatedData } from '@shumai/core/src/pagination'
|
|||||||
import type { ChatRequest, ChatSessionInfo, ChatMessage } from '@shumai/dtos'
|
import type { ChatRequest, ChatSessionInfo, ChatMessage } from '@shumai/dtos'
|
||||||
import { ulid } from 'ulid'
|
import { ulid } from 'ulid'
|
||||||
|
|
||||||
|
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||||
|
|
||||||
export function mapEntryToMessage(
|
export function mapEntryToMessage(
|
||||||
entryRecord: Prisma.AgentSessionEntryGetPayload<Record<string, never>>,
|
entryRecord: Prisma.AgentSessionEntryGetPayload<Record<string, never>>,
|
||||||
): ChatMessage {
|
): ChatMessage {
|
||||||
@@ -77,9 +79,8 @@ export class ChatService {
|
|||||||
return parts.join('/')
|
return parts.join('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
async startOrContinueChat(
|
async startOrContinueChat(
|
||||||
user: any,
|
user: User,
|
||||||
req: ChatRequest,
|
req: ChatRequest,
|
||||||
): Promise<{ sessionId: string; taskId: string }> {
|
): Promise<{ sessionId: string; taskId: string }> {
|
||||||
const {
|
const {
|
||||||
|
|||||||
Reference in New Issue
Block a user