support message detail interface

This commit is contained in:
2023-11-08 15:55:52 +08:00
parent 11b835460b
commit 9142665585
3 changed files with 60 additions and 43 deletions

View File

@@ -13,6 +13,7 @@ import ChatGPT, {
calculate_token_length,
ChunkMessage,
FetchResponse,
MessageDetail,
} from "./chatgpt";
import Message from "./message";
import models from "./models";
@@ -258,6 +259,7 @@ export default function ChatBOX(props: {
);
_setTemplateAPIs(templateAPIs);
};
const [images, setImages] = useState<MessageDetail[]>([]);
return (
<div className="grow flex flex-col p-2 dark:text-black">
@@ -633,7 +635,13 @@ export default function ChatBOX(props: {
chatStore.history
.filter(({ hide }) => !hide)
.slice(chatStore.postBeginIndex)
.map(({ content }) => content)
.map(({ content }) => {
if (typeof content === "string") {
return content;
} else {
return content.map((c) => c?.text).join(" ");
}
})
)
.concat([inputMsg])
.join(" ");