Skip to content

An AI-powered search engine with a generative UI

chore: Refactor workflow to use generated IDs for messages

Yoshiki Miuraba6e64e5fae9
diff --git a/lib/actions/workflow.tsx b/lib/actions/workflow.tsx
index 0a93c188..33d1b0d4 100644
--- a/lib/actions/workflow.tsx
+++ b/lib/actions/workflow.tsx
@@ -70,7 +70,7 @@ export async function workflow(
messages: [
...aiState.get().messages,
...toolResults.map((toolResult: any) => ({
- id: generateId(),
+ id,
role: 'tool',
content: JSON.stringify(toolResult.result),
name: toolResult.toolName,
@@ -107,13 +107,13 @@ export async function workflow(
messages: [
...aiState.get().messages,
{
- id: generateId(),
+ id,
role: 'assistant',
content: JSON.stringify(relatedQueries),
type: 'related'
},
{
- id: generateId(),
+ id,
role: 'assistant',
content: 'followup',
type: 'followup'