mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-08 17:32:27 +08:00
feat: lint code
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { PromptVariable, UserInputFormItem } from '@/types/app'
|
||||
import type { PromptVariable, UserInputFormItem } from '@/types/app'
|
||||
|
||||
export function replaceVarWithValues(str: string, promptVariables: PromptVariable[], inputs: Record<string, any>) {
|
||||
return str.replace(/\{\{([^}]+)\}\}/g, (match, key) => {
|
||||
@ -12,11 +12,12 @@ export function replaceVarWithValues(str: string, promptVariables: PromptVariabl
|
||||
}
|
||||
|
||||
export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] | null) => {
|
||||
if (!useInputs) return []
|
||||
if (!useInputs)
|
||||
return []
|
||||
const promptVariables: PromptVariable[] = []
|
||||
useInputs.forEach((item: any) => {
|
||||
const type = item['text-input'] ? 'string' : 'select'
|
||||
const content = type === 'string' ? item['text-input'] : item['select']
|
||||
const content = type === 'string' ? item['text-input'] : item.select
|
||||
if (type === 'string') {
|
||||
promptVariables.push({
|
||||
key: content.variable,
|
||||
@ -26,7 +27,8 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||
max_length: content.max_length,
|
||||
options: [],
|
||||
})
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
promptVariables.push({
|
||||
key: content.variable,
|
||||
name: content.label,
|
||||
@ -37,4 +39,4 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||
}
|
||||
})
|
||||
return promptVariables
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user