Skip to content

Commit

Permalink
feat: 修复 speakAddon
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Nov 25, 2024
1 parent 3501379 commit 4b7dacc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/features/ChatItem/AvatarAddon/Assistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import TTS from './TTS';

export const AssistantAvatarAddon: RenderAvatarAddon = memo<ChatMessage>(({ content, id }) => {
const loading = useSessionStore((s) => sessionSelectors.ttsLoading(s)(id));
console.log('loading', loading);

return <TTS content={content} id={id} loading={loading} />;
});
4 changes: 2 additions & 2 deletions src/libs/messages/speakChatItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const createSpeakChatItem = () => {
});

prevFetchPromise = fetchPromise;
prevSpeakPromise = Promise.all([fetchPromise, prevSpeakPromise]).then(([audioBuffer]) => {
prevSpeakPromise = Promise.all([fetchPromise, prevSpeakPromise]).then(async ([audioBuffer]) => {
if (!audioBuffer) {
options?.onError?.(new Error('No audio buffer'));
return;
}
options?.onStart?.();
audioPlayer.play(audioBuffer, () => {
await audioPlayer.play(audioBuffer, () => {
options?.onComplete?.();
});
});
Expand Down

0 comments on commit 4b7dacc

Please sign in to comment.