Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: crazywoola <427733928@qq.com>tags/0.5.3
| en_US: How to integrate with Ollama | en_US: How to integrate with Ollama | ||||
| zh_Hans: 如何集成 Ollama | zh_Hans: 如何集成 Ollama | ||||
| url: | url: | ||||
| en_US: https://docs.dify.ai/advanced/model-configuration/ollama | |||||
| en_US: https://docs.dify.ai/tutorials/model-configuration/ollama | |||||
| supported_model_types: | supported_model_types: | ||||
| - llm | - llm | ||||
| - text-embedding | - text-embedding |
| import DatasetDetailContext from '@/context/dataset-detail' | import DatasetDetailContext from '@/context/dataset-detail' | ||||
| import { DataSourceType } from '@/models/datasets' | import { DataSourceType } from '@/models/datasets' | ||||
| import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' | import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' | ||||
| import { LanguagesSupported, getModelRuntimeSupported } from '@/utils/language' | |||||
| export type IAppDetailLayoutProps = { | export type IAppDetailLayoutProps = { | ||||
| children: React.ReactNode | children: React.ReactNode | ||||
| const ExtraInfo = ({ isMobile, relatedApps }: IExtraInfoProps) => { | const ExtraInfo = ({ isMobile, relatedApps }: IExtraInfoProps) => { | ||||
| const locale = getLocaleOnClient() | const locale = getLocaleOnClient() | ||||
| const language = getModelRuntimeSupported(locale) | |||||
| const [isShowTips, { toggle: toggleTips, set: setShowTips }] = useBoolean(!isMobile) | const [isShowTips, { toggle: toggleTips, set: setShowTips }] = useBoolean(!isMobile) | ||||
| const { t } = useTranslation() | const { t } = useTranslation() | ||||
| <div className='text-xs text-gray-500 mt-2'>{t('common.datasetMenus.emptyTip')}</div> | <div className='text-xs text-gray-500 mt-2'>{t('common.datasetMenus.emptyTip')}</div> | ||||
| <a | <a | ||||
| className='inline-flex items-center text-xs text-primary-600 mt-2 cursor-pointer' | className='inline-flex items-center text-xs text-primary-600 mt-2 cursor-pointer' | ||||
| href={`https://docs.dify.ai/${locale === 'zh-Hans' ? 'v/zh-hans' : ''}/application/prompt-engineering`} | |||||
| href={ | |||||
| language === LanguagesSupported[1] | |||||
| ? 'https://docs.dify.ai/v/zh-hans/guides/application-design/prompt-engineering' | |||||
| : 'https://docs.dify.ai/user-guide/creating-dify-apps/prompt-engineering' | |||||
| } | |||||
| target='_blank' | target='_blank' | ||||
| > | > | ||||
| <BookOpenIcon className='mr-1' /> | <BookOpenIcon className='mr-1' /> |
| <Link | <Link | ||||
| className='text-primary-600' | className='text-primary-600' | ||||
| target={'_blank'} | target={'_blank'} | ||||
| href={`https://docs.dify.ai/${language !== LanguagesSupportedUnderscore[1] ? '' : `v/${locale.toLowerCase()}`}/community/open-source`} | |||||
| href={`https://docs.dify.ai/${language !== LanguagesSupportedUnderscore[1] ? 'user-agreement' : `v/${locale.toLowerCase()}/policies`}/open-source`} | |||||
| >{t('login.license.link')}</Link> | >{t('login.license.link')}</Link> | ||||
| </div> | </div> | ||||
| </div> | </div> |
| import Panel from '@/app/components/app/configuration/base/feature-panel' | import Panel from '@/app/components/app/configuration/base/feature-panel' | ||||
| import { MessageClockCircle } from '@/app/components/base/icons/src/vender/solid/general' | import { MessageClockCircle } from '@/app/components/base/icons/src/vender/solid/general' | ||||
| import I18n from '@/context/i18n' | import I18n from '@/context/i18n' | ||||
| import { LanguagesSupported, getModelRuntimeSupported } from '@/utils/language' | |||||
| type Props = { | type Props = { | ||||
| showWarning: boolean | showWarning: boolean | ||||
| }) => { | }) => { | ||||
| const { t } = useTranslation() | const { t } = useTranslation() | ||||
| const { locale } = useContext(I18n) | const { locale } = useContext(I18n) | ||||
| const language = getModelRuntimeSupported(locale) | |||||
| return ( | return ( | ||||
| <Panel | <Panel | ||||
| > | > | ||||
| {showWarning && ( | {showWarning && ( | ||||
| <div className='flex justify-between py-2 px-3 rounded-b-xl bg-[#FFFAEB] text-xs text-gray-700'> | <div className='flex justify-between py-2 px-3 rounded-b-xl bg-[#FFFAEB] text-xs text-gray-700'> | ||||
| <div>{t('appDebug.feature.conversationHistory.tip')} <a href={`https://docs.dify.ai/${locale === 'zh-Hans' ? 'v/zh-hans/' : ''}advanced/prompt-engineering`} target='_blank' className='text-[#155EEF]'>{t('appDebug.feature.conversationHistory.learnMore')}</a></div> | |||||
| <div>{t('appDebug.feature.conversationHistory.tip')} | |||||
| <a href={`${language === LanguagesSupported[1] | |||||
| ? 'https://docs.dify.ai/v/zh-hans/guides/application-design/prompt-engineering' | |||||
| : 'https://docs.dify.ai/features/prompt-engineering'}`} | |||||
| target='_blank' | |||||
| className='text-[#155EEF]'>{t('appDebug.feature.conversationHistory.learnMore')} | |||||
| </a> | |||||
| </div> | |||||
| </div> | </div> | ||||
| )} | )} | ||||
| </Panel> | </Panel> |
| className='block px-3 py-2 w-full h-[88px] rounded-lg bg-gray-100 text-sm outline-none appearance-none resize-none' | className='block px-3 py-2 w-full h-[88px] rounded-lg bg-gray-100 text-sm outline-none appearance-none resize-none' | ||||
| placeholder={t('datasetSettings.form.descPlaceholder') || ''} | placeholder={t('datasetSettings.form.descPlaceholder') || ''} | ||||
| /> | /> | ||||
| <a className='mt-2 flex items-center h-[18px] px-3 text-xs text-gray-500' href="https://docs.dify.ai/advanced/datasets#how-to-write-a-good-dataset-description" target='_blank'> | |||||
| <a className='mt-2 flex items-center h-[18px] px-3 text-xs text-gray-500' href="https://docs.dify.ai/features/datasets#how-to-write-a-good-dataset-description" target='_blank'> | |||||
| <BookOpenIcon className='w-3 h-[18px] mr-1' /> | <BookOpenIcon className='w-3 h-[18px] mr-1' /> | ||||
| {t('datasetSettings.form.descWrite')} | {t('datasetSettings.form.descWrite')} | ||||
| </a> | </a> | ||||
| <div> | <div> | ||||
| <div>{t('datasetSettings.form.retrievalSetting.title')}</div> | <div>{t('datasetSettings.form.retrievalSetting.title')}</div> | ||||
| <div className='leading-[18px] text-xs font-normal text-gray-500'> | <div className='leading-[18px] text-xs font-normal text-gray-500'> | ||||
| <a target='_blank' href='https://docs.dify.ai/advanced/retrieval-augment' className='text-[#155eef]'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| <a target='_blank' href='https://docs.dify.ai/features/retrieval-augment' className='text-[#155eef]'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| {t('datasetSettings.form.retrievalSetting.description')} | {t('datasetSettings.form.retrievalSetting.description')} | ||||
| </div> | </div> | ||||
| </div> | </div> |
| import { useContext } from 'use-context-selector' | import { useContext } from 'use-context-selector' | ||||
| import I18n from '@/context/i18n' | import I18n from '@/context/i18n' | ||||
| import { FlipBackward } from '@/app/components/base/icons/src/vender/line/arrows' | import { FlipBackward } from '@/app/components/base/icons/src/vender/line/arrows' | ||||
| import { LanguagesSupported, getModelRuntimeSupported } from '@/utils/language' | |||||
| type Props = { | type Props = { | ||||
| onReturnToSimpleMode: () => void | onReturnToSimpleMode: () => void | ||||
| } | } | ||||
| }) => { | }) => { | ||||
| const { t } = useTranslation() | const { t } = useTranslation() | ||||
| const { locale } = useContext(I18n) | const { locale } = useContext(I18n) | ||||
| const language = getModelRuntimeSupported(locale) | |||||
| const [show, setShow] = React.useState(true) | const [show, setShow] = React.useState(true) | ||||
| if (!show) | if (!show) | ||||
| return null | return null | ||||
| <span className='text-gray-700'>{t('appDebug.promptMode.advancedWarning.description')}</span> | <span className='text-gray-700'>{t('appDebug.promptMode.advancedWarning.description')}</span> | ||||
| <a | <a | ||||
| className='font-medium text-[#155EEF]' | className='font-medium text-[#155EEF]' | ||||
| href={`https://docs.dify.ai/${locale === 'zh-Hans' ? 'v/zh-hans/' : ''}advanced/prompt-engineering`} | |||||
| href={`https://docs.dify.ai/${language === LanguagesSupported[1] ? 'v/zh-hans/guides/application-design/prompt-engineering' : 'features/prompt-engineering'}`} | |||||
| target='_blank' | target='_blank' | ||||
| > | > | ||||
| {t('appDebug.promptMode.advancedWarning.learnMore')} | {t('appDebug.promptMode.advancedWarning.learnMore')} |
| <p className='mt-2 text-base font-medium text-gray-800'>{t(`${prefixCustomize}.way2.name`)}</p> | <p className='mt-2 text-base font-medium text-gray-800'>{t(`${prefixCustomize}.way2.name`)}</p> | ||||
| <Button | <Button | ||||
| className='w-36 mt-2' | className='w-36 mt-2' | ||||
| onClick={() => window.open(`https://docs.dify.ai/${language !== LanguagesSupportedUnderscore[1] ? '' : `v/${locale.toLowerCase()}`}/application/developing-with-apis`, '_blank')} | |||||
| onClick={() => | |||||
| window.open( | |||||
| `https://docs.dify.ai/${ | |||||
| language !== LanguagesSupportedUnderscore[1] | |||||
| ? 'user-guide/launching-dify-apps/developing-with-apis' | |||||
| : `v/${locale.toLowerCase()}/guides/application-publishing/developing-with-apis` | |||||
| }`, | |||||
| '_blank', | |||||
| ) | |||||
| } | |||||
| > | > | ||||
| <span className='text-sm text-gray-800'>{t(`${prefixCustomize}.way2.operation`)}</span> | <span className='text-sm text-gray-800'>{t(`${prefixCustomize}.way2.operation`)}</span> | ||||
| <ArrowTopRightOnSquareIcon className='w-4 h-4 ml-1 text-gray-800 shrink-0' /> | <ArrowTopRightOnSquareIcon className='w-4 h-4 ml-1 text-gray-800 shrink-0' /> |
| <div className={s.label}> | <div className={s.label}> | ||||
| {t('datasetSettings.form.retrievalSetting.title')} | {t('datasetSettings.form.retrievalSetting.title')} | ||||
| <div className='leading-[18px] text-xs font-normal text-gray-500'> | <div className='leading-[18px] text-xs font-normal text-gray-500'> | ||||
| <a target='_blank' href='https://docs.dify.ai/advanced/retrieval-augment' className='text-[#155eef]'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| <a target='_blank' href='https://docs.dify.ai/features/retrieval-augment' className='text-[#155eef]'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| {t('datasetSettings.form.retrievalSetting.longDescription')} | {t('datasetSettings.form.retrievalSetting.longDescription')} | ||||
| </div> | </div> | ||||
| </div> | </div> |
| <div className='text-base font-semibold text-gray-900'> | <div className='text-base font-semibold text-gray-900'> | ||||
| <div>{t('datasetSettings.form.retrievalSetting.title')}</div> | <div>{t('datasetSettings.form.retrievalSetting.title')}</div> | ||||
| <div className='leading-[18px] text-xs font-normal text-gray-500'> | <div className='leading-[18px] text-xs font-normal text-gray-500'> | ||||
| <a target='_blank' href='https://docs.dify.ai/advanced/retrieval-augment' className='text-[#155eef]'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| <a target='_blank' href='https://docs.dify.ai/features/retrieval-augment' className='text-[#155eef]'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| {t('datasetSettings.form.retrievalSetting.description')} | {t('datasetSettings.form.retrievalSetting.description')} | ||||
| </div> | </div> | ||||
| </div> | </div> |
| value={description} | value={description} | ||||
| onChange={e => setDescription(e.target.value)} | onChange={e => setDescription(e.target.value)} | ||||
| /> | /> | ||||
| <a className='flex items-center h-[18px] px-3 text-xs text-gray-500' href="https://docs.dify.ai/advanced/datasets#how-to-write-a-good-dataset-description" target='_blank'> | |||||
| <a className='flex items-center h-[18px] px-3 text-xs text-gray-500' href="https://docs.dify.ai/features/datasets#how-to-write-a-good-dataset-description" target='_blank'> | |||||
| <BookOpenIcon className='w-3 h-[18px] mr-1' /> | <BookOpenIcon className='w-3 h-[18px] mr-1' /> | ||||
| {t('datasetSettings.form.descWrite')} | {t('datasetSettings.form.descWrite')} | ||||
| </a> | </a> | ||||
| <div> | <div> | ||||
| <div>{t('datasetSettings.form.retrievalSetting.title')}</div> | <div>{t('datasetSettings.form.retrievalSetting.title')}</div> | ||||
| <div className='leading-[18px] text-xs font-normal text-gray-500'> | <div className='leading-[18px] text-xs font-normal text-gray-500'> | ||||
| <a target='_blank' href='https://docs.dify.ai/advanced/retrieval-augment' className='text-[#155eef]'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| <a target='_blank' href='https://docs.dify.ai/features/retrieval-augment' className='text-[#155eef]'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| {t('datasetSettings.form.retrievalSetting.description')} | {t('datasetSettings.form.retrievalSetting.description')} | ||||
| </div> | </div> | ||||
| </div> | </div> |
| apiBasedExtension: { | apiBasedExtension: { | ||||
| title: 'API extensions provide centralized API management, simplifying configuration for easy use across Dify\'s applications.', | title: 'API extensions provide centralized API management, simplifying configuration for easy use across Dify\'s applications.', | ||||
| link: 'Learn how to develop your own API Extension.', | link: 'Learn how to develop your own API Extension.', | ||||
| linkUrl: 'https://docs.dify.ai/advanced/api_based_extension', | |||||
| linkUrl: 'https://docs.dify.ai/features/extension/api_based_extension', | |||||
| add: 'Add API Extension', | add: 'Add API Extension', | ||||
| selector: { | selector: { | ||||
| title: 'API Extension', | title: 'API Extension', |
| apiBasedExtension: { | apiBasedExtension: { | ||||
| title: 'As extensões de API fornecem gerenciamento centralizado de API, simplificando a configuração para uso fácil em aplicativos da Dify.', | title: 'As extensões de API fornecem gerenciamento centralizado de API, simplificando a configuração para uso fácil em aplicativos da Dify.', | ||||
| link: 'Saiba como desenvolver sua própria Extensão de API.', | link: 'Saiba como desenvolver sua própria Extensão de API.', | ||||
| linkUrl: 'https://docs.dify.ai/advanced/api_based_extension', | |||||
| linkUrl: 'https://docs.dify.ai/features/extension/api_based_extension', | |||||
| add: 'Adicionar Extensão de API', | add: 'Adicionar Extensão de API', | ||||
| selector: { | selector: { | ||||
| title: 'Extensão de API', | title: 'Extensão de API', |