wwf
3 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use client'
import type { FC } from 'react'
import React from 'react'
import type { StructuredOutput } from '../../../../../llm/types'
import Field from './field'
import { useTranslation } from 'react-i18next'
 
type Props = {
  payload: StructuredOutput
  rootClassName?: string
}
 
const ShowPanel: FC<Props> = ({
  payload,
  rootClassName,
}) => {
  const { t } = useTranslation()
  const schema = {
    ...payload,
    schema: {
      ...payload.schema,
      description: t('app.structOutput.LLMResponse'),
    },
  }
  return (
    <div className='relative left-[-7px]'>
      {Object.keys(schema.schema.properties!).map(name => (
        <Field
          key={name}
          name={name}
          payload={schema.schema.properties![name]}
          required={!!schema.schema.required?.includes(name)}
          rootClassName={rootClassName}
        />
      ))}
    </div>
  )
}
export default React.memo(ShowPanel)