support tts

This commit is contained in:
2023-11-07 13:50:49 +08:00
parent 63a8331250
commit 15054eec85
4 changed files with 148 additions and 60 deletions

View File

@@ -3,6 +3,7 @@ import { useState, useEffect, StateUpdater } from "preact/hooks";
import { ChatStore, ChatStoreMessage } from "./app";
import { calculate_token_length } from "./chatgpt";
import Markdown from "preact-markdown";
import TTSButton from "./tts";
interface EditMessageProps {
chat: ChatStoreMessage;
@@ -163,6 +164,13 @@ export default function Message(props: Props) {
<div className="w-full flex justify-between">
<DeleteIcon />
<button onClick={() => setShowEdit(true)}>🖋</button>
{chatStore.tts_api && chatStore.tts_key && (
<TTSButton
chatStore={chatStore}
text={chat.content}
setChatStore={setChatStore}
/>
)}
<CopyIcon />
</div>
</div>