Skip to content

Commit 2bee53b

Browse files
authored
Set message id on server side (#696)
1 parent c30d191 commit 2bee53b

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/routes/conversation/[id]/+page.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,12 @@
111111
112112
files = [];
113113
114-
const responseId = randomUUID();
115114
const response = await fetch(`${base}/conversation/${$page.params.id}`, {
116115
method: "POST",
117116
headers: { "Content-Type": "application/json" },
118117
body: JSON.stringify({
119118
inputs: message,
120119
id: messageId,
121-
response_id: responseId,
122120
is_retry: isRetry,
123121
web_search: $webSearchParameters.useSearch,
124122
files: isRetry ? undefined : resizedImages,

src/routes/conversation/[id]/+server.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ export async function POST({ request, locals, params, getClientAddress }) {
9090

9191
const {
9292
inputs: newPrompt,
93-
response_id: responseId,
9493
id: messageId,
9594
is_retry,
9695
web_search: webSearch,
@@ -99,7 +98,6 @@ export async function POST({ request, locals, params, getClientAddress }) {
9998
.object({
10099
inputs: z.string().trim().min(1),
101100
id: z.optional(z.string().uuid()),
102-
response_id: z.optional(z.string().uuid()),
103101
is_retry: z.optional(z.boolean()),
104102
web_search: z.optional(z.boolean()),
105103
files: z.optional(z.array(z.string())),
@@ -268,7 +266,7 @@ export async function POST({ request, locals, params, getClientAddress }) {
268266
content: output.token.text.trimStart(),
269267
webSearch: webSearchResults,
270268
updates: updates,
271-
id: (responseId as Message["id"]) || crypto.randomUUID(),
269+
id: crypto.randomUUID(),
272270
createdAt: new Date(),
273271
updatedAt: new Date(),
274272
},

0 commit comments

Comments
 (0)