Skip to content

Commit

Permalink
fix: untitled chats from ask widget
Browse files Browse the repository at this point in the history
  • Loading branch information
634750802 committed Apr 16, 2024
1 parent 3b9de8e commit e7411cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/api/v1/chats/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const POST = defineHandler({
engine_options: JSON.stringify({}),
created_at: new Date(),
created_by: userId,
title: body.name ?? DEFAULT_CHAT_TITLE,
title: body.name ?? body.messages.findLast(message => message.role === 'user')?.content ?? DEFAULT_CHAT_TITLE,
});
sessionId = chat.url_key;
}
Expand Down

0 comments on commit e7411cc

Please sign in to comment.