From 00c1a946c0de08f65772ca626d96bcc9123e1a8f Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 28 Sep 2023 09:12:33 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(formModal):=20add=20support?= =?UTF-8?q?=20for=20prompt=20in=20updateLastMessage=20function=20to=20upda?= =?UTF-8?q?te=20chat=20message=20template=20=F0=9F=94=80=20merge(types):?= =?UTF-8?q?=20add=20prompt=20property=20to=20ChatMessageType=20to=20suppor?= =?UTF-8?q?t=20chat=20message=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/modals/formModal/index.tsx | 11 +++++++++-- src/frontend/src/types/chat/index.ts | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx index 01d6a0954..e80e1e7ce 100644 --- a/src/frontend/src/modals/formModal/index.tsx +++ b/src/frontend/src/modals/formModal/index.tsx @@ -124,12 +124,13 @@ export default function FormModal({ function updateLastMessage({ str, thought, + prompt, end = false, files, }: { str?: string; thought?: string; - // end param default is false + prompt?: string; end?: boolean; files?: Array; }) { @@ -149,6 +150,9 @@ export default function FormModal({ if (files) { newChat[newChat.length - 1].files = files; } + if (prompt) { + newChat[newChat.length - 1].template = prompt; + } return newChat; }); } @@ -244,7 +248,10 @@ export default function FormModal({ isStream = false; } if (data.type === "stream" && isStream) { - updateLastMessage({ str: data.message }); + if (data.prompt) { + } else { + updateLastMessage({ str: data.message }); + } } } diff --git a/src/frontend/src/types/chat/index.ts b/src/frontend/src/types/chat/index.ts index 2e7a65fdb..71a081be7 100644 --- a/src/frontend/src/types/chat/index.ts +++ b/src/frontend/src/types/chat/index.ts @@ -8,5 +8,6 @@ export type ChatMessageType = { isSend: boolean; thought?: string; files?: Array<{ data: string; type: string; data_type: string }>; + prompt?: string; chatKey: string; };