add image input (#486)

* add image input

* use json
This commit is contained in:
heheer
2023-11-17 18:22:29 +08:00
committed by GitHub
parent af16817a4a
commit 70f3373246
9 changed files with 181 additions and 28 deletions

View File

@@ -12,7 +12,7 @@ export const useSpeech = (props?: { shareId?: string }) => {
const { toast } = useToast();
const [isSpeaking, setIsSpeaking] = useState(false);
const [isTransCription, setIsTransCription] = useState(false);
const [audioSecond, setAudioSecone] = useState(0);
const [audioSecond, setAudioSecond] = useState(0);
const intervalRef = useRef<any>();
const startTimestamp = useRef(0);
@@ -59,11 +59,11 @@ export const useSpeech = (props?: { shareId?: string }) => {
mediaRecorder.current.onstart = () => {
startTimestamp.current = Date.now();
setAudioSecone(0);
setAudioSecond(0);
intervalRef.current = setInterval(() => {
const currentTimestamp = Date.now();
const duration = (currentTimestamp - startTimestamp.current) / 1000;
setAudioSecone(duration);
setAudioSecond(duration);
}, 1000);
};