| 'advanced-chat': { | 'advanced-chat': { | ||||
| title: t('app.types.advanced'), | title: t('app.types.advanced'), | ||||
| description: t('app.newApp.advancedUserDescription'), | description: t('app.newApp.advancedUserDescription'), | ||||
| link: docLink('/guides/workflow/readme'), | |||||
| link: docLink('/guides/workflow/README', { | |||||
| 'zh-Hans': '/guides/workflow/readme', | |||||
| 'ja-JP': '/guides/workflow/concepts', | |||||
| }), | |||||
| }, | }, | ||||
| 'agent-chat': { | 'agent-chat': { | ||||
| title: t('app.types.agent'), | title: t('app.types.agent'), | ||||
| 'completion': { | 'completion': { | ||||
| title: t('app.newApp.completeApp'), | title: t('app.newApp.completeApp'), | ||||
| description: t('app.newApp.completionUserDescription'), | description: t('app.newApp.completionUserDescription'), | ||||
| link: docLink('/guides/application-orchestrate/text-generator', | |||||
| { 'zh-Hans': '/guides/application-orchestrate/readme' }), | |||||
| link: docLink('/guides/application-orchestrate/text-generator', { | |||||
| 'zh-Hans': '/guides/application-orchestrate/readme', | |||||
| 'ja-JP': '/guides/application-orchestrate/README', | |||||
| }), | |||||
| }, | }, | ||||
| 'workflow': { | 'workflow': { | ||||
| title: t('app.types.workflow'), | title: t('app.types.workflow'), | ||||
| description: t('app.newApp.workflowUserDescription'), | description: t('app.newApp.workflowUserDescription'), | ||||
| link: docLink('/guides/workflow/readme'), | |||||
| link: docLink('/guides/workflow/README', { | |||||
| 'zh-Hans': '/guides/workflow/readme', | |||||
| 'ja-JP': '/guides/workflow/concepts', | |||||
| }), | |||||
| }, | }, | ||||
| } | } | ||||
| const previewInfo = modeToPreviewInfoMap[mode] | const previewInfo = modeToPreviewInfoMap[mode] |
| </div> | </div> | ||||
| <div className='system-xs-regular mt-0.5 text-text-tertiary'> | <div className='system-xs-regular mt-0.5 text-text-tertiary'> | ||||
| <span>{t(`${prefixSettings}.modalTip`)}</span> | <span>{t(`${prefixSettings}.modalTip`)}</span> | ||||
| <Link href={docLink('/guides/application-publishing/launch-your-webapp-quickly/README')} | |||||
| <Link href={docLink('/guides/application-publishing/launch-your-webapp-quickly/README', { | |||||
| 'zh-Hans': '/guides/application-publishing/launch-your-webapp-quickly/readme', | |||||
| })} | |||||
| target='_blank' rel='noopener noreferrer' className='text-text-accent'>{t('common.operation.learnMore')}</Link> | target='_blank' rel='noopener noreferrer' className='text-text-accent'>{t('common.operation.learnMore')}</Link> | ||||
| </div> | </div> | ||||
| </div> | </div> |
| </label> | </label> | ||||
| {variable === 'endpoint' && ( | {variable === 'endpoint' && ( | ||||
| <a | <a | ||||
| href={docLink('/guides/knowledge-base/external-knowledge-api-documentation') || '/'} | |||||
| href={docLink('/guides/knowledge-base/connect-external-knowledge-base') || '/'} | |||||
| target='_blank' | target='_blank' | ||||
| rel='noopener noreferrer' | rel='noopener noreferrer' | ||||
| className='body-xs-regular flex items-center text-text-accent' | className='body-xs-regular flex items-center text-text-accent' |
| <div className='system-xl-semibold self-stretch text-text-primary'>{t('dataset.externalAPIPanelTitle')}</div> | <div className='system-xl-semibold self-stretch text-text-primary'>{t('dataset.externalAPIPanelTitle')}</div> | ||||
| <div className='body-xs-regular self-stretch text-text-tertiary'>{t('dataset.externalAPIPanelDescription')}</div> | <div className='body-xs-regular self-stretch text-text-tertiary'>{t('dataset.externalAPIPanelDescription')}</div> | ||||
| <a className='flex cursor-pointer items-center justify-center gap-1 self-stretch' | <a className='flex cursor-pointer items-center justify-center gap-1 self-stretch' | ||||
| href={docLink('/guides/knowledge-base/external-knowledge-api-documentation')} target='_blank'> | |||||
| href={docLink('/guides/knowledge-base/connect-external-knowledge-base')} target='_blank'> | |||||
| <RiBookOpenLine className='h-3 w-3 text-text-accent' /> | <RiBookOpenLine className='h-3 w-3 text-text-accent' /> | ||||
| <div className='body-xs-regular grow text-text-accent'>{t('dataset.externalAPIPanelDocumentation')}</div> | <div className='body-xs-regular grow text-text-accent'>{t('dataset.externalAPIPanelDocumentation')}</div> | ||||
| </a> | </a> |
| <a | <a | ||||
| target='_blank' | target='_blank' | ||||
| rel='noopener noreferrer' | rel='noopener noreferrer' | ||||
| href={docLink('/guides/knowledge-base/create-knowledge-and-upload-documents#id-4-retrieval-settings')} | |||||
| href={docLink('/guides/knowledge-base/retrieval-test-and-citation#modify-text-retrieval-setting', { | |||||
| 'zh-Hans': '/guides/knowledge-base/retrieval-test-and-citation#修改文本检索方式', | |||||
| 'ja-JP': '/guides/knowledge-base/retrieval-test-and-citation', | |||||
| })} | |||||
| className='text-text-accent' | className='text-text-accent' | ||||
| > | > | ||||
| {t('datasetSettings.form.retrievalSetting.learnMore')} | {t('datasetSettings.form.retrievalSetting.learnMore')} |
| <div> | <div> | ||||
| <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.retrievalSetting.title')}</div> | <div className='system-sm-semibold text-text-secondary'>{t('datasetSettings.form.retrievalSetting.title')}</div> | ||||
| <div className='body-xs-regular text-text-tertiary'> | <div className='body-xs-regular text-text-tertiary'> | ||||
| <a target='_blank' rel='noopener noreferrer' href={docLink('/guides/knowledge-base/create-knowledge-and-upload-documents#id-4-retrieval-settings')} className='text-text-accent'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a> | |||||
| <a | |||||
| target='_blank' | |||||
| rel='noopener noreferrer' | |||||
| href={docLink('/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods#setting-the-retrieval-setting', { | |||||
| 'zh-Hans': '/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods#指定检索方式', | |||||
| 'ja-JP': '/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods#検索方法の指定', | |||||
| })} | |||||
| className='text-text-accent'> | |||||
| {t('datasetSettings.form.retrievalSetting.learnMore')} | |||||
| </a> | |||||
| {t('datasetSettings.form.retrievalSetting.description')} | {t('datasetSettings.form.retrievalSetting.description')} | ||||
| </div> | </div> | ||||
| </div> | </div> |
| description={<div className='text-xs text-text-tertiary'> | description={<div className='text-xs text-text-tertiary'> | ||||
| {t('workflow.nodes.agent.strategy.configureTipDesc')} <br /> | {t('workflow.nodes.agent.strategy.configureTipDesc')} <br /> | ||||
| <Link href={docLink('/guides/workflow/node/agent#select-an-agent-strategy', { | <Link href={docLink('/guides/workflow/node/agent#select-an-agent-strategy', { | ||||
| 'zh-Hans': '/guides/workflow/node/agent#xuan-ze-agent-ce-le', | |||||
| 'zh-Hans': '/guides/workflow/node/agent#选择-agent-策略', | |||||
| 'ja-JP': '/guides/workflow/node/agent#エージェント戦略の選択', | |||||
| })} | })} | ||||
| className='text-text-accent-secondary' target='_blank'> | className='text-text-accent-secondary' target='_blank'> | ||||
| {t('workflow.nodes.agent.learnMore')} | {t('workflow.nodes.agent.learnMore')} |
| {t('workflow.nodes.common.errorHandle.defaultValue.desc')} | {t('workflow.nodes.common.errorHandle.defaultValue.desc')} | ||||
| | | ||||
| <a | <a | ||||
| href={docLink('/guides/workflow/error-handling/README')} | |||||
| href={docLink('/guides/workflow/error-handling/README', { | |||||
| 'zh-Hans': '/guides/workflow/error-handling/readme', | |||||
| })} | |||||
| target='_blank' | target='_blank' | ||||
| className='text-text-accent' | className='text-text-accent' | ||||
| > | > |
| description={<div className='system-xs-regular text-text-tertiary'> | description={<div className='system-xs-regular text-text-tertiary'> | ||||
| {t('workflow.variableReference.assignedVarsDescription')} | {t('workflow.variableReference.assignedVarsDescription')} | ||||
| <a target='_blank' rel='noopener noreferrer' | <a target='_blank' rel='noopener noreferrer' | ||||
| className='text-text-accent-secondary' | |||||
| href={docLink('/guides/workflow/variables#conversation-variables', { 'zh-Hans': '/guides/workflow/variables#hui-hua-bian-liang' })}> | |||||
| className='text-text-accent-secondary' | |||||
| href={docLink('/guides/workflow/variables#conversation-variables', { | |||||
| 'zh-Hans': '/guides/workflow/variables#会话变量', | |||||
| 'ja-JP': '/guides/workflow/variables#会話変数', | |||||
| })}> | |||||
| {t('workflow.variableReference.conversationVars')} | {t('workflow.variableReference.conversationVars')} | ||||
| </a> | </a> | ||||
| </div>} | </div>} |
| <div className='system-sm-regular mb-4 mt-1 text-text-secondary'> | <div className='system-sm-regular mb-4 mt-1 text-text-secondary'> | ||||
| {t('workflow.chatVariable.panelDescription')} | {t('workflow.chatVariable.panelDescription')} | ||||
| <a target='_blank' rel='noopener noreferrer' className='text-text-accent' | <a target='_blank' rel='noopener noreferrer' className='text-text-accent' | ||||
| href={docLink('/guides/workflow/variables#conversation-variables', { 'zh-Hans': '/guides/workflow/variables#hui-hua-bian-liang' })}> | |||||
| href={docLink('/guides/workflow/variables#conversation-variables', { | |||||
| 'zh-Hans': '/guides/workflow/variables#会话变量', | |||||
| 'ja-JP': '/guides/workflow/variables#会話変数', | |||||
| })}> | |||||
| {t('workflow.chatVariable.docLink')} | {t('workflow.chatVariable.docLink')} | ||||
| </a> | </a> | ||||
| </div> | |||||
| </div> | |||||
| <div className='flex items-center gap-2'> | <div className='flex items-center gap-2'> | ||||
| <div className='radius-lg flex flex-col border border-workflow-block-border bg-workflow-block-bg p-3 pb-4 shadow-md'> | <div className='radius-lg flex flex-col border border-workflow-block-border bg-workflow-block-bg p-3 pb-4 shadow-md'> | ||||
| <BubbleX className='mb-1 h-4 w-4 shrink-0 text-util-colors-teal-teal-700' /> | <BubbleX className='mb-1 h-4 w-4 shrink-0 text-util-colors-teal-teal-700' /> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div className='absolute right-[38px] top-[-4px] z-10 h-3 w-3 rotate-45 bg-background-section-burn'/> | |||||
| <div className='absolute right-[38px] top-[-4px] z-10 h-3 w-3 rotate-45 bg-background-section-burn' /> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| )} | )} |
| return getLanguage(locale) | return getLanguage(locale) | ||||
| } | } | ||||
| export const useGetDocLanguage = () => { | |||||
| const { locale } = useI18N() | |||||
| return getDocLanguage(locale) | |||||
| } | |||||
| export const useGetPricingPageLanguage = () => { | export const useGetPricingPageLanguage = () => { | ||||
| const { locale } = useI18N() | const { locale } = useI18N() | ||||
| const defaultDocBaseUrl = 'https://docs.dify.ai' | const defaultDocBaseUrl = 'https://docs.dify.ai' | ||||
| export const useDocLink = (baseUrl?: string): ((path?: string, pathMap?: { [index: string]: string }) => string) => { | export const useDocLink = (baseUrl?: string): ((path?: string, pathMap?: { [index: string]: string }) => string) => { | ||||
| let baseDocUrl = baseUrl || defaultDocBaseUrl | |||||
| baseDocUrl = (baseDocUrl.endsWith('/')) ? baseDocUrl.slice(0, -1) : baseDocUrl | |||||
| const { locale } = useI18N() | |||||
| const docLanguage = getDocLanguage(locale) | |||||
| return (path?: string, pathMap?: { [index: string]: string }): string => { | |||||
| const pathUrl = path || '' | |||||
| let targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl | |||||
| targetPath = (targetPath.startsWith('/')) ? targetPath.slice(0, -1) : targetPath | |||||
| return `${baseDocUrl}/${docLanguage}/${targetPath}` | |||||
| } | |||||
| let baseDocUrl = baseUrl || defaultDocBaseUrl | |||||
| baseDocUrl = (baseDocUrl.endsWith('/')) ? baseDocUrl.slice(0, -1) : baseDocUrl | |||||
| const { locale } = useI18N() | |||||
| const docLanguage = getDocLanguage(locale) | |||||
| return (path?: string, pathMap?: { [index: string]: string }): string => { | |||||
| const pathUrl = path || '' | |||||
| let targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl | |||||
| targetPath = (targetPath.startsWith('/')) ? targetPath.slice(1) : targetPath | |||||
| return `${baseDocUrl}/${docLanguage}/${targetPath}` | |||||
| } | |||||
| } | } | ||||
| export default I18NContext | export default I18NContext |