mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 18:15:53 +08:00
Merge branch 'feat/mcp-frontend' into deploy/dev
This commit is contained in:
commit
c27af0dd7d
@ -143,9 +143,9 @@ const ReasoningConfigForm: React.FC<Props> = ({
|
||||
}] = useBoolean(false)
|
||||
|
||||
const [schema, setSchema] = useState<SchemaRoot | null>(null)
|
||||
console.log(schema)
|
||||
const [schemaRootName, setSchemaRootName] = useState<string>('')
|
||||
|
||||
const renderField = (schema: any, showSchema: (schema: SchemaRoot) => void) => {
|
||||
const renderField = (schema: any, showSchema: (schema: SchemaRoot, rootName: string) => void) => {
|
||||
const {
|
||||
variable,
|
||||
label,
|
||||
@ -205,7 +205,7 @@ const ReasoningConfigForm: React.FC<Props> = ({
|
||||
asChild={false}>
|
||||
<div
|
||||
className='ml-0.5 cursor-pointer rounded-[4px] p-px text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary'
|
||||
onClick={() => showSchema(input_schema as SchemaRoot)}
|
||||
onClick={() => showSchema(input_schema as SchemaRoot, label[language] || label.en_US)}
|
||||
>
|
||||
<RiBracesLine className='size-3.5'/>
|
||||
</div>
|
||||
@ -318,14 +318,16 @@ const ReasoningConfigForm: React.FC<Props> = ({
|
||||
}
|
||||
return (
|
||||
<div className='space-y-3 px-4 py-2'>
|
||||
{!isShowSchema && schemas.map(schema => renderField(schema, (s: SchemaRoot) => {
|
||||
{!isShowSchema && schemas.map(schema => renderField(schema, (s: SchemaRoot, rootName: string) => {
|
||||
setSchema(s)
|
||||
setSchemaRootName(rootName)
|
||||
showSchema()
|
||||
}))}
|
||||
{isShowSchema && (
|
||||
<SchemaModal
|
||||
isShow={isShowSchema}
|
||||
schema={schema!}
|
||||
rootName={schemaRootName}
|
||||
onClose={hideSchema}
|
||||
/>
|
||||
)}
|
||||
|
@ -11,12 +11,14 @@ import { RiCloseLine } from '@remixicon/react'
|
||||
type Props = {
|
||||
isShow: boolean
|
||||
schema: SchemaRoot
|
||||
rootName: string
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
const SchemaModal: FC<Props> = ({
|
||||
isShow,
|
||||
schema,
|
||||
rootName,
|
||||
onClose,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
@ -43,6 +45,7 @@ const SchemaModal: FC<Props> = ({
|
||||
<VisualEditorContextProvider>
|
||||
<VisualEditor
|
||||
schema={schema}
|
||||
rootName={rootName}
|
||||
readOnly
|
||||
></VisualEditor>
|
||||
</VisualEditorContextProvider>
|
||||
|
@ -5,6 +5,7 @@ import { useSchemaNodeOperations } from './hooks'
|
||||
|
||||
export type VisualEditorProps = {
|
||||
schema: SchemaRoot
|
||||
rootName?: string
|
||||
readOnly?: boolean
|
||||
onChange?: (schema: SchemaRoot) => void
|
||||
}
|
||||
@ -16,7 +17,7 @@ const VisualEditor: FC<VisualEditorProps> = (props) => {
|
||||
return (
|
||||
<div className='h-full overflow-auto rounded-xl bg-background-section-burn p-1 pl-2'>
|
||||
<SchemaNode
|
||||
name='structured_output'
|
||||
name={props.rootName || 'structured_output'}
|
||||
schema={schema}
|
||||
required={false}
|
||||
path={[]}
|
||||
|
Loading…
x
Reference in New Issue
Block a user