mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 07:36:39 +08:00
chore: 提示音
This commit is contained in:
parent
7475519473
commit
f0b9068ddf
@ -370,7 +370,7 @@ export function ChatAction(props: {
|
||||
text: string;
|
||||
icon: JSX.Element;
|
||||
onClick: () => void;
|
||||
isListening: boolean;
|
||||
isListening?: boolean;
|
||||
}) {
|
||||
const iconRef = useRef<HTMLDivElement>(null);
|
||||
const textRef = useRef<HTMLDivElement>(null);
|
||||
@ -574,7 +574,15 @@ export function ChatActions(props: {
|
||||
);
|
||||
}, []);
|
||||
|
||||
function playSound(fileName: string) {
|
||||
const audio = new Audio(fileName);
|
||||
audio.play().catch((error) => {
|
||||
console.error("error:", error);
|
||||
});
|
||||
}
|
||||
|
||||
const startListening = async () => {
|
||||
playSound("/Recordingstart.mp3");
|
||||
showToast(Locale.Chat.StartSpeak);
|
||||
if (speechApi) {
|
||||
await speechApi.start();
|
||||
@ -590,6 +598,7 @@ export function ChatActions(props: {
|
||||
await speechApi.stop();
|
||||
setIsListening(false);
|
||||
}
|
||||
playSound("/Recordingdone.mp3");
|
||||
document.getElementById("chat-input")?.focus();
|
||||
};
|
||||
const onRecognitionEnd = (finalTranscript: string) => {
|
||||
|
BIN
public/Recordingdone.mp3
Normal file
BIN
public/Recordingdone.mp3
Normal file
Binary file not shown.
BIN
public/Recordingstart.mp3
Normal file
BIN
public/Recordingstart.mp3
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user