basic-content.tsx 638 B

12345678910111213141516171819202122232425262728293031
  1. import type { FC } from 'react'
  2. import { memo } from 'react'
  3. import type { ChatItem } from '../../types'
  4. import { Markdown } from '@/app/components/base/markdown'
  5. import cn from '@/utils/classnames'
  6. type BasicContentProps = {
  7. item: ChatItem
  8. }
  9. const BasicContent: FC<BasicContentProps> = ({
  10. item,
  11. }) => {
  12. const {
  13. annotation,
  14. content,
  15. } = item
  16. if (annotation?.logAnnotation)
  17. return <Markdown content={annotation?.logAnnotation.content || ''} />
  18. return (
  19. <Markdown
  20. className={cn(
  21. item.isError && '!text-[#F04438]',
  22. )}
  23. content={content}
  24. />
  25. )
  26. }
  27. export default memo(BasicContent)