fixed duplicated message
This commit is contained in:
parent
bb5dae166f
commit
4ca064ebdc
3 changed files with 374 additions and 358 deletions
|
|
@ -0,0 +1,8 @@
|
|||
export default function codeBlock() {
|
||||
// a html custom element for code blocks in markdown texts, it will allow to download the code as a file or copy it to the clipboard
|
||||
return (
|
||||
<div>
|
||||
<h1>Code Block</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -65,6 +65,14 @@ export default function ChatMessage({ chat }: { chat: ChatMessageType }) {
|
|||
remarkPlugins={[remarkGfm, remarkMath]}
|
||||
rehypePlugins={[rehypeMathjax]}
|
||||
className="markdown prose"
|
||||
// components={{
|
||||
// code: (props) => (
|
||||
// <code
|
||||
// className="bg-pink-600 dark:bg-gray-700 rounded-md p-1"
|
||||
// {...props}
|
||||
// />
|
||||
// ),
|
||||
// }}
|
||||
>
|
||||
{message}
|
||||
</ReactMarkdown>
|
||||
|
|
|
|||
|
|
@ -69,12 +69,13 @@ export default function ChatModal({
|
|||
setChatHistory((old) => {
|
||||
let newChat = [...old];
|
||||
if (str) {
|
||||
if (end && !newChat[newChat.length - 1].message) {
|
||||
if (end) {
|
||||
newChat[newChat.length - 1].message = str;
|
||||
}
|
||||
} else {
|
||||
newChat[newChat.length - 1].message =
|
||||
newChat[newChat.length - 1].message + str;
|
||||
}
|
||||
}
|
||||
if (thought) {
|
||||
newChat[newChat.length - 1].thought = thought;
|
||||
}
|
||||
|
|
@ -137,7 +138,6 @@ export default function ChatModal({
|
|||
thought: data.intermediate_steps,
|
||||
end: true,
|
||||
});
|
||||
|
||||
}
|
||||
setLockChat(false);
|
||||
isStream = false;
|
||||
|
|
@ -346,7 +346,7 @@ export default function ChatModal({
|
|||
<div className="relative w-full">
|
||||
<button
|
||||
onClick={() => clearChat()}
|
||||
className="absolute top-2 right-2 hover:text-red-500"
|
||||
className="absolute top-2 right-2 hover:text-red-500 z-30"
|
||||
>
|
||||
<FaEraser className="w-4 h-4" />
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue