diff --git a/components/ChatInputBox/H5TemplateDrawer.tsx b/components/ChatInputBox/H5TemplateDrawer.tsx index dab09b5..b51b3a4 100644 --- a/components/ChatInputBox/H5TemplateDrawer.tsx +++ b/components/ChatInputBox/H5TemplateDrawer.tsx @@ -71,6 +71,19 @@ export const H5TemplateDrawer = ({ const [inputVisible, setInputVisible] = useState<{ [key: string]: boolean }>({}); const [isBottomExpanded, setIsBottomExpanded] = useState(true); const [isDescExpanded, setIsDescExpanded] = useState(false); + // 自由输入框布局 + const [freeInputLayout, setFreeInputLayout] = useState('bottom'); + + // 自由输入框布局 + useEffect(() => { + if (selectedTemplate?.storyRole && selectedTemplate.storyRole.length > 0 || + selectedTemplate?.storyItem && selectedTemplate.storyItem.length > 0 + ) { + setFreeInputLayout('bottom'); + } else { + setFreeInputLayout('top'); + } + }, [selectedTemplate]) useEffect(() => { if (isOpen) { @@ -488,10 +501,37 @@ export const H5TemplateDrawer = ({ {renderRoles()} {renderItems()} + {/** 自由输入文字 */} + {freeInputLayout === 'top' && selectedTemplate?.freeInput && selectedTemplate.freeInput.length > 0 && ( +