mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 17:38:04 +08:00
Merge branch 'plugins/beta' into dev/plugin-deploy
This commit is contained in:
@ -4,7 +4,7 @@ import React from 'react'
|
||||
import { RiAlignLeft, RiCheckboxMultipleLine, RiFileCopy2Line, RiFileList2Line, RiHashtag, RiTextSnippet } from '@remixicon/react'
|
||||
import { InputVarType } from '../../../types'
|
||||
|
||||
interface Props {
|
||||
type Props = {
|
||||
className?: string
|
||||
type: InputVarType
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ const ConstantField: FC<Props> = ({
|
||||
const language = useLanguage()
|
||||
const placeholder = (schema as CredentialFormSchemaSelect).placeholder
|
||||
const handleStaticChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const value = e.target.value === '' ? '' : parseFloat(e.target.value)
|
||||
const value = e.target.value === '' ? '' : Number.parseFloat(e.target.value)
|
||||
onChange(value, VarKindType.constant)
|
||||
}, [onChange])
|
||||
const handleSelectChange = useCallback((value: string | number) => {
|
||||
@ -39,6 +39,7 @@ const ConstantField: FC<Props> = ({
|
||||
wrapperClassName='w-full !h-8'
|
||||
className='flex items-center'
|
||||
disabled={readonly}
|
||||
defaultValue={value}
|
||||
items={(schema as CredentialFormSchemaSelect).options.map(option => ({ value: option.value, name: option.label[language] || option.label.en_US }))}
|
||||
onSelect={item => handleSelectChange(item.value)}
|
||||
placeholder={placeholder?.[language] || placeholder?.en_US}
|
||||
|
||||
@ -48,6 +48,7 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
|
||||
runInputData,
|
||||
setRunInputData,
|
||||
varInputs,
|
||||
outputSchema,
|
||||
} = useConfig(props.id, props.data)
|
||||
const { t } = useTranslation()
|
||||
const nodeInfo = useMemo(() => {
|
||||
@ -121,12 +122,12 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
|
||||
type='Array[Object]'
|
||||
description={t(`${i18nPrefix}.outputVars.json`)}
|
||||
/>
|
||||
{inputs.output_schema && Object.entries(inputs.output_schema).map(([name, schema]) => (
|
||||
{outputSchema.map(({ name, type, description }) => (
|
||||
<VarItem
|
||||
key={name}
|
||||
name={name}
|
||||
type={schema.type}
|
||||
description={schema.description}
|
||||
type={type}
|
||||
description={description}
|
||||
/>
|
||||
))}
|
||||
</OutputVars>
|
||||
|
||||
@ -158,6 +158,23 @@ const useConfig = (id: string, payload: AgentNodeType) => {
|
||||
return vars
|
||||
})()
|
||||
|
||||
const outputSchema = useMemo(() => {
|
||||
const res: any[] = []
|
||||
if (!inputs.output_schema)
|
||||
return []
|
||||
Object.keys(inputs.output_schema.properties).forEach((outputKey) => {
|
||||
const output = inputs.output_schema.properties[outputKey]
|
||||
res.push({
|
||||
name: outputKey,
|
||||
type: output.type === 'array'
|
||||
? `Array[${output.items?.type.slice(0, 1).toLocaleUpperCase()}${output.items?.type.slice(1)}]`
|
||||
: `${output.type.slice(0, 1).toLocaleUpperCase()}${output.type.slice(1)}`,
|
||||
description: output.description,
|
||||
})
|
||||
})
|
||||
return res
|
||||
}, [inputs.output_schema])
|
||||
|
||||
return {
|
||||
readOnly,
|
||||
inputs,
|
||||
@ -184,6 +201,7 @@ const useConfig = (id: string, payload: AgentNodeType) => {
|
||||
setRunInputData,
|
||||
runResult,
|
||||
varInputs,
|
||||
outputSchema,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -167,6 +167,9 @@ export const getMultipleRetrievalConfig = (
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
result.reranking_enable = true
|
||||
}
|
||||
}
|
||||
|
||||
if (allHighQuality && !inconsistentEmbeddingModel && allInternal) {
|
||||
@ -205,13 +208,6 @@ export const getMultipleRetrievalConfig = (
|
||||
result.reranking_mode = RerankingModeEnum.WeightedScore
|
||||
setDefaultWeights()
|
||||
}
|
||||
if (reranking_mode === RerankingModeEnum.RerankingModel && rerankModelIsValid) {
|
||||
result.reranking_enable = true
|
||||
result.reranking_model = {
|
||||
provider: validRerankModel.provider || '',
|
||||
model: validRerankModel.model || '',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user