From b7f703852ec3249b03354d6c4b006a5c934298a3 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 4 Sep 2024 17:51:22 +0800 Subject: [PATCH 1/2] 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, From ac0e3e807d09fa6c40c68905e9d198d66091df87 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 4 Sep 2024 17:55:45 +0800 Subject: [PATCH 2/2] chore: paragrpah form type --- types/app.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/app.ts b/types/app.ts index 5040d2d..3d62c4f 100644 --- a/types/app.ts +++ b/types/app.ts @@ -37,6 +37,8 @@ export type UserInputFormItem = { 'text-input': TextTypeFormItem } | { 'select': SelectTypeFormItem +} | { + 'paragraph': TextTypeFormItem } export const MessageRatings = ['like', 'dislike', null] as const