| 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														import ErrorMessage from './error-message' | 
														 | 
														 | 
														import ErrorMessage from './error-message' | 
													
													
												
													
														 | 
														 | 
														import { useVisualEditorStore } from './visual-editor/store' | 
														 | 
														 | 
														import { useVisualEditorStore } from './visual-editor/store' | 
													
													
												
													
														 | 
														 | 
														import Toast from '@/app/components/base/toast' | 
														 | 
														 | 
														import Toast from '@/app/components/base/toast' | 
													
													
												
													
														 | 
														 | 
														import { useGetLanguage } from '@/context/i18n' | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														import { useGetDocLanguage } from '@/context/i18n' | 
													
													
												
													
														 | 
														 | 
														import { JSON_SCHEMA_MAX_DEPTH } from '@/config' | 
														 | 
														 | 
														import { JSON_SCHEMA_MAX_DEPTH } from '@/config' | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														
  | 
													
													
												
													
														 | 
														 | 
														type JsonSchemaConfigProps = { | 
														 | 
														 | 
														type JsonSchemaConfigProps = { | 
													
													
												
											
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  additionalProperties: false, | 
														 | 
														 | 
														  additionalProperties: false, | 
													
													
												
													
														 | 
														 | 
														} | 
														 | 
														 | 
														} | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														
  | 
													
													
												
													
														 | 
														 | 
														const HELP_DOC_URL = { | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  zh_Hans: 'https://docs.dify.ai/zh-hans/guides/workflow/structured-outputs', | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  en_US: 'https://docs.dify.ai/en/guides/workflow/structured-outputs', | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  ja_JP: 'https://docs.dify.ai/ja-jp/guides/workflow/structured-outputs', | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														} | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														type LocaleKey = keyof typeof HELP_DOC_URL | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														const JsonSchemaConfig: FC<JsonSchemaConfigProps> = ({ | 
														 | 
														 | 
														const JsonSchemaConfig: FC<JsonSchemaConfigProps> = ({ | 
													
													
												
													
														 | 
														 | 
														  defaultSchema, | 
														 | 
														 | 
														  defaultSchema, | 
													
													
												
													
														 | 
														 | 
														  onSave, | 
														 | 
														 | 
														  onSave, | 
													
													
												
													
														 | 
														 | 
														  onClose, | 
														 | 
														 | 
														  onClose, | 
													
													
												
													
														 | 
														 | 
														}) => { | 
														 | 
														 | 
														}) => { | 
													
													
												
													
														 | 
														 | 
														  const { t } = useTranslation() | 
														 | 
														 | 
														  const { t } = useTranslation() | 
													
													
												
													
														 | 
														 | 
														  const locale = useGetLanguage() as LocaleKey | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														  const docLanguage = useGetDocLanguage() | 
													
													
												
													
														 | 
														 | 
														  const [currentTab, setCurrentTab] = useState(SchemaView.VisualEditor) | 
														 | 
														 | 
														  const [currentTab, setCurrentTab] = useState(SchemaView.VisualEditor) | 
													
													
												
													
														 | 
														 | 
														  const [jsonSchema, setJsonSchema] = useState(defaultSchema || DEFAULT_SCHEMA) | 
														 | 
														 | 
														  const [jsonSchema, setJsonSchema] = useState(defaultSchema || DEFAULT_SCHEMA) | 
													
													
												
													
														 | 
														 | 
														  const [json, setJson] = useState(JSON.stringify(jsonSchema, null, 2)) | 
														 | 
														 | 
														  const [json, setJson] = useState(JSON.stringify(jsonSchema, null, 2)) | 
													
													
												
											
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														      <div className='flex items-center gap-x-2 p-6 pt-5'> | 
														 | 
														 | 
														      <div className='flex items-center gap-x-2 p-6 pt-5'> | 
													
													
												
													
														 | 
														 | 
														        <a | 
														 | 
														 | 
														        <a | 
													
													
												
													
														 | 
														 | 
														          className='flex grow items-center gap-x-1 text-text-accent' | 
														 | 
														 | 
														          className='flex grow items-center gap-x-1 text-text-accent' | 
													
													
												
													
														 | 
														 | 
														          href={HELP_DOC_URL[locale]} | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														          href={`https://docs.dify.ai/${docLanguage}/guides/workflow/structured-outputs`} | 
													
													
												
													
														 | 
														 | 
														          target='_blank' | 
														 | 
														 | 
														          target='_blank' | 
													
													
												
													
														 | 
														 | 
														          rel='noopener noreferrer' | 
														 | 
														 | 
														          rel='noopener noreferrer' | 
													
													
												
													
														 | 
														 | 
														        > | 
														 | 
														 | 
														        > |