From b7f703852ec3249b03354d6c4b006a5c934298a3 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 4 Sep 2024 17:51:22 +0800 Subject: [PATCH] fix: not support num input --- app/components/welcome/index.tsx | 9 +++++++++ utils/prompt.ts | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/app/components/welcome/index.tsx b/app/components/welcome/index.tsx index a746fef..4edc25b 100644 --- a/app/components/welcome/index.tsx +++ b/app/components/welcome/index.tsx @@ -122,6 +122,15 @@ const Welcome: FC = ({ onChange={(e) => { setInputs({ ...inputs, [item.key]: e.target.value }) }} /> )} + {item.type === 'number' && ( + { onInputsChange({ ...inputs, [item.key]: e.target.value }) }} + /> + )} ))} diff --git a/utils/prompt.ts b/utils/prompt.ts index d851ea0..fc11182 100644 --- a/utils/prompt.ts +++ b/utils/prompt.ts @@ -24,8 +24,12 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] | if (item['text-input']) return ['string', item['text-input']] + if (item.number) + return ['number', item.number] + return ['select', item.select] })() + if (type === 'string' || type === 'paragraph') { promptVariables.push({ key: content.variable, @@ -36,6 +40,15 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] | options: [], }) } + else if (type === 'number') { + promptVariables.push({ + key: content.variable, + name: content.label, + required: content.required, + type, + options: [], + }) + } else { promptVariables.push({ key: content.variable,