feat(chat): send idempotent client message ids
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
} from "@/data/schemas/chat";
|
||||
import type { ChatApi } from "@/data/services/api";
|
||||
import { Result } from "@/utils/result";
|
||||
import { createClientMessageId } from "@/lib/chat/client_message_id";
|
||||
|
||||
export class ChatRemoteDataSource {
|
||||
constructor(private readonly api: ChatApi) {}
|
||||
@@ -29,6 +30,7 @@ export class ChatRemoteDataSource {
|
||||
return Result.wrap(async () => {
|
||||
const request = SendMessageRequestSchema.parse({
|
||||
characterId,
|
||||
clientMessageId: options?.clientMessageId ?? createClientMessageId(),
|
||||
message,
|
||||
...(options?.imageId ? { imageId: options.imageId } : {}),
|
||||
...(options?.imageThumbUrl
|
||||
|
||||
Reference in New Issue
Block a user