diff --git a/web/.env.example b/web/.env.example index e501df92b5..51631c2437 100644 --- a/web/.env.example +++ b/web/.env.example @@ -6,12 +6,10 @@ NEXT_PUBLIC_EDITION=SELF_HOSTED # different from api or web app domain. # example: http://cloud.dify.ai/console/api NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api -NEXT_PUBLIC_WEB_PREFIX=http://localhost:3000 # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from # console or api domain. # example: http://udify.app/api NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api -NEXT_PUBLIC_PUBLIC_WEB_PREFIX=http://localhost:3000 # The API PREFIX for MARKETPLACE NEXT_PUBLIC_MARKETPLACE_API_PREFIX=https://marketplace.dify.ai/api/v1 # The URL for MARKETPLACE diff --git a/web/README.md b/web/README.md index ddb1155264..3d9fd2de87 100644 --- a/web/README.md +++ b/web/README.md @@ -31,12 +31,10 @@ NEXT_PUBLIC_EDITION=SELF_HOSTED # different from api or web app domain. # example: http://cloud.dify.ai/console/api NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api -NEXT_PUBLIC_WEB_PREFIX=http://localhost:3000 # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from # console or api domain. # example: http://udify.app/api NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api -NEXT_PUBLIC_PUBLIC_WEB_PREFIX=http://localhost:3000 # SENTRY NEXT_PUBLIC_SENTRY_DSN= diff --git a/web/app/(commonLayout)/apps/AppCard.tsx b/web/app/(commonLayout)/apps/AppCard.tsx index c2ad1f1283..3f8c180c1a 100644 --- a/web/app/(commonLayout)/apps/AppCard.tsx +++ b/web/app/(commonLayout)/apps/AppCard.tsx @@ -16,7 +16,7 @@ import AppsContext, { useAppContext } from '@/context/app-context' import type { HtmlContentProps } from '@/app/components/base/popover' import CustomPopover from '@/app/components/base/popover' import Divider from '@/app/components/base/divider' -import { WEB_PREFIX } from '@/config' +import { basePath } from '@/utils/var' import { getRedirection } from '@/utils/app-redirection' import { useProviderContext } from '@/context/provider-context' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' @@ -217,7 +217,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => { try { const { installed_apps }: any = await fetchInstalledAppList(app.id) || {} if (installed_apps?.length > 0) - window.open(`${WEB_PREFIX}/explore/installed/${installed_apps[0].id}`, '_blank') + window.open(`${basePath}/explore/installed/${installed_apps[0].id}`, '_blank') else throw new Error('No app found in Explore') } diff --git a/web/app/(commonLayout)/datasets/NewDatasetCard.tsx b/web/app/(commonLayout)/datasets/NewDatasetCard.tsx index ddc48c2a6e..792d9904da 100644 --- a/web/app/(commonLayout)/datasets/NewDatasetCard.tsx +++ b/web/app/(commonLayout)/datasets/NewDatasetCard.tsx @@ -1,6 +1,6 @@ 'use client' import { useTranslation } from 'react-i18next' -import Link from 'next/link' +import { basePath } from '@/utils/var' import { RiAddLine, RiArrowRightLine, @@ -18,7 +18,7 @@ const CreateAppCard = (
- +
{t('dataset.createDataset')}
- +
{t('dataset.createDatasetIntro')}
- +
{t('dataset.connectDataset')}
- +
) } diff --git a/web/app/components/app/app-publisher/index.tsx b/web/app/components/app/app-publisher/index.tsx index 12144833e2..b061cbc688 100644 --- a/web/app/components/app/app-publisher/index.tsx +++ b/web/app/components/app/app-publisher/index.tsx @@ -24,7 +24,7 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' -import { WEB_PREFIX } from '@/config' +import { basePath } from '@/utils/var' import { fetchInstalledAppList } from '@/service/explore' import EmbeddedModal from '@/app/components/app/overview/embedded' import { useStore as useAppStore } from '@/app/components/app/store' @@ -76,7 +76,7 @@ const AppPublisher = ({ const appDetail = useAppStore(state => state.appDetail) const { app_base_url: appBaseURL = '', access_token: accessToken = '' } = appDetail?.site ?? {} const appMode = (appDetail?.mode !== 'completion' && appDetail?.mode !== 'workflow') ? 'chat' : appDetail.mode - const appURL = `${appBaseURL}/${appMode}/${accessToken}` + const appURL = `${appBaseURL}${basePath}/${appMode}/${accessToken}` const isChatApp = ['chat', 'agent-chat', 'completion'].includes(appDetail?.mode || '') const language = useGetLanguage() @@ -121,7 +121,7 @@ const AppPublisher = ({ try { const { installed_apps }: any = await fetchInstalledAppList(appDetail?.id) || {} if (installed_apps?.length > 0) - window.open(`${WEB_PREFIX}/explore/installed/${installed_apps[0].id}`, '_blank') + window.open(`${basePath}/explore/installed/${installed_apps[0].id}`, '_blank') else throw new Error('No app found in Explore') } 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 70f5e1edfd..ffdb714f08 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 = ({ }} > {t('appDebug.feature.dataSet.noDataSet')} - {t('appDebug.feature.dataSet.toCreate')} + {t('appDebug.feature.dataSet.toCreate')}
)} diff --git a/web/app/components/app/create-app-modal/index.tsx b/web/app/components/app/create-app-modal/index.tsx index f91f440950..6e05bb0209 100644 --- a/web/app/components/app/create-app-modal/index.tsx +++ b/web/app/components/app/create-app-modal/index.tsx @@ -14,7 +14,7 @@ import type { AppIconSelection } from '../../base/app-icon-picker' import Button from '@/app/components/base/button' import Divider from '@/app/components/base/divider' import cn from '@/utils/classnames' -import { WEB_PREFIX } from '@/config' +import { basePath } from '@/utils/var' import AppsContext, { useAppContext } from '@/context/app-context' import { useProviderContext } from '@/context/provider-context' import { ToastContext } from '@/app/components/base/toast' @@ -353,11 +353,11 @@ function AppScreenShot({ mode, show }: { mode: AppMode; show: boolean }) { 'workflow': 'Workflow', } return - - - + + + App Screen Shot diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsx index 8e523b7cf8..13be294bef 100644 --- a/web/app/components/app/log/index.tsx +++ b/web/app/components/app/log/index.tsx @@ -7,6 +7,7 @@ import { usePathname } from 'next/navigation' import { useDebounce } from 'ahooks' import { omit } from 'lodash-es' import dayjs from 'dayjs' +import { basePath } from '@/utils/var' import { Trans, useTranslation } from 'react-i18next' import List from './list' import Filter, { TIME_PERIOD_MAPPING } from './filter' @@ -109,7 +110,7 @@ const Logs: FC = ({ appDetail }) => { ? : total > 0 ? - : + : } {/* Show Pagination only if the total is more than the limit */} {(total && total > APP_PAGE_LIMIT) diff --git a/web/app/components/app/overview/appCard.tsx b/web/app/components/app/overview/appCard.tsx index 04fc8f20d5..7c12f1edee 100644 --- a/web/app/components/app/overview/appCard.tsx +++ b/web/app/components/app/overview/appCard.tsx @@ -17,6 +17,7 @@ import type { ConfigParams } from './settings' import Tooltip from '@/app/components/base/tooltip' import AppBasic from '@/app/components/app-sidebar/basic' import { asyncRunSafe, randomString } from '@/utils' +import { basePath } from '@/utils/var' import Button from '@/app/components/base/button' import Switch from '@/app/components/base/switch' import Divider from '@/app/components/base/divider' @@ -88,7 +89,7 @@ function AppCard({ const runningStatus = isApp ? appInfo.enable_site : appInfo.enable_api const { app_base_url, access_token } = appInfo.site ?? {} const appMode = (appInfo.mode !== 'completion' && appInfo.mode !== 'workflow') ? 'chat' : appInfo.mode - const appUrl = `${app_base_url}/${appMode}/${access_token}` + const appUrl = `${app_base_url}${basePath}/${appMode}/${access_token}` const apiUrl = appInfo?.api_base_url const genClickFuncByName = (opName: string) => { diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx index e047b4f145..691b727b8e 100644 --- a/web/app/components/app/overview/embedded/index.tsx +++ b/web/app/components/app/overview/embedded/index.tsx @@ -13,6 +13,7 @@ import { IS_CE_EDITION } from '@/config' import type { SiteInfo } from '@/models/share' import { useThemeContext } from '@/app/components/base/chat/embedded-chatbot/theme/theme-context' import ActionButton from '@/app/components/base/action-button' +import { basePath } from '@/utils/var' import cn from '@/utils/classnames' type Props = { @@ -28,7 +29,7 @@ const OPTION_MAP = { iframe: { getContent: (url: string, token: string) => `