Merge branch 'main' into bugfix-0503

This commit is contained in:
Yidadaa
2023-05-03 15:56:02 +08:00
25 changed files with 433 additions and 274 deletions

View File

@@ -1,5 +1,5 @@
import { useDebouncedCallback } from "use-debounce";
import { memo, useState, useRef, useEffect, useLayoutEffect } from "react";
import { useState, useRef, useEffect, useLayoutEffect } from "react";
import SendWhiteIcon from "../icons/send-white.svg";
import BrainIcon from "../icons/brain.svg";
@@ -64,12 +64,9 @@ import {
useMaskStore,
} from "../store/mask";
const Markdown = dynamic(
async () => memo((await import("./markdown")).Markdown),
{
loading: () => <LoadingIcon />,
},
);
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
loading: () => <LoadingIcon />,
});
function exportMessages(messages: Message[], topic: string) {
const mdText =
@@ -394,7 +391,7 @@ export function Chat() {
const onPromptSelect = (prompt: Prompt) => {
setPromptHints([]);
inputRef.current?.focus();
setUserInput(prompt.content);
setTimeout(() => setUserInput(prompt.content), 60);
};
// auto grow input
@@ -728,6 +725,7 @@ export function Chat() {
}}
fontSize={fontSize}
parentRef={scrollRef}
defaultShow={i >= messages.length - 10}
/>
</div>
{!isUser && !message.preview && (