Merge branch 'feat/llm-struct-output' of https://github.com/langgenius/dify into feat/llm-struct-output

This commit is contained in:
twwu 2025-03-17 18:36:48 +08:00
commit d7fcba91eb
4 changed files with 7 additions and 22 deletions

View File

@ -10,7 +10,6 @@ import Slider from '@/app/components/base/slider'
import Radio from '@/app/components/base/radio'
import { SimpleSelect } from '@/app/components/base/select'
import TagInput from '@/app/components/base/tag-input'
import Badge from '@/app/components/base/badge'
import { useTranslation } from 'react-i18next'
export type ParameterValue = number | string | string[] | boolean | undefined
@ -281,19 +280,6 @@ const ParameterItem: FC<ParameterItemProps> = ({
/>
)
}
{/* TODO: wait api return and product design */}
{parameterRule.name === 'json_schema' && (
<Tooltip
popupContent={(
<div className='w-[232px]'>
<div className='mb-1 body-xs-regular text-text-secondary'>{t('app.structOutput.legacyTip')}</div>
<a className='' target='_blank' href='https://todo'>{t('app.structOutput.learnMore')}</a>
</div>
)}
>
<Badge uppercase className='text-text-accent-secondary'>{t('app.structOutput.legacy')}</Badge>
</Tooltip>
)}
</div>
{
parameterRule.type === 'tag' && (

View File

@ -3,7 +3,7 @@ import Button from '@/app/components/base/button'
import { RiEditLine } from '@remixicon/react'
import type { FC } from 'react'
import React, { useCallback } from 'react'
import type { SchemaRoot, StructuredOutput } from '../types'
import { type SchemaRoot, type StructuredOutput, Type } from '../types'
import ShowPanel from '@/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show'
import { useBoolean } from 'ahooks'
import JsonSchemaConfigModal from './json-schema-config-modal'
@ -59,7 +59,12 @@ const StructureOutput: FC<Props> = ({
{showConfig && (
<JsonSchemaConfigModal
isShow
defaultSchema={(value?.schema || {}) as any} // wait for types change
defaultSchema={(value?.schema || {
type: Type.object,
properties: {},
required: [],
additionalProperties: false,
}) as any} // wait for types change
onSave={handleChange as any} // wait for types change
onClose={hideConfigModal}
/>

View File

@ -190,9 +190,6 @@ const translation = {
structuredTip: 'Structured Outputs is a feature that ensures the model will always generate responses that adhere to your supplied JSON Schema',
modelNotSupported: 'Model not supported',
modelNotSupportedTip: 'The current model does not support this feature and is automatically downgraded to prompt injection.',
legacy: 'Legacy',
legacyTip: 'JSON Schema will be removed from model parameters, you can use the structured output functionality under nodes instead.',
learnMore: 'Learn more',
},
}

View File

@ -191,9 +191,6 @@ const translation = {
structuredTip: '结构化输出是一项功能,可确保模型始终生成符合您提供的 JSON 模式的响应',
modelNotSupported: '模型不支持',
modelNotSupportedTip: '当前模型不支持此功能,将自动降级为提示注入。',
legacy: '遗留',
legacyTip: '此功能将在未来版本中删除',
learnMore: '了解更多',
},
}