Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Added the missing path of the webpath prefix and the prefix basepath + of static resources to remove the bug of adding more basepath. (#18658)

GQ19949982445dadd9
diff --git a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
index 64a7f6dc46c..ffdb714f080 100644
--- a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
@@ -14,6 +14,7 @@ import Loading from '@/app/components/base/loading'
import Badge from '@/app/components/base/badge'
import { useKnowledge } from '@/hooks/use-knowledge'
import cn from '@/utils/classnames'
+import { basePath } from '@/utils/var'
export type ISelectDataSetProps = {
isShow: boolean
@@ -111,7 +112,7 @@ const SelectDataSet: FC<ISelectDataSetProps> = ({
}}
>
<span className='text-text-tertiary'>{t('appDebug.feature.dataSet.noDataSet')}</span>
- <Link href="/datasets/create" className='font-normal text-text-accent'>{t('appDebug.feature.dataSet.toCreate')}</Link>
+ <Link href={`${basePath}/datasets/create`} className='font-normal text-text-accent'>{t('appDebug.feature.dataSet.toCreate')}</Link>
</div>
)}
diff --git a/web/app/components/base/logo/logo-embedded-chat-avatar.tsx b/web/app/components/base/logo/logo-embedded-chat-avatar.tsx
index 8ea60e1ce8f..f09a6a03edd 100644
--- a/web/app/components/base/logo/logo-embedded-chat-avatar.tsx
+++ b/web/app/components/base/logo/logo-embedded-chat-avatar.tsx
@@ -1,4 +1,5 @@
import type { FC } from 'react'
+import { basePath } from '@/utils/var'
type LogoEmbeddedChatAvatarProps = {
className?: string
@@ -8,7 +9,7 @@ const LogoEmbeddedChatAvatar: FC<LogoEmbeddedChatAvatarProps> = ({
}) => {
return (
<img
- src='/logo/logo-embedded-chat-avatar.png'
+ src={`${basePath}/logo/logo-embedded-chat-avatar.png`}
className={`block h-10 w-10 ${className}`}
alt='logo'
/>
diff --git a/web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx
index 90190519892..d302defcfec 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx
@@ -3,7 +3,6 @@ import type {
Model,
ModelProvider,
} from '../declarations'
-import { basePath } from '@/utils/var'
import { useLanguage } from '../hooks'
import { Group } from '@/app/components/base/icons/src/vender/other'
import { OpenaiBlue, OpenaiViolet } from '@/app/components/base/icons/src/public/llm'
@@ -31,7 +30,7 @@ const ModelIcon: FC<ModelIconProps> = ({
if (provider?.icon_small) {
return (
<div className={cn('flex h-5 w-5 items-center justify-center', isDeprecated && 'opacity-50', className)}>
- <img alt='model-icon' src={basePath + renderI18nObject(provider.icon_small, language)}/>
+ <img alt='model-icon' src={renderI18nObject(provider.icon_small, language)}/>
</div>
)
}
diff --git a/web/app/components/header/dataset-nav/index.tsx b/web/app/components/header/dataset-nav/index.tsx
index 8c997f2115e..4894a624845 100644
--- a/web/app/components/header/dataset-nav/index.tsx
+++ b/web/app/components/header/dataset-nav/index.tsx
@@ -14,6 +14,7 @@ import Nav from '../nav'
import type { NavItem } from '../nav/nav-selector'
import { fetchDatasetDetail, fetchDatasets } from '@/service/datasets'
import type { DataSetListResponse } from '@/models/datasets'
+import { basePath } from '@/utils/var'
const getKey = (pageIndex: number, previousPageData: DataSetListResponse) => {
if (!pageIndex || previousPageData.has_more)
@@ -56,7 +57,7 @@ const DatasetNav = () => {
icon_background: dataset.icon_background,
})) as NavItem[]}
createText={t('common.menus.newDataset')}
- onCreate={() => router.push('/datasets/create')}
+ onCreate={() => router.push(`${basePath}/datasets/create`)}
onLoadmore={handleLoadmore}
/>
)
diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsx
index c01be722c00..99f2ec6b772 100644
--- a/web/app/install/installForm.tsx
+++ b/web/app/install/installForm.tsx
@@ -16,6 +16,7 @@ import Button from '@/app/components/base/button'
import { fetchInitValidateStatus, fetchSetupStatus, setup } from '@/service/common'
import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/common'
+import { basePath } from '@/utils/var'
const validPassword = /^(?=.*[a-zA-Z])(?=.*\d).{8,}$/
@@ -80,12 +81,12 @@ const InstallForm = () => {
fetchSetupStatus().then((res: SetupStatusResponse) => {
if (res.step === 'finished') {
localStorage.setItem('setup_status', 'finished')
- router.push('/signin')
+ router.push(`${basePath}/signin`)
}
else {
fetchInitValidateStatus().then((res: InitValidateStatusResponse) => {
if (res.status === 'not_started')
- router.push('/init')
+ router.push(`${basePath}/init`)
})
}
setLoading(false)
diff --git a/web/next.config.js b/web/next.config.js
index de92fa37a4d..4243ffecdf1 100644
--- a/web/next.config.js
+++ b/web/next.config.js
@@ -1,4 +1,4 @@
-const { basePath } = require('./utils/var-basePath')
+const { basePath, assetPrefix } = require('./utils/var-basePath')
const { codeInspectorPlugin } = require('code-inspector-plugin')
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
@@ -16,6 +16,7 @@ const withMDX = require('@next/mdx')({
/** @type {import('next').NextConfig} */
const nextConfig = {
basePath,
+ assetPrefix,
webpack: (config, { dev, isServer }) => {
config.plugins.push(codeInspectorPlugin({ bundler: 'webpack' }))
return config
diff --git a/web/utils/var-basePath.js b/web/utils/var-basePath.js
index 763392086df..07b7f7581b3 100644
--- a/web/utils/var-basePath.js
+++ b/web/utils/var-basePath.js
@@ -2,4 +2,5 @@
// same as the one exported from var.ts
module.exports = {
basePath: '',
+ assetPrefix: '',
}