- {useMemo(
- () =>
- chat.message.toString() === "" && lockChat ? (
-
- ) : (
-
+ ) : (
+ {props.children}>;
- },
- code: ({
- node,
- inline,
- className,
- children,
- ...props
- }) => {
- if (children.length) {
- if (children[0] === "▍") {
- return (
-
- ▍
-
- );
- }
-
- children[0] = (children[0] as string).replace(
- "`▍`",
- "▍"
- );
- }
-
- const match = /language-(\w+)/.exec(
- className || ""
+ components={{
+ pre({ node, ...props }) {
+ return <>{props.children}>;
+ },
+ code: ({
+ node,
+ inline,
+ className,
+ children,
+ ...props
+ }) => {
+ if (children.length) {
+ if (children[0] === "▍") {
+ return (
+
+ ▍
+
);
+ }
- return !inline ? (
- {}}
- />
- ) : (
-
- {children}
-
- );
- },
- }}
- >
- {chat.message.toString()}
-
- ),
- [chat.message, chat.message.toString()]
+ children[0] = (children[0] as string).replace(
+ "`▍`",
+ "▍"
+ );
+ }
+
+ const match = /language-(\w+)/.exec(className || "");
+
+ return !inline ? (
+ {}}
+ />
+ ) : (
+
+ {children}
+
+ );
+ },
+ }}
+ >
+ {chat.message.toString()}
+
)}
{chat.files && (
diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx
index c2c39c1e0..571cbca06 100644
--- a/src/frontend/src/modals/formModal/index.tsx
+++ b/src/frontend/src/modals/formModal/index.tsx
@@ -146,13 +146,14 @@ export default function FormModal({
newChat[newChat.length - 1].message + str;
}
}
- if (thought) {
+
+ if (thought && newChat[newChat.length - 1]?.thought) {
newChat[newChat.length - 1].thought = thought;
}
- if (files) {
+ if (files && newChat[newChat.length - 1]?.files) {
newChat[newChat.length - 1].files = files;
}
- if (prompt) {
+ if (prompt && newChat[newChat.length - 2]?.template) {
newChat[newChat.length - 2].template = prompt;
}
return newChat;
diff --git a/src/frontend/src/modals/genericModal/index.tsx b/src/frontend/src/modals/genericModal/index.tsx
index 355d0afcd..064ae87b4 100644
--- a/src/frontend/src/modals/genericModal/index.tsx
+++ b/src/frontend/src/modals/genericModal/index.tsx
@@ -122,24 +122,21 @@ export default function GenericModal({
}
if (apiReturn.data) {
let inputVariables = apiReturn.data.input_variables ?? [];
+ if (
+ JSON.stringify(apiReturn.data?.frontend_node) !== JSON.stringify({})
+ ) {
+ setNodeClass!(apiReturn.data?.frontend_node, inputValue);
+ setModalOpen(closeModal);
+ setIsEdit(false);
+ }
if (!inputVariables || inputVariables.length === 0) {
- setIsEdit(true);
setNoticeData({
title: "Your template does not have any variables.",
});
- setModalOpen(false);
} else {
- if (
- JSON.stringify(apiReturn.data?.frontend_node) !==
- JSON.stringify({})
- ) {
- setNodeClass!(apiReturn.data?.frontend_node, inputValue);
- setModalOpen(closeModal);
- setIsEdit(false);
- setSuccessData({
- title: "Prompt is ready",
- });
- }
+ setSuccessData({
+ title: "Prompt is ready",
+ });
}
} else {
setIsEdit(true);