mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-08 17:32:27 +08:00
feat: support var type paragraph
This commit is contained in:
@ -16,14 +16,22 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||
return []
|
||||
const promptVariables: PromptVariable[] = []
|
||||
useInputs.forEach((item: any) => {
|
||||
const type = item['text-input'] ? 'string' : 'select'
|
||||
const content = type === 'string' ? item['text-input'] : item.select
|
||||
if (type === 'string') {
|
||||
const isParagraph = !!item.paragraph
|
||||
const [type, content] = (() => {
|
||||
if (isParagraph)
|
||||
return ['paragraph', item.paragraph]
|
||||
|
||||
if (item['text-input'])
|
||||
return ['string', item['text-input']]
|
||||
|
||||
return ['select', item.select]
|
||||
})()
|
||||
if (type === 'string' || type === 'paragraph') {
|
||||
promptVariables.push({
|
||||
key: content.variable,
|
||||
name: content.label,
|
||||
required: content.required,
|
||||
type: 'string',
|
||||
type,
|
||||
max_length: content.max_length,
|
||||
options: [],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user