mirror of
https://github.com/langgenius/dify.git
synced 2026-09-07 09:59:38 +08:00
Co-authored-by: zhangx1n <zhangxin@dify.ai> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
38 lines
980 B
TypeScript
38 lines
980 B
TypeScript
import type { TFunction } from 'i18next'
|
|
import { AppModeEnum } from '@/types/app'
|
|
import { basePath } from '@/utils/var'
|
|
|
|
export const getPublisherAppMode = (mode?: AppModeEnum) => {
|
|
if (mode !== AppModeEnum.COMPLETION && mode !== AppModeEnum.WORKFLOW) return AppModeEnum.CHAT
|
|
|
|
return mode
|
|
}
|
|
|
|
export const getPublisherAppUrl = ({
|
|
appBaseUrl,
|
|
accessToken,
|
|
mode,
|
|
}: {
|
|
appBaseUrl: string
|
|
accessToken: string
|
|
mode?: AppModeEnum
|
|
}) => `${appBaseUrl}${basePath}/${getPublisherAppMode(mode)}/${accessToken}`
|
|
|
|
export const getDisabledFunctionTooltip = ({
|
|
t,
|
|
publishedAt,
|
|
missingStartNode,
|
|
noAccessPermission,
|
|
}: {
|
|
t: TFunction
|
|
publishedAt?: number
|
|
missingStartNode: boolean
|
|
noAccessPermission: boolean
|
|
}) => {
|
|
if (!publishedAt) return t(($) => $.notPublishedYet, { ns: 'app' })
|
|
if (missingStartNode) return t(($) => $.noUserInputNode, { ns: 'app' })
|
|
if (noAccessPermission) return t(($) => $.noAccessPermission, { ns: 'app' })
|
|
|
|
return undefined
|
|
}
|