IOS safari whisper support (#2870)

* fix: variables check

* remove log

* perf: safari whisper

* feat: comment

* perf: connetion check

* doc
This commit is contained in:
Archer
2024-10-10 12:24:07 +08:00
committed by GitHub
parent 8273c96bbc
commit 13401294ad
5 changed files with 19 additions and 13 deletions

View File

@@ -286,7 +286,7 @@ const ChatInput = ({
/>
<Flex alignItems={'center'} position={'absolute'} right={[2, 4]} bottom={['10px', '12px']}>
{/* voice-input */}
{whisperConfig.open && !havInput && !isChatting && !!whisperModel && (
{whisperConfig.open && !inputValue && !isChatting && !!whisperModel && (
<>
<canvas
ref={canvasRef}

View File

@@ -23,8 +23,9 @@ export const ToolTargetHandle = ({ show, nodeId }: ToolHandleProps) => {
const connected = edges.some((edge) => edge.target === nodeId && edge.targetHandle === handleId);
// if top handle is connected, return null
const showHandle =
connected || (show && connectingEdge?.handleId === NodeOutputKeyEnum.selectedTools);
const showHandle = connectingEdge
? show && connectingEdge.handleId === NodeOutputKeyEnum.selectedTools
: connected;
const Render = useMemo(() => {
return (

View File

@@ -85,10 +85,13 @@ export const useSpeech = (props?: OutLinkChatAuthProps & { appId?: string }) =>
if (!cancelWhisperSignal.current) {
const formData = new FormData();
let options = {};
if (MediaRecorder.isTypeSupported('audio/webm')) {
options = { type: 'audio/webm' };
} else if (MediaRecorder.isTypeSupported('video/mp3')) {
options = { type: 'video/mp3' };
if (MediaRecorder.isTypeSupported('video/webm; codecs=vp9')) {
options = { mimeType: 'video/webm; codecs=vp9' };
} else if (MediaRecorder.isTypeSupported('video/webm')) {
options = { type: 'video/webm' };
} else if (MediaRecorder.isTypeSupported('video/mp4')) {
options = { mimeType: 'video/mp4', videoBitsPerSecond: 100000 };
} else {
console.error('no suitable mimetype found for this device');
}