Browse Source

fix: webapps not show number type input field (#4292)

tags/0.6.8
Joel 1 year ago
parent
commit
34d3998566
No account linked to committer's email address

+ 11
- 0
web/app/components/base/chat/chat-with-history/config-panel/form.tsx View File

/> />
) )
} }
if (form.type === 'number') {
return (
<input
className="grow h-9 rounded-lg bg-gray-100 px-2.5 outline-none appearance-none"
type="number"
value={newConversationInputs[variable] || ''}
onChange={e => handleFormChange(variable, e.target.value)}
placeholder={`${label}${!required ? `(${t('appDebug.variableTable.optional')})` : ''}`}
/>
)
}


return ( return (
<PortalSelect <PortalSelect

+ 9
- 2
web/app/components/base/chat/chat-with-history/hooks.tsx View File

setNewConversationInputs(newInputs) setNewConversationInputs(newInputs)
}, []) }, [])
const inputsForms = useMemo(() => { const inputsForms = useMemo(() => {
return (appParams?.user_input_form || []).filter((item: any) => item.paragraph || item.select || item['text-input']).map((item: any) => {
return (appParams?.user_input_form || []).filter((item: any) => item.paragraph || item.select || item['text-input'] || item.number).map((item: any) => {
if (item.paragraph) { if (item.paragraph) {
return { return {
...item.paragraph, ...item.paragraph,
type: 'paragraph', type: 'paragraph',
} }
} }
if (item.number) {
return {
...item.number,
type: 'number',
}
}
if (item.select) { if (item.select) {
return { return {
...item.select, ...item.select,
type: 'select', type: 'select',
} }
} }

return { return {
...item['text-input'], ...item['text-input'],
type: 'text-input', type: 'text-input',
setShowNewConversationItemInList(true) setShowNewConversationItemInList(true)
} }
}, [setShowConfigPanelBeforeChat, setShowNewConversationItemInList, checkInputsRequired]) }, [setShowConfigPanelBeforeChat, setShowNewConversationItemInList, checkInputsRequired])
const currentChatInstanceRef = useRef<{ handleStop: () => void }>({ handleStop: () => {} })
const currentChatInstanceRef = useRef<{ handleStop: () => void }>({ handleStop: () => { } })
const handleChangeConversation = useCallback((conversationId: string) => { const handleChangeConversation = useCallback((conversationId: string) => {
currentChatInstanceRef.current.handleStop() currentChatInstanceRef.current.handleStop()
setNewConversationId('') setNewConversationId('')

Loading…
Cancel
Save