Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

advanced-mode-waring.tsx 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import { useTranslation } from 'react-i18next'
  5. import { useContext } from 'use-context-selector'
  6. import I18n from '@/context/i18n'
  7. import { FlipBackward } from '@/app/components/base/icons/src/vender/line/arrows'
  8. import { LanguagesSupported } from '@/i18n/language'
  9. type Props = {
  10. onReturnToSimpleMode: () => void
  11. }
  12. const AdvancedModeWarning: FC<Props> = ({
  13. onReturnToSimpleMode,
  14. }) => {
  15. const { t } = useTranslation()
  16. const { locale } = useContext(I18n)
  17. const [show, setShow] = React.useState(true)
  18. if (!show)
  19. return null
  20. return (
  21. <div className='mb-3 py-3 px-4 border border-[#FEF0C7] rounded-xl bg-[#FFFAEB]' >
  22. <div className='mb-2 text-xs leading-[18px] font-bold text-[#DC6803]'>{t('appDebug.promptMode.advancedWarning.title')}</div>
  23. <div className='flex justify-between items-center'>
  24. <div className='text-xs leading-[18px] '>
  25. <span className='text-gray-700'>{t('appDebug.promptMode.advancedWarning.description')}</span>
  26. <a
  27. className='font-medium text-[#155EEF]'
  28. href={`https://docs.dify.ai/${locale === LanguagesSupported[1] ? 'v/zh-hans/guides/application-design/prompt-engineering' : 'features/prompt-engineering'}`}
  29. target='_blank' rel='noopener noreferrer'
  30. >
  31. {t('appDebug.promptMode.advancedWarning.learnMore')}
  32. </a>
  33. </div>
  34. <div className='flex items-center space-x-1'>
  35. <div
  36. onClick={onReturnToSimpleMode}
  37. className='shrink-0 flex items-center h-6 px-2 bg-indigo-600 shadow-xs border border-gray-200 rounded-lg text-white text-xs font-semibold cursor-pointer space-x-1'
  38. >
  39. <FlipBackward className='w-3 h-3 text-white' />
  40. <div className='text-xs font-semibold uppercase'>{t('appDebug.promptMode.switchBack')}</div>
  41. </div>
  42. <div
  43. className='flex items-center h-6 px-2 rounded-md bg-[#fff] border border-gray-200 shadow-xs text-xs font-medium text-primary-600 cursor-pointer'
  44. onClick={() => setShow(false)}
  45. >{t('appDebug.promptMode.advancedWarning.ok')}</div>
  46. </div>
  47. </div>
  48. </div>
  49. )
  50. }
  51. export default React.memo(AdvancedModeWarning)