|
|
|
@ -22,6 +22,7 @@ import type { VisionFile, VisionSettings } from '@/types/app'
|
|
|
|
import { DEFAULT_VALUE_MAX_LEN } from '@/config'
|
|
|
|
import { DEFAULT_VALUE_MAX_LEN } from '@/config'
|
|
|
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
|
|
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
|
|
|
|
import BoolInput from '@/app/components/workflow/nodes/_base/components/before-run-form/bool-input'
|
|
|
|
|
|
|
|
|
|
|
|
export type IPromptValuePanelProps = {
|
|
|
|
export type IPromptValuePanelProps = {
|
|
|
|
appType: AppType
|
|
|
|
appType: AppType
|
|
|
|
@ -66,7 +67,7 @@ const PromptValuePanel: FC<IPromptValuePanelProps> = ({
|
|
|
|
else { return !modelConfig.configs.prompt_template }
|
|
|
|
else { return !modelConfig.configs.prompt_template }
|
|
|
|
}, [chatPromptConfig.prompt, completionPromptConfig.prompt?.text, isAdvancedMode, mode, modelConfig.configs.prompt_template, modelModeType])
|
|
|
|
}, [chatPromptConfig.prompt, completionPromptConfig.prompt?.text, isAdvancedMode, mode, modelConfig.configs.prompt_template, modelModeType])
|
|
|
|
|
|
|
|
|
|
|
|
const handleInputValueChange = (key: string, value: string) => {
|
|
|
|
const handleInputValueChange = (key: string, value: string | boolean) => {
|
|
|
|
if (!(key in promptVariableObj))
|
|
|
|
if (!(key in promptVariableObj))
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
@ -109,10 +110,12 @@ const PromptValuePanel: FC<IPromptValuePanelProps> = ({
|
|
|
|
className='mb-4 last-of-type:mb-0'
|
|
|
|
className='mb-4 last-of-type:mb-0'
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
|
|
|
|
{type !== 'boolean' && (
|
|
|
|
<div className='system-sm-semibold mb-1 flex h-6 items-center gap-1 text-text-secondary'>
|
|
|
|
<div className='system-sm-semibold mb-1 flex h-6 items-center gap-1 text-text-secondary'>
|
|
|
|
<div className='truncate'>{name || key}</div>
|
|
|
|
<div className='truncate'>{name || key}</div>
|
|
|
|
{!required && <span className='system-xs-regular text-text-tertiary'>{t('workflow.panel.optional')}</span>}
|
|
|
|
{!required && <span className='system-xs-regular text-text-tertiary'>{t('workflow.panel.optional')}</span>}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)}
|
|
|
|
<div className='grow'>
|
|
|
|
<div className='grow'>
|
|
|
|
{type === 'string' && (
|
|
|
|
{type === 'string' && (
|
|
|
|
<Input
|
|
|
|
<Input
|
|
|
|
@ -151,6 +154,14 @@ const PromptValuePanel: FC<IPromptValuePanelProps> = ({
|
|
|
|
maxLength={max_length || DEFAULT_VALUE_MAX_LEN}
|
|
|
|
maxLength={max_length || DEFAULT_VALUE_MAX_LEN}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
|
|
|
|
{type === 'boolean' && (
|
|
|
|
|
|
|
|
<BoolInput
|
|
|
|
|
|
|
|
name={name || key}
|
|
|
|
|
|
|
|
value={!!inputs[key]}
|
|
|
|
|
|
|
|
required={required}
|
|
|
|
|
|
|
|
onChange={(value) => { handleInputValueChange(key, value) }}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|