feat/ 添加app-expo三种环境切换,待测试 调整tts

This commit is contained in:
Kevin
2026-03-19 09:58:02 +08:00
parent faf7607bf9
commit 15512834d2
12 changed files with 187 additions and 18 deletions

View File

@@ -112,6 +112,7 @@ export function useEndConversation() {
interface UseRealtimeSessionOptions {
conversationId: string;
enabled?: boolean;
onTtsAudio?: (audioBase64: string) => void;
}
const MIN_RECORDING_DURATION_SEC = 1;
@@ -136,6 +137,7 @@ interface RealtimeSessionState {
export function useRealtimeSession({
conversationId,
enabled = true,
onTtsAudio,
}: UseRealtimeSessionOptions): RealtimeSessionState {
const queryClient = useQueryClient();
const sessionRef = useRef<RealtimeSession | null>(null);
@@ -168,6 +170,7 @@ export function useRealtimeSession({
conversationId,
queryClient,
onStreamingText: handleStreamingText,
onTtsAudio,
onError: handleError,
onStateChange: setConnectionState,
});
@@ -181,7 +184,7 @@ export function useRealtimeSession({
setConnectionState('disconnected');
setStreamingMessage(null);
};
}, [conversationId, enabled, queryClient, handleStreamingText, handleError]);
}, [conversationId, enabled, queryClient, handleStreamingText, handleError, onTtsAudio]);
const sendText = useCallback(
(text: string) => {