Commit d993b940 by 李伟康

feat(chat): 添加语音输入功能到聊天界面

- 在输入组件中集成 VoiceInput 组件并正确渲染
- 修复 VoiceInput 组件的显示逻辑,添加条件渲染判断
- 更新 VoiceInputContext 的依赖数组以包含 setShowVoiceInput
- 确保语音输入状态变化时正确同步到消息上下文
1 parent 09f67a3a
......@@ -4,15 +4,11 @@ import { useFileOperation } from '../../hooks'
import TextInput from './text-input'
import Opration from '../operation'
import MultipleLineOperation from './multiple-line-operation'
import VoiceInput from '../voice-input'
import s from './wrapper.module.scss'
const InputWrapper: FC = () => {
const { isDragActive } = useFileOperation()
return (
// <div
// className={cn(
// 'relative z-10 rounded-xl border border-components-chat-input-border bg-[#fff] pb-[9px] shadow-md',
// isDragActive && 'border border-dashed border-components-option-card-option-selected-border',
// )}>
<div
className={cn(
s['input-wrapper'],
......@@ -23,7 +19,7 @@ const InputWrapper: FC = () => {
<TextInput>
<Opration />
</TextInput>
{/* <VoiceInput /> */}
<VoiceInput />
</div>
<MultipleLineOperation />
</div>
......
......@@ -13,7 +13,7 @@ const Voice: FC = () => {
setQuery(text)
requestAnimationFrame(handleTextareaResize)
}, [])
// if (!showVoiceInput) return null
if (!showVoiceInput) return null
setQuery('')
return <VoiceInput onCancel={() => setShowVoiceInput(false)} onConverted={onConverted} />
}
......
......@@ -25,7 +25,7 @@ export const VoiceInputProvider = ({ children }: { children: ReactNode }) => {
showVoiceInput,
setShowVoiceInput,
}),
[showVoiceInput],
[showVoiceInput, setShowVoiceInput],
)
useEffect(() => postMessage({ isRecording: showVoiceInput }), [showVoiceInput])
return <VoiceInputContext.Provider value={value}>{children}</VoiceInputContext.Provider>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!