From 52004c938b9e9c3f329538aa0fff61a8930efe90 Mon Sep 17 00:00:00 2001 From: CMarghin <74823355+CH4R4F@users.noreply.github.com> Date: Thu, 23 Mar 2023 07:11:01 +0000 Subject: [PATCH] Name conversations automatically #86 (#90) --- pages/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pages/index.tsx b/pages/index.tsx index e846502..b57eeea 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -81,6 +81,16 @@ export default function Home() { return; } + if (updatedConversation.messages.length === 1) { + const {content} = message + const customName = content.length > 30 ? content.substring(0, 30) + "..." : content; + + updatedConversation = { + ...updatedConversation, + name: customName + }; + } + setLoading(false); const reader = data.getReader();