'use client' 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, 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' import cn from '@/utils/classnames' import { useTranslation } from 'react-i18next' type Props = { className?: string value?: StructuredOutput onChange: (value: StructuredOutput) => void, } const StructureOutput: FC = ({ className, value, onChange, }) => { const { t } = useTranslation() const [showConfig, { setTrue: showConfigModal, setFalse: hideConfigModal, }] = useBoolean(false) const handleChange = useCallback((value: SchemaRoot) => { onChange({ schema: value, }) }, [onChange]) return (
structured_output
object
{(value?.schema && value.schema.properties && Object.keys(value.schema.properties).length > 0) ? ( ) : (
{t('app.structOutput.notConfiguredTip')}
)} {showConfig && ( )}
) } export default React.memo(StructureOutput)