From ff5fe41af93ec401eac6467c9be10efd3367c033 Mon Sep 17 00:00:00 2001 From: Yi Date: Tue, 6 Aug 2024 14:21:16 +0800 Subject: [PATCH 01/42] fix: remove unnecessary "as string" --- .../[appId]/overview/tracing/provider-config-modal.tsx | 2 +- web/app/(commonLayout)/apps/AppCard.tsx | 4 ++-- web/app/components/app-sidebar/app-info.tsx | 4 ++-- .../app/annotation/edit-annotation-modal/index.tsx | 2 +- .../annotation/remove-annotation-confirm-modal/index.tsx | 2 +- .../app/annotation/view-annotation-modal/index.tsx | 2 +- web/app/components/app/configuration/config-var/index.tsx | 2 +- .../configuration/config/automatic/get-automatic-res.tsx | 4 ++-- web/app/components/app/configuration/index.tsx | 8 ++++---- web/app/components/app/overview/appCard.tsx | 4 ++-- web/app/components/app/switch-app-modal/index.tsx | 4 ++-- web/app/components/base/confirm/index.tsx | 2 +- .../datasets/documents/detail/completed/SegmentCard.tsx | 4 ++-- web/app/components/datasets/documents/list.tsx | 6 +++--- web/app/components/explore/sidebar/index.tsx | 4 ++-- 15 files changed, 27 insertions(+), 27 deletions(-) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx index 44f68629fe6248..e7ecd2f4ce3d64 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx @@ -280,7 +280,7 @@ const ProviderConfigModal: FC = ({ isShow type='warning' title={t(`${I18N_PREFIX}.removeConfirmTitle`, { key: t(`app.tracing.${type}.title`) })!} - content={t(`${I18N_PREFIX}.removeConfirmContent`) as string} + content={t(`${I18N_PREFIX}.removeConfirmContent`)} onConfirm={handleRemove} onCancel={hideRemoveConfirm} /> diff --git a/web/app/(commonLayout)/apps/AppCard.tsx b/web/app/(commonLayout)/apps/AppCard.tsx index 3740e0cb0e52b7..1387099a627e1c 100644 --- a/web/app/(commonLayout)/apps/AppCard.tsx +++ b/web/app/(commonLayout)/apps/AppCard.tsx @@ -389,8 +389,8 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => { )} {showConfirmDelete && ( setShowConfirmDelete(false)} diff --git a/web/app/components/app-sidebar/app-info.tsx b/web/app/components/app-sidebar/app-info.tsx index 3bf02f1faafb96..698846cae5144b 100644 --- a/web/app/components/app-sidebar/app-info.tsx +++ b/web/app/components/app-sidebar/app-info.tsx @@ -423,8 +423,8 @@ const AppInfo = ({ expand }: IAppInfoProps) => { )} {showConfirmDelete && ( setShowConfirmDelete(false)} diff --git a/web/app/components/app/annotation/edit-annotation-modal/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/index.tsx index 1f22e829a1b7d1..df80196cf191bb 100644 --- a/web/app/components/app/annotation/edit-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/edit-annotation-modal/index.tsx @@ -107,7 +107,7 @@ const EditAnnotationModal: FC = ({ setShowModal(false) onHide() }} - title={t('appDebug.feature.annotation.removeConfirm') as string} + title={t('appDebug.feature.annotation.removeConfirm')} /> diff --git a/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx b/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx index bffc0c846164f1..a6ade49a7973df 100644 --- a/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx +++ b/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx @@ -22,7 +22,7 @@ const RemoveAnnotationConfirmModal: FC = ({ isShow={isShow} onCancel={onHide} onConfirm={onRemove} - title={t('appDebug.feature.annotation.removeConfirm') as string} + title={t('appDebug.feature.annotation.removeConfirm')} /> ) } diff --git a/web/app/components/app/annotation/view-annotation-modal/index.tsx b/web/app/components/app/annotation/view-annotation-modal/index.tsx index 32cff3d50e2b88..7b96ad134e6655 100644 --- a/web/app/components/app/annotation/view-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/view-annotation-modal/index.tsx @@ -213,7 +213,7 @@ const ViewAnnotationModal: FC = ({ setShowModal(false) onHide() }} - title={t('appDebug.feature.annotation.removeConfirm') as string} + title={t('appDebug.feature.annotation.removeConfirm')} /> )} diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsx index 12d2489461bd95..82a220c6db9bbd 100644 --- a/web/app/components/app/configuration/config-var/index.tsx +++ b/web/app/components/app/configuration/config-var/index.tsx @@ -392,7 +392,7 @@ const ConfigVar: FC = ({ promptVariables, readonly, onPromptVar { didRemoveVar(removeIndex as number) hideDeleteContextVarModal() diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx index 6471afe67700ff..55d5661036c69b 100644 --- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx +++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx @@ -279,8 +279,8 @@ const GetAutomaticRes: FC = ({ {isShowAutoPromptResPlaceholder() && renderNoData} {showConfirmOverwrite && ( { setShowConfirmOverwrite(false) diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 20f9bed2043a67..432accb0d21049 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -877,8 +877,8 @@ const Configuration: FC = () => { {restoreConfirmOpen && ( setRestoreConfirmOpen(false)} @@ -886,8 +886,8 @@ const Configuration: FC = () => { )} {showUseGPT4Confirm && ( { setShowAccountSettingModal({ payload: 'provider' }) diff --git a/web/app/components/app/overview/appCard.tsx b/web/app/components/app/overview/appCard.tsx index 76a1d4a0fd4f9d..ccf1f8ef1a5fe9 100644 --- a/web/app/components/app/overview/appCard.tsx +++ b/web/app/components/app/overview/appCard.tsx @@ -182,8 +182,8 @@ function AppCard({ {showConfirmDelete && ( { onGenCode() diff --git a/web/app/components/app/switch-app-modal/index.tsx b/web/app/components/app/switch-app-modal/index.tsx index b45ed5a40473c8..79f4811e433f0a 100644 --- a/web/app/components/app/switch-app-modal/index.tsx +++ b/web/app/components/app/switch-app-modal/index.tsx @@ -139,8 +139,8 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onSuccess, onClo {showConfirmDelete && ( setShowConfirmDelete(false)} onCancel={() => { diff --git a/web/app/components/base/confirm/index.tsx b/web/app/components/base/confirm/index.tsx index 30876194815a99..137687b4bd3b73 100644 --- a/web/app/components/base/confirm/index.tsx +++ b/web/app/components/base/confirm/index.tsx @@ -9,7 +9,7 @@ export type IConfirm = { type?: 'info' | 'warning' title: string content?: React.ReactNode - confirmText?: string + confirmText?: string | null onConfirm: () => void cancelText?: string onCancel: () => void diff --git a/web/app/components/datasets/documents/detail/completed/SegmentCard.tsx b/web/app/components/datasets/documents/detail/completed/SegmentCard.tsx index 1bf7a567fbb224..c65b244f6d315b 100644 --- a/web/app/components/datasets/documents/detail/completed/SegmentCard.tsx +++ b/web/app/components/datasets/documents/detail/completed/SegmentCard.tsx @@ -218,8 +218,8 @@ const SegmentCard: FC = ({ {showModal && { await onDelete?.(id) }} onCancel={() => setShowModal(false)} /> diff --git a/web/app/components/datasets/documents/list.tsx b/web/app/components/datasets/documents/list.tsx index d4c1194da308ae..cb44f5cc289672 100644 --- a/web/app/components/datasets/documents/list.tsx +++ b/web/app/components/datasets/documents/list.tsx @@ -295,9 +295,9 @@ export const OperationAction: FC<{ {showModal && onOperate('delete')} onCancel={() => setShowModal(false)} /> diff --git a/web/app/components/explore/sidebar/index.tsx b/web/app/components/explore/sidebar/index.tsx index 1a5021a8c22467..1a3e767baaa68a 100644 --- a/web/app/components/explore/sidebar/index.tsx +++ b/web/app/components/explore/sidebar/index.tsx @@ -134,8 +134,8 @@ const SideBar: FC = ({ )} {showConfirm && ( setShowConfirm(false)} From 8861ad505ef4d348880823205dc17d438aae24a6 Mon Sep 17 00:00:00 2001 From: Yi Date: Wed, 7 Aug 2024 10:54:52 +0800 Subject: [PATCH 02/42] solve the popup delay issue --- .../[appId]/overview/tracing/config-popup.tsx | 1 - web/app/components/app-sidebar/basic.tsx | 20 ++++--- .../components/base/tooltip-plus/index.tsx | 55 ++++++++++++++++--- .../workflow/header/view-history.tsx | 1 + .../workflow/operator/tip-popup.tsx | 1 + 5 files changed, 62 insertions(+), 16 deletions(-) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx index 7aa1fca96d8a3f..a5cbc587bd4122 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx @@ -123,7 +123,6 @@ const ConfigPopup: FC = ({ popupContent={t(`${I18N_PREFIX}.disabledTip`)} > {switchContent} - ) : switchContent} diff --git a/web/app/components/app-sidebar/basic.tsx b/web/app/components/app-sidebar/basic.tsx index 09f978b04b4f01..83e6082aec8af1 100644 --- a/web/app/components/app-sidebar/basic.tsx +++ b/web/app/components/app-sidebar/basic.tsx @@ -1,10 +1,6 @@ import React from 'react' -import { - InformationCircleIcon, -} from '@heroicons/react/24/outline' -import Tooltip from '../base/tooltip' import AppIcon from '../base/app-icon' -import { randomString } from '@/utils' +import TooltipPlus from '@/app/components/base/tooltip-plus' export type IAppBasicProps = { iconType?: 'app' | 'api' | 'dataset' | 'webapp' | 'notion' @@ -74,9 +70,17 @@ export default function AppBasic({ icon, icon_background, name, type, hoverTip,
{name} {hoverTip - && - - } + && + {hoverTip} +
+ } + position='top' + iconStyle='w-4 h-4' + hideArrow + /> + }
{type}
} diff --git a/web/app/components/base/tooltip-plus/index.tsx b/web/app/components/base/tooltip-plus/index.tsx index b833690469459c..2d221ed6e2639a 100644 --- a/web/app/components/base/tooltip-plus/index.tsx +++ b/web/app/components/base/tooltip-plus/index.tsx @@ -3,32 +3,68 @@ import type { FC } from 'react' import React, { useEffect, useRef, useState } from 'react' import { useBoolean } from 'ahooks' import type { OffsetOptions, Placement } from '@floating-ui/react' +import { RiQuestionLine } from '@remixicon/react' import cn from '@/utils/classnames' import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigger } from '@/app/components/base/portal-to-follow-elem' export type TooltipProps = { position?: Placement triggerMethod?: 'hover' | 'click' + iconStyle?: string popupContent: React.ReactNode - children: React.ReactNode + children?: React.ReactNode hideArrow?: boolean popupClassName?: string offset?: OffsetOptions asChild?: boolean + needsDelay?: boolean } const arrow = ( ) +const getArrow = (position: Placement) => { + switch (position) { + case 'top': + return ( + + + + ) + case 'bottom': + return ( + + + + ) + case 'right': + return ( + + + + ) + case 'left': + return ( + + + + ) + default: + return null + } +} + const Tooltip: FC = ({ position = 'top', triggerMethod = 'hover', + iconStyle = 'w-[14px] h-[14px]', popupContent, children, hideArrow, popupClassName, offset, asChild, + needsDelay = true, }) => { const [open, setOpen] = useState(false) const [isHoverPopup, { @@ -59,10 +95,15 @@ const Tooltip: FC = ({ setNotHoverPopup() // give time to move to the popup - setTimeout(() => { - if (!isHoverPopupRef.current && !isHoverTriggerRef.current) - setOpen(false) - }, 500) + if (needsDelay) { + setTimeout(() => { + if (!isHoverPopupRef.current && !isHoverTriggerRef.current) + setOpen(false) + }, 500) + } + else { + setOpen(false) + } } return ( @@ -83,7 +124,7 @@ const Tooltip: FC = ({ onMouseLeave={() => triggerMethod === 'hover' && handleLeave(true)} asChild={asChild} > - {children} + {children ||
} = ({ onMouseLeave={() => triggerMethod === 'hover' && handleLeave(false)} > {popupContent} - {!hideArrow && arrow} + {!hideArrow && getArrow(position)} diff --git a/web/app/components/workflow/header/view-history.tsx b/web/app/components/workflow/header/view-history.tsx index 6711ff2589e57a..a5d7bec7479913 100644 --- a/web/app/components/workflow/header/view-history.tsx +++ b/web/app/components/workflow/header/view-history.tsx @@ -101,6 +101,7 @@ const ViewHistory = ({ !withText && (
From 0bb106e8d0d1a43f018b47615fcbd97c706608da Mon Sep 17 00:00:00 2001 From: douxc Date: Tue, 6 Aug 2024 11:00:21 +0800 Subject: [PATCH 03/42] feat: add Web Application SSO layout in app settings --- web/app/components/app/overview/settings/index.tsx | 11 ++++++++++- web/i18n/en-US/app-overview.ts | 6 ++++++ web/i18n/zh-Hans/app-overview.ts | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx index 88d5c2d9094585..ac021705574801 100644 --- a/web/app/components/app/overview/settings/index.tsx +++ b/web/app/components/app/overview/settings/index.tsx @@ -15,6 +15,7 @@ import EmojiPicker from '@/app/components/base/emoji-picker' import { useToastContext } from '@/app/components/base/toast' import { languages } from '@/i18n/language' +import Switch from '@/app/components/base/switch' export type ISettingsModalProps = { isChat: boolean @@ -206,9 +207,17 @@ const SettingsModal: FC = ({ } +
+

{t(`${prefixSettings}.sso.label`)}

+
+
{t(`${prefixSettings}.sso.title`)}
+ +
+

{t(`${prefixSettings}.sso.description`)}

+
{!isShowMore &&
setIsShowMore(true)}>
{t(`${prefixSettings}.more.entry`)}
diff --git a/web/i18n/en-US/app-overview.ts b/web/i18n/en-US/app-overview.ts index 5bf0b44563d692..1a4ad9a2910a89 100644 --- a/web/i18n/en-US/app-overview.ts +++ b/web/i18n/en-US/app-overview.ts @@ -53,6 +53,12 @@ const translation = { chatColorThemeDesc: 'Set the color theme of the chatbot', chatColorThemeInverted: 'Inverted', invalidHexMessage: 'Invalid hex value', + sso: { + label: 'SSO ENFORCEMENT', + title: 'Web Application SSO', + description: 'All users are required to login with SSO before using web application', + tooltip: 'Contact the administrator to enable Web Application SSO', + }, more: { entry: 'Show more settings', copyright: 'Copyright', diff --git a/web/i18n/zh-Hans/app-overview.ts b/web/i18n/zh-Hans/app-overview.ts index 556dfe539e7e8b..639869997b9037 100644 --- a/web/i18n/zh-Hans/app-overview.ts +++ b/web/i18n/zh-Hans/app-overview.ts @@ -53,6 +53,12 @@ const translation = { chatColorThemeDesc: '设置聊天机器人的颜色主题', chatColorThemeInverted: '反转', invalidHexMessage: '无效的十六进制值', + sso: { + label: 'SSO ENFORCEMENT', + title: 'Web Application SSO', + description: 'All users are required to login with SSO before using web application', + tooltip: 'Contact the administrator to enable Web Application SSO', + }, more: { entry: '展示更多设置', copyright: '版权', From f8cdc9f6fee67c25702964908ae7f68edb233b5f Mon Sep 17 00:00:00 2001 From: douxc Date: Tue, 6 Aug 2024 14:37:27 +0800 Subject: [PATCH 04/42] feat: add disabled support to tooltip-plus component --- web/app/components/base/tooltip-plus/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/app/components/base/tooltip-plus/index.tsx b/web/app/components/base/tooltip-plus/index.tsx index b833690469459c..1f8a091fa5c9d5 100644 --- a/web/app/components/base/tooltip-plus/index.tsx +++ b/web/app/components/base/tooltip-plus/index.tsx @@ -8,6 +8,7 @@ import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigge export type TooltipProps = { position?: Placement triggerMethod?: 'hover' | 'click' + disabled?: boolean popupContent: React.ReactNode children: React.ReactNode hideArrow?: boolean @@ -23,6 +24,7 @@ const arrow = ( const Tooltip: FC = ({ position = 'top', triggerMethod = 'hover', + disabled = false, popupContent, children, hideArrow, @@ -67,7 +69,7 @@ const Tooltip: FC = ({ return ( Date: Tue, 6 Aug 2024 17:44:32 +0800 Subject: [PATCH 05/42] feat: fetch system features and save to app context --- .../app/overview/settings/index.tsx | 18 +++++++++++++---- web/context/app-context.tsx | 20 ++++++++++++++++++- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx index ac021705574801..be247ea131916a 100644 --- a/web/app/components/app/overview/settings/index.tsx +++ b/web/app/components/app/overview/settings/index.tsx @@ -4,22 +4,25 @@ import React, { useEffect, useState } from 'react' import { ChevronRightIcon } from '@heroicons/react/20/solid' import Link from 'next/link' import { Trans, useTranslation } from 'react-i18next' +import { useContextSelector } from 'use-context-selector' import s from './style.module.css' import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' import AppIcon from '@/app/components/base/app-icon' +import Switch from '@/app/components/base/switch' import { SimpleSelect } from '@/app/components/base/select' import type { AppDetailResponse } from '@/models/app' -import type { Language } from '@/types/app' +import type { AppSSO, Language } from '@/types/app' import EmojiPicker from '@/app/components/base/emoji-picker' import { useToastContext } from '@/app/components/base/toast' import { languages } from '@/i18n/language' -import Switch from '@/app/components/base/switch' +import TooltipPlus from '@/app/components/base/tooltip-plus' +import AppContext from '@/context/app-context' export type ISettingsModalProps = { isChat: boolean - appInfo: AppDetailResponse + appInfo: AppDetailResponse & AppSSO isShow: boolean defaultValue?: string onClose: () => void @@ -39,6 +42,7 @@ export type ConfigParams = { icon: string icon_background: string show_workflow_steps: boolean + enable_sso: boolean } const prefixSettings = 'appOverview.overview.appInfo.settings' @@ -50,6 +54,7 @@ const SettingsModal: FC = ({ onClose, onSave, }) => { + const systemFeatures = useContextSelector(AppContext, state => state.systemFeatures) const { notify } = useToastContext() const [isShowMore, setIsShowMore] = useState(false) const { icon, icon_background } = appInfo @@ -73,6 +78,7 @@ const SettingsModal: FC = ({ privacyPolicy: privacy_policy, customDisclaimer: custom_disclaimer, show_workflow_steps, + enable_sso: appInfo.enable_sso, }) const [language, setLanguage] = useState(default_language) const [saveLoading, setSaveLoading] = useState(false) @@ -91,6 +97,7 @@ const SettingsModal: FC = ({ privacyPolicy: privacy_policy, customDisclaimer: custom_disclaimer, show_workflow_steps, + enable_sso: appInfo.enable_sso, }) setLanguage(default_language) setEmoji({ icon, icon_background }) @@ -139,6 +146,7 @@ const SettingsModal: FC = ({ icon: emoji.icon, icon_background: emoji.icon_background, show_workflow_steps: inputInfo.show_workflow_steps, + enable_sso: inputInfo.enable_sso, } await onSave?.(params) setSaveLoading(false) @@ -214,7 +222,9 @@ const SettingsModal: FC = ({

{t(`${prefixSettings}.sso.label`)}

{t(`${prefixSettings}.sso.title`)}
- + {t(`${prefixSettings}.sso.tooltip`)}
}> + setInputInfo({ ...inputInfo, enable_sso: v })}> +

{t(`${prefixSettings}.sso.description`)}

diff --git a/web/context/app-context.tsx b/web/context/app-context.tsx index db28d28518b4b2..e795dee1d6eb74 100644 --- a/web/context/app-context.tsx +++ b/web/context/app-context.tsx @@ -6,16 +6,18 @@ import { createContext, useContext, useContextSelector } from 'use-context-selec import type { FC, ReactNode } from 'react' import { fetchAppList } from '@/service/apps' import Loading from '@/app/components/base/loading' -import { fetchCurrentWorkspace, fetchLanggeniusVersion, fetchUserProfile } from '@/service/common' +import { fetchCurrentWorkspace, fetchLanggeniusVersion, fetchUserProfile, getSystemFeatures } from '@/service/common' import type { App } from '@/types/app' import { Theme } from '@/types/app' import type { ICurrentWorkspace, LangGeniusVersionResponse, UserProfileResponse } from '@/models/common' import MaintenanceNotice from '@/app/components/header/maintenance-notice' +import type { SystemFeatures } from '@/types/feature' export type AppContextValue = { theme: Theme setTheme: (theme: Theme) => void apps: App[] + systemFeatures: SystemFeatures mutateApps: VoidFunction userProfile: UserProfileResponse mutateUserProfile: VoidFunction @@ -53,6 +55,12 @@ const initialWorkspaceInfo: ICurrentWorkspace = { const AppContext = createContext({ theme: Theme.light, + systemFeatures: { + sso_enforced_for_signin: false, + sso_enforced_for_signin_protocol: '', + sso_enforced_for_web: false, + sso_enforced_for_web_protocol: '', + }, setTheme: () => { }, apps: [], mutateApps: () => { }, @@ -90,6 +98,15 @@ export const AppContextProvider: FC = ({ children }) => const { data: userProfileResponse, mutate: mutateUserProfile } = useSWR({ url: '/account/profile', params: {} }, fetchUserProfile) const { data: currentWorkspaceResponse, mutate: mutateCurrentWorkspace } = useSWR({ url: '/workspaces/current', params: {} }, fetchCurrentWorkspace) + const { data: systemFeatures } = useSWR({ url: '/console/system-features' }, getSystemFeatures, { + fallbackData: { + sso_enforced_for_signin: false, + sso_enforced_for_signin_protocol: '', + sso_enforced_for_web: false, + sso_enforced_for_web_protocol: '', + }, + }) + const [userProfile, setUserProfile] = useState() const [langeniusVersionInfo, setLangeniusVersionInfo] = useState(initialLangeniusVersionInfo) const [currentWorkspace, setCurrentWorkspace] = useState(initialWorkspaceInfo) @@ -136,6 +153,7 @@ export const AppContextProvider: FC = ({ children }) => theme, setTheme: handleSetTheme, apps: appList.data, + systemFeatures, mutateApps, userProfile, mutateUserProfile, From 9e4de4c675b82a173aa0eafd785013ed5fb04d87 Mon Sep 17 00:00:00 2001 From: douxc Date: Wed, 7 Aug 2024 09:49:05 +0800 Subject: [PATCH 06/42] wip: add AppSSO type declare and API --- web/models/app.ts | 3 ++- web/service/apps.ts | 9 ++++++++- web/types/app.ts | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/web/models/app.ts b/web/models/app.ts index 80d121c7a3ec38..c0fc532a37da86 100644 --- a/web/models/app.ts +++ b/web/models/app.ts @@ -1,5 +1,5 @@ import type { LangFuseConfig, LangSmithConfig, TracingProvider } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type' -import type { App, AppTemplate, SiteConfig } from '@/types/app' +import type { App, AppSSO, AppTemplate, SiteConfig } from '@/types/app' /* export type App = { id: string @@ -67,6 +67,7 @@ export type AppListResponse = { } export type AppDetailResponse = App +export type AppSSOResponse = { enabled: AppSSO['enable_sso'] } export type AppTemplatesResponse = { data: AppTemplate[] diff --git a/web/service/apps.ts b/web/service/apps.ts index 3c12de5c6fbcdf..f022e8f6ab0adc 100644 --- a/web/service/apps.ts +++ b/web/service/apps.ts @@ -1,6 +1,6 @@ import type { Fetcher } from 'swr' import { del, get, patch, post, put } from './base' -import type { ApikeysListResponse, AppDailyConversationsResponse, AppDailyEndUsersResponse, AppDetailResponse, AppListResponse, AppStatisticsResponse, AppTemplatesResponse, AppTokenCostsResponse, AppVoicesListResponse, CreateApiKeyResponse, GenerationIntroductionResponse, TracingConfig, TracingStatus, UpdateAppModelConfigResponse, UpdateAppSiteCodeResponse, UpdateOpenAIKeyResponse, ValidateOpenAIKeyResponse, WorkflowDailyConversationsResponse } from '@/models/app' +import type { ApikeysListResponse, AppDailyConversationsResponse, AppDailyEndUsersResponse, AppDetailResponse, AppListResponse, AppSSOResponse, AppStatisticsResponse, AppTemplatesResponse, AppTokenCostsResponse, AppVoicesListResponse, CreateApiKeyResponse, GenerationIntroductionResponse, TracingConfig, TracingStatus, UpdateAppModelConfigResponse, UpdateAppSiteCodeResponse, UpdateOpenAIKeyResponse, ValidateOpenAIKeyResponse, WorkflowDailyConversationsResponse } from '@/models/app' import type { CommonResponse } from '@/models/common' import type { AppMode, ModelConfig } from '@/types/app' import type { TracingProvider } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type' @@ -13,6 +13,13 @@ export const fetchAppDetail = ({ url, id }: { url: string; id: string }) => { return get(`${url}/${id}`) } +export const fetchAppSSO = async (appId: string) => { + return get(`/enterprise/app-setting/sso/${appId}`) +} +export const updateAppSSO = async ({ id, enabled }: { id: string;enabled: boolean }) => { + return put('/enterprise/app-setting/sso', { body: { appId: id, enabled } }) +} + export const fetchAppTemplates: Fetcher = ({ url }) => { return get(url) } diff --git a/web/types/app.ts b/web/types/app.ts index ebf20f2d686b22..5b28268feb2b88 100644 --- a/web/types/app.ts +++ b/web/types/app.ts @@ -337,6 +337,10 @@ export type App = { tags: Tag[] } +export type AppSSO = { + enable_sso: boolean +} + /** * App Template */ From d2ffa72bb9fa6e78f52d7f0d38ce19fda9ef910a Mon Sep 17 00:00:00 2001 From: douxc Date: Wed, 7 Aug 2024 11:12:11 +0800 Subject: [PATCH 07/42] feat: add enable_web_sso_switch_component to system features --- web/context/app-context.tsx | 2 ++ web/types/feature.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/web/context/app-context.tsx b/web/context/app-context.tsx index e795dee1d6eb74..aaf89a021cfb6e 100644 --- a/web/context/app-context.tsx +++ b/web/context/app-context.tsx @@ -60,6 +60,7 @@ const AppContext = createContext({ sso_enforced_for_signin_protocol: '', sso_enforced_for_web: false, sso_enforced_for_web_protocol: '', + enable_web_sso_switch_component: true, }, setTheme: () => { }, apps: [], @@ -104,6 +105,7 @@ export const AppContextProvider: FC = ({ children }) => sso_enforced_for_signin_protocol: '', sso_enforced_for_web: false, sso_enforced_for_web_protocol: '', + enable_web_sso_switch_component: true, }, }) diff --git a/web/types/feature.ts b/web/types/feature.ts index 89af9d21abd4f5..f6fa99dbab1440 100644 --- a/web/types/feature.ts +++ b/web/types/feature.ts @@ -3,6 +3,7 @@ export type SystemFeatures = { sso_enforced_for_signin_protocol: string sso_enforced_for_web: boolean sso_enforced_for_web_protocol: string + enable_web_sso_switch_component: boolean } export const defaultSystemFeatures: SystemFeatures = { @@ -10,4 +11,6 @@ export const defaultSystemFeatures: SystemFeatures = { sso_enforced_for_signin_protocol: '', sso_enforced_for_web: false, sso_enforced_for_web_protocol: '', + // control the visibility of the web sso switch component + enable_web_sso_switch_component: false, } From c51d02ec5c84be0a808cd4807a5fe45a7c88fb76 Mon Sep 17 00:00:00 2001 From: douxc Date: Wed, 7 Aug 2024 11:12:50 +0800 Subject: [PATCH 08/42] wip: handle web sso feature --- .../app/(appDetailLayout)/[appId]/layout.tsx | 14 +++++++-- .../[appId]/overview/cardView.tsx | 29 +++++++++++++++++-- web/app/(shareLayout)/webapp-signin/page.tsx | 26 ++++++++++------- web/app/components/app/overview/appCard.tsx | 3 +- .../app/overview/settings/index.tsx | 13 +++++---- web/app/components/app/store.ts | 6 ++-- web/service/apps.ts | 4 +-- 7 files changed, 67 insertions(+), 28 deletions(-) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx index 09569df8bf10c5..086a657f672da3 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx @@ -15,13 +15,14 @@ import { } from '@remixicon/react' import { useTranslation } from 'react-i18next' import { useShallow } from 'zustand/react/shallow' +import { useContextSelector } from 'use-context-selector' import s from './style.module.css' import cn from '@/utils/classnames' import { useStore } from '@/app/components/app/store' import AppSideBar from '@/app/components/app-sidebar' import type { NavIcon } from '@/app/components/app-sidebar/navLink' -import { fetchAppDetail } from '@/service/apps' -import { useAppContext } from '@/context/app-context' +import { fetchAppDetail, fetchAppSSO } from '@/service/apps' +import AppContext, { useAppContext } from '@/context/app-context' import Loading from '@/app/components/base/loading' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' @@ -52,6 +53,7 @@ const AppDetailLayout: FC = (props) => { icon: NavIcon selectedIcon: NavIcon }>>([]) + const systemFeatures = useContextSelector(AppContext, state => state.systemFeatures) const getNavigations = useCallback((appId: string, isCurrentWorkspaceEditor: boolean, mode: string) => { const navs = [ @@ -114,8 +116,14 @@ const AppDetailLayout: FC = (props) => { router.replace(`/app/${appId}/configuration`) } else { - setAppDetail(res) + // set app sso to false and request from backend + setAppDetail({ ...res, enable_sso: false }) setNavigation(getNavigations(appId, isCurrentWorkspaceEditor, res.mode)) + if (systemFeatures.enable_web_sso_switch_component) { + fetchAppSSO(appId).then((ssoRes) => { + setAppDetail({ ...res, enable_sso: ssoRes.enabled }) + }) + } } }).catch((e: any) => { if (e.status === 404) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx index 5fa9a2e40641bd..e8460dc23098ad 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx @@ -2,22 +2,25 @@ import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' -import { useContext } from 'use-context-selector' +import { useContext, useContextSelector } from 'use-context-selector' import AppCard from '@/app/components/app/overview/appCard' import Loading from '@/app/components/base/loading' import { ToastContext } from '@/app/components/base/toast' import { fetchAppDetail, + fetchAppSSO, + updateAppSSO, updateAppSiteAccessToken, updateAppSiteConfig, updateAppSiteStatus, } from '@/service/apps' -import type { App } from '@/types/app' +import type { App, AppSSO } from '@/types/app' import type { UpdateAppSiteCodeResponse } from '@/models/app' import { asyncRunSafe } from '@/utils' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' import type { IAppCardProps } from '@/app/components/app/overview/appCard' import { useStore as useAppStore } from '@/app/components/app/store' +import AppContext from '@/context/app-context' export type ICardViewProps = { appId: string @@ -28,11 +31,19 @@ const CardView: FC = ({ appId }) => { const { notify } = useContext(ToastContext) const appDetail = useAppStore(state => state.appDetail) const setAppDetail = useAppStore(state => state.setAppDetail) + const userProfile = useContextSelector(AppContext, state => state.userProfile) + const systemFeatures = useContextSelector(AppContext, state => state.systemFeatures) const updateAppDetail = async () => { fetchAppDetail({ url: '/apps', id: appId }).then((res) => { - setAppDetail(res) + setAppDetail({ ...appDetail, ...res }) }) + // update sso setting + if (systemFeatures.enable_web_sso_switch_component) { + fetchAppSSO(appId).then((res) => { + setAppDetail({ ...appDetail!, enable_sso: res.enabled }) + }) + } } const handleCallbackResult = (err: Error | null, message?: string) => { @@ -81,6 +92,18 @@ const CardView: FC = ({ appId }) => { if (!err) localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') + if (systemFeatures.enable_web_sso_switch_component) { + // backend service does not get userId from session or gateway, so we need to pass userId to backend + // we should remove this when backend service can get userId from session or gateway + const [sso_err] = await asyncRunSafe( + updateAppSSO({ id: appId, userId: userProfile.id, enabled: params.enable_sso }) as Promise, + ) + if (sso_err) { + handleCallbackResult(sso_err) + return + } + } + handleCallbackResult(err) } diff --git a/web/app/(shareLayout)/webapp-signin/page.tsx b/web/app/(shareLayout)/webapp-signin/page.tsx index 12f4152c6f9f0a..478cb963102cbe 100644 --- a/web/app/(shareLayout)/webapp-signin/page.tsx +++ b/web/app/(shareLayout)/webapp-signin/page.tsx @@ -7,6 +7,7 @@ import Toast from '@/app/components/base/toast' import { fetchSystemFeatures, fetchWebOAuth2SSOUrl, fetchWebOIDCSSOUrl, fetchWebSAMLSSOUrl } from '@/service/share' import { setAccessToken } from '@/app/components/share/utils' import Loading from '@/app/components/base/loading' +import { fetchAppSSO } from '@/service/apps' const WebSSOForm: FC = () => { const searchParams = useSearchParams() @@ -15,6 +16,7 @@ const WebSSOForm: FC = () => { const redirectUrl = searchParams.get('redirect_url') const tokenFromUrl = searchParams.get('web_sso_token') const message = searchParams.get('message') + const appId = searchParams.get('app_id') const showErrorToast = (message: string) => { Toast.notify({ @@ -73,16 +75,20 @@ const WebSSOForm: FC = () => { useEffect(() => { const init = async () => { const res = await fetchSystemFeatures() - const protocol = res.sso_enforced_for_web_protocol - - if (message) { - showErrorToast(message) - return - } - - if (!tokenFromUrl) { - await handleSSOLogin(protocol) - return + const appSettings = await fetchAppSSO(appId!) + // do sso when system & app sso is enabled + if (res.sso_enforced_for_web && appSettings.enabled) { + const protocol = res.sso_enforced_for_web_protocol + + if (message) { + showErrorToast(message) + return + } + + if (!tokenFromUrl) { + await handleSSOLogin(protocol) + return + } } await processTokenAndRedirect() diff --git a/web/app/components/app/overview/appCard.tsx b/web/app/components/app/overview/appCard.tsx index ccf1f8ef1a5fe9..ca05e55a548a56 100644 --- a/web/app/components/app/overview/appCard.tsx +++ b/web/app/components/app/overview/appCard.tsx @@ -27,10 +27,11 @@ import ShareQRCode from '@/app/components/base/qrcode' import SecretKeyButton from '@/app/components/develop/secret-key/secret-key-button' import type { AppDetailResponse } from '@/models/app' import { useAppContext } from '@/context/app-context' +import type { AppSSO } from '@/types/app' export type IAppCardProps = { className?: string - appInfo: AppDetailResponse + appInfo: AppDetailResponse & Partial cardType?: 'api' | 'webapp' customBgColor?: string onChangeStatus: (val: boolean) => Promise diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx index be247ea131916a..0ddb747a60052d 100644 --- a/web/app/components/app/overview/settings/index.tsx +++ b/web/app/components/app/overview/settings/index.tsx @@ -22,7 +22,7 @@ import AppContext from '@/context/app-context' export type ISettingsModalProps = { isChat: boolean - appInfo: AppDetailResponse & AppSSO + appInfo: AppDetailResponse & Partial isShow: boolean defaultValue?: string onClose: () => void @@ -146,7 +146,7 @@ const SettingsModal: FC = ({ icon: emoji.icon, icon_background: emoji.icon_background, show_workflow_steps: inputInfo.show_workflow_steps, - enable_sso: inputInfo.enable_sso, + enable_sso: inputInfo.enable_sso!, } await onSave?.(params) setSaveLoading(false) @@ -218,16 +218,17 @@ const SettingsModal: FC = ({ placeholder='E.g #A020F0' /> } -
+ {/* only show when enable sso feature */} + {systemFeatures.enable_web_sso_switch_component &&

{t(`${prefixSettings}.sso.label`)}

{t(`${prefixSettings}.sso.title`)}
- {t(`${prefixSettings}.sso.tooltip`)}
}> - setInputInfo({ ...inputInfo, enable_sso: v })}> + {t(`${prefixSettings}.sso.tooltip`)}
}> + setInputInfo({ ...inputInfo, enable_sso: v })}>

{t(`${prefixSettings}.sso.description`)}

-
+ } {!isShowMore &&
setIsShowMore(true)}>
{t(`${prefixSettings}.more.entry`)}
diff --git a/web/app/components/app/store.ts b/web/app/components/app/store.ts index a89b96d65dfbef..0209102372d9c6 100644 --- a/web/app/components/app/store.ts +++ b/web/app/components/app/store.ts @@ -1,9 +1,9 @@ import { create } from 'zustand' -import type { App } from '@/types/app' +import type { App, AppSSO } from '@/types/app' import type { IChatItem } from '@/app/components/base/chat/chat/type' type State = { - appDetail?: App + appDetail?: App & Partial appSidebarExpand: string currentLogItem?: IChatItem currentLogModalActiveTab: string @@ -13,7 +13,7 @@ type State = { } type Action = { - setAppDetail: (appDetail?: App) => void + setAppDetail: (appDetail?: App & Partial) => void setAppSiderbarExpand: (state: string) => void setCurrentLogItem: (item?: IChatItem) => void setCurrentLogModalActiveTab: (tab: string) => void diff --git a/web/service/apps.ts b/web/service/apps.ts index f022e8f6ab0adc..bb627c372982bb 100644 --- a/web/service/apps.ts +++ b/web/service/apps.ts @@ -16,8 +16,8 @@ export const fetchAppDetail = ({ url, id }: { url: string; id: string }) => { export const fetchAppSSO = async (appId: string) => { return get(`/enterprise/app-setting/sso/${appId}`) } -export const updateAppSSO = async ({ id, enabled }: { id: string;enabled: boolean }) => { - return put('/enterprise/app-setting/sso', { body: { appId: id, enabled } }) +export const updateAppSSO = async ({ id, userId, enabled }: { id: string;userId: string;enabled: boolean }) => { + return put('/enterprise/app-setting/sso', { body: { appId: id, userId, enabled } }) } export const fetchAppTemplates: Fetcher = ({ url }) => { From 844df738b89ea950dc762f0e5535d63f51778327 Mon Sep 17 00:00:00 2001 From: douxc Date: Wed, 7 Aug 2024 15:14:15 +0800 Subject: [PATCH 09/42] wip: put params in url while query app sso settings --- .../app/(appDetailLayout)/[appId]/layout.tsx | 2 +- .../app/(appDetailLayout)/[appId]/overview/cardView.tsx | 2 +- web/app/(shareLayout)/webapp-signin/page.tsx | 3 +-- web/service/apps.ts | 7 +++++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx index 086a657f672da3..38e8ce0195f8e7 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx @@ -120,7 +120,7 @@ const AppDetailLayout: FC = (props) => { setAppDetail({ ...res, enable_sso: false }) setNavigation(getNavigations(appId, isCurrentWorkspaceEditor, res.mode)) if (systemFeatures.enable_web_sso_switch_component) { - fetchAppSSO(appId).then((ssoRes) => { + fetchAppSSO({ appId }).then((ssoRes) => { setAppDetail({ ...res, enable_sso: ssoRes.enabled }) }) } diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx index e8460dc23098ad..5345851aff355c 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx @@ -40,7 +40,7 @@ const CardView: FC = ({ appId }) => { }) // update sso setting if (systemFeatures.enable_web_sso_switch_component) { - fetchAppSSO(appId).then((res) => { + fetchAppSSO({ appId }).then((res) => { setAppDetail({ ...appDetail!, enable_sso: res.enabled }) }) } diff --git a/web/app/(shareLayout)/webapp-signin/page.tsx b/web/app/(shareLayout)/webapp-signin/page.tsx index 478cb963102cbe..5669db09cefb26 100644 --- a/web/app/(shareLayout)/webapp-signin/page.tsx +++ b/web/app/(shareLayout)/webapp-signin/page.tsx @@ -16,7 +16,6 @@ const WebSSOForm: FC = () => { const redirectUrl = searchParams.get('redirect_url') const tokenFromUrl = searchParams.get('web_sso_token') const message = searchParams.get('message') - const appId = searchParams.get('app_id') const showErrorToast = (message: string) => { Toast.notify({ @@ -75,7 +74,7 @@ const WebSSOForm: FC = () => { useEffect(() => { const init = async () => { const res = await fetchSystemFeatures() - const appSettings = await fetchAppSSO(appId!) + const appSettings = await fetchAppSSO({ appCode: getAppCodeFromRedirectUrl()! }) // do sso when system & app sso is enabled if (res.sso_enforced_for_web && appSettings.enabled) { const protocol = res.sso_enforced_for_web_protocol diff --git a/web/service/apps.ts b/web/service/apps.ts index bb627c372982bb..b32eb5af70c068 100644 --- a/web/service/apps.ts +++ b/web/service/apps.ts @@ -13,8 +13,11 @@ export const fetchAppDetail = ({ url, id }: { url: string; id: string }) => { return get(`${url}/${id}`) } -export const fetchAppSSO = async (appId: string) => { - return get(`/enterprise/app-setting/sso/${appId}`) +export const fetchAppSSO = async ({ appId, appCode }: { appId?: string;appCode?: string }) => { + if (appId) + return get(`/enterprise/app-setting/sso?appId=${appId}`) + + return get(`/enterprise/app-setting/sso?appCode=${appCode}`) } export const updateAppSSO = async ({ id, userId, enabled }: { id: string;userId: string;enabled: boolean }) => { return put('/enterprise/app-setting/sso', { body: { appId: id, userId, enabled } }) From ef3d3cea151c2cc590f359f8acb610de1e4399a7 Mon Sep 17 00:00:00 2001 From: douxc Date: Wed, 7 Aug 2024 16:42:19 +0800 Subject: [PATCH 10/42] revert webapp-signin page --- web/app/(shareLayout)/webapp-signin/page.tsx | 25 ++++++++------------ 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/web/app/(shareLayout)/webapp-signin/page.tsx b/web/app/(shareLayout)/webapp-signin/page.tsx index 5669db09cefb26..12f4152c6f9f0a 100644 --- a/web/app/(shareLayout)/webapp-signin/page.tsx +++ b/web/app/(shareLayout)/webapp-signin/page.tsx @@ -7,7 +7,6 @@ import Toast from '@/app/components/base/toast' import { fetchSystemFeatures, fetchWebOAuth2SSOUrl, fetchWebOIDCSSOUrl, fetchWebSAMLSSOUrl } from '@/service/share' import { setAccessToken } from '@/app/components/share/utils' import Loading from '@/app/components/base/loading' -import { fetchAppSSO } from '@/service/apps' const WebSSOForm: FC = () => { const searchParams = useSearchParams() @@ -74,20 +73,16 @@ const WebSSOForm: FC = () => { useEffect(() => { const init = async () => { const res = await fetchSystemFeatures() - const appSettings = await fetchAppSSO({ appCode: getAppCodeFromRedirectUrl()! }) - // do sso when system & app sso is enabled - if (res.sso_enforced_for_web && appSettings.enabled) { - const protocol = res.sso_enforced_for_web_protocol - - if (message) { - showErrorToast(message) - return - } - - if (!tokenFromUrl) { - await handleSSOLogin(protocol) - return - } + const protocol = res.sso_enforced_for_web_protocol + + if (message) { + showErrorToast(message) + return + } + + if (!tokenFromUrl) { + await handleSSOLogin(protocol) + return } await processTokenAndRedirect() From 8bfc37ebc700ca8cd0dce8405e63713486465f08 Mon Sep 17 00:00:00 2001 From: Yi Date: Wed, 7 Aug 2024 16:49:51 +0800 Subject: [PATCH 11/42] replace old tooltip components to the new one --- .../[appId]/overview/tracing/config-popup.tsx | 1 + .../(commonLayout)/datasets/DatasetCard.tsx | 16 ++-- .../config-prompt/advanced-prompt-input.tsx | 18 ++--- .../config-prompt/simple-prompt-input.tsx | 20 +++-- .../app/configuration/config-var/index.tsx | 16 ++-- .../app/configuration/config-vision/index.tsx | 18 ++--- .../config-vision/param-config-content.tsx | 22 ++--- .../config-voice/param-config-content.tsx | 22 ++--- .../config/agent/agent-setting/item-panel.tsx | 12 ++- .../config/agent/agent-tools/index.tsx | 14 ++-- .../dataset-config/card-item/index.tsx | 12 +-- .../dataset-config/context-var/index.tsx | 21 +++-- .../index.tsx | 18 ++--- .../annotation/annotation-ctrl-btn/index.tsx | 6 +- .../toolbox/annotation/config-param.tsx | 9 +-- web/app/components/app/log/list.tsx | 5 +- web/app/components/app/overview/appCard.tsx | 18 ++--- .../app/overview/embedded/index.tsx | 9 +-- .../base/chat/chat/answer/operation.tsx | 15 +++- .../components/base/chat/chat/chat-input.tsx | 1 + .../base/chat/embedded-chatbot/header.tsx | 10 +-- .../base/chat/embedded-chatbot/index.tsx | 10 +-- web/app/components/base/copy-btn/index.tsx | 15 ++-- .../components/base/copy-feedback/index.tsx | 9 +-- web/app/components/base/copy-icon/index.tsx | 1 + .../text-to-speech/param-config-content.tsx | 22 ++--- web/app/components/base/param-item/index.tsx | 13 ++- web/app/components/base/qrcode/index.tsx | 9 +-- .../components/base/tooltip-plus/index.tsx | 6 +- .../components/billing/usage-info/index.tsx | 16 ++-- .../common/retrieval-param-config/index.tsx | 23 +++--- .../components/datasets/documents/list.tsx | 21 ++--- .../datasets/hit-testing/textarea.tsx | 18 ++--- .../develop/secret-key/input-copy.tsx | 38 +++++---- .../develop/secret-key/secret-key-modal.tsx | 10 +-- .../members-page/invited-modal/index.tsx | 10 +-- .../invited-modal/invitation-link.tsx | 20 +++-- .../model-parameter-modal/parameter-item.tsx | 15 ++-- .../provider-added-card/priority-use-tip.tsx | 10 +-- .../system-model-selector/index.tsx | 80 ++++++++++--------- .../share/text-generation/result/header.tsx | 34 ++++---- .../config-credentials.tsx | 16 ++-- .../components/tools/workflow-tool/index.tsx | 15 ++-- 43 files changed, 332 insertions(+), 362 deletions(-) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx index a5cbc587bd4122..93ee303d436920 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx @@ -121,6 +121,7 @@ const ConfigPopup: FC = ({ ? ( {switchContent} diff --git a/web/app/(commonLayout)/datasets/DatasetCard.tsx b/web/app/(commonLayout)/datasets/DatasetCard.tsx index 096d9d357e60f3..368edd6d6f852b 100644 --- a/web/app/(commonLayout)/datasets/DatasetCard.tsx +++ b/web/app/(commonLayout)/datasets/DatasetCard.tsx @@ -4,15 +4,13 @@ import { useContext } from 'use-context-selector' import { useRouter } from 'next/navigation' import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { - RiMoreFill, -} from '@remixicon/react' +import { RiMoreFill } from '@remixicon/react' import cn from '@/utils/classnames' import Confirm from '@/app/components/base/confirm' import { ToastContext } from '@/app/components/base/toast' import { checkIsUsedInApp, deleteDataset } from '@/service/datasets' import type { DataSet } from '@/models/datasets' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import { Folder } from '@/app/components/base/icons/src/vender/solid/files' import type { HtmlContentProps } from '@/app/components/base/popover' import CustomPopover from '@/app/components/base/popover' @@ -128,12 +126,12 @@ const DatasetCard = ({
{dataset.name}
{!dataset.embedding_available && ( - - {t('dataset.unavailable')} - + {t('dataset.unavailable')} + )}
diff --git a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx index fb3ceadc0d8bcf..50211604a17ff9 100644 --- a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx @@ -9,7 +9,6 @@ import produce from 'immer' import { RiDeleteBinLine, RiErrorWarningFill, - RiQuestionLine, } from '@remixicon/react' import s from './style.module.css' import MessageTypeSelector from './message-type-selector' @@ -21,7 +20,7 @@ import { Clipboard, ClipboardCheck, } from '@/app/components/base/icons/src/vender/line/files' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import PromptEditor from '@/app/components/base/prompt-editor' import ConfigContext from '@/context/debug-configuration' import { getNewVar, getVars } from '@/utils/var' @@ -173,13 +172,14 @@ const AdvancedPromptInput: FC = ({
{t('appDebug.pageTitle.line1')}
- - {t('appDebug.promptTip')} -
} - selector='config-prompt-tooltip'> - - + + {t('appDebug.promptTip')} +
+ } + needsDelay={false} + />
)}
{canDelete && ( diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx index 628e8c68d6e8a3..f5d75d2bbd6aab 100644 --- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx @@ -3,9 +3,6 @@ import type { FC } from 'react' import React, { useState } from 'react' import { useTranslation } from 'react-i18next' import { useBoolean } from 'ahooks' -import { - RiQuestionLine, -} from '@remixicon/react' import produce from 'immer' import { useContext } from 'use-context-selector' import ConfirmAddVar from './confirm-add-var' @@ -13,7 +10,7 @@ import s from './style.module.css' import PromptEditorHeightResizeWrap from './prompt-editor-height-resize-wrap' import cn from '@/utils/classnames' import { type PromptVariable } from '@/models/debug' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import type { CompletionParams } from '@/types/app' import { AppType } from '@/types/app' import { getNewVar, getVars } from '@/utils/var' @@ -156,13 +153,14 @@ const Prompt: FC = ({
{mode !== AppType.completion ? t('appDebug.chatSubTitle') : t('appDebug.completionSubTitle')}
{!readonly && ( - - {t('appDebug.promptTip')} -
} - selector='config-prompt-tooltip'> - - + + {t('appDebug.promptTip')} +
+ } + needsDelay={false} + /> )}
diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsx index 82a220c6db9bbd..0299025c256f0f 100644 --- a/web/app/components/app/configuration/config-var/index.tsx +++ b/web/app/components/app/configuration/config-var/index.tsx @@ -8,7 +8,6 @@ import { useContext } from 'use-context-selector' import produce from 'immer' import { RiDeleteBinLine, - RiQuestionLine, } from '@remixicon/react' import Panel from '../base/feature-panel' import EditModal from './config-modal' @@ -17,7 +16,7 @@ import type { IInputTypeIconProps } from './input-type-icon' import s from './style.module.css' import SelectVarType from './select-var-type' import { BracketsX as VarIcon } from '@/app/components/base/icons/src/vender/line/development' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import type { PromptVariable } from '@/models/debug' import { DEFAULT_VALUE_MAX_LEN, getMaxVarNameLength } from '@/config' import { checkKeys, getNewVar } from '@/utils/var' @@ -282,11 +281,14 @@ const ConfigVar: FC = ({ promptVariables, readonly, onPromptVar
{t('appDebug.variableTitle')}
{!readonly && ( - - {t('appDebug.variableTip')} -
} selector='config-var-tooltip'> - - + + {t('appDebug.variableTip')} +
+ } + needsDelay={false} + /> )} } diff --git a/web/app/components/app/configuration/config-vision/index.tsx b/web/app/components/app/configuration/config-vision/index.tsx index 9b12e059b57cfb..7305518800fae5 100644 --- a/web/app/components/app/configuration/config-vision/index.tsx +++ b/web/app/components/app/configuration/config-vision/index.tsx @@ -2,13 +2,10 @@ import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' -import { - RiQuestionLine, -} from '@remixicon/react' import { useContext } from 'use-context-selector' import Panel from '../base/feature-panel' import ParamConfig from './param-config' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import Switch from '@/app/components/base/switch' import { Eye } from '@/app/components/base/icons/src/vender/solid/general' import ConfigContext from '@/context/debug-configuration' @@ -33,11 +30,14 @@ const ConfigVision: FC = () => { title={
{t('appDebug.vision.name')}
- - {t('appDebug.vision.description')} -
} selector='config-vision-tooltip'> - - + + {t('appDebug.vision.description')} + + } + needsDelay={false} + /> } headerRight={ diff --git a/web/app/components/app/configuration/config-vision/param-config-content.tsx b/web/app/components/app/configuration/config-vision/param-config-content.tsx index 89fad411e70f47..90ec71cde7579d 100644 --- a/web/app/components/app/configuration/config-vision/param-config-content.tsx +++ b/web/app/components/app/configuration/config-vision/param-config-content.tsx @@ -3,14 +3,11 @@ import type { FC } from 'react' import React from 'react' import { useContext } from 'use-context-selector' import { useTranslation } from 'react-i18next' -import { - RiQuestionLine, -} from '@remixicon/react' import RadioGroup from './radio-group' import ConfigContext from '@/context/debug-configuration' import { Resolution, TransferMethod } from '@/types/app' import ParamItem from '@/app/components/base/param-item' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' const MIN = 1 const MAX = 6 @@ -37,13 +34,16 @@ const ParamConfigContent: FC = () => {
{t('appDebug.vision.visionSettings.resolution')}
- - {t('appDebug.vision.visionSettings.resolutionTooltip').split('\n').map(item => ( -
{item}
- ))} -
} selector='config-resolution-tooltip'> - - + + {t('appDebug.vision.visionSettings.resolutionTooltip').split('\n').map(item => ( +
{item}
+ ))} +
+ } + needsDelay={false} + /> { @@ -50,13 +47,16 @@ const VoiceParamConfig: FC = () => {
{t('appDebug.voice.voiceSettings.language')}
- - {t('appDebug.voice.voiceSettings.resolutionTooltip').split('\n').map(item => ( -
{item}
- ))} -
} selector='config-resolution-tooltip'> - - + + {t('appDebug.voice.voiceSettings.resolutionTooltip').split('\n').map(item => ( +
{item}
+ ))} + + } + needsDelay={false} + /> = ({
{icon}
{name}
- {description}
} - selector={`agent-setting-tooltip-${name}`} + needsDelay={false} > - - +
{children} diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx index 16f2257c38d175..88d19fcc872c7c 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx @@ -7,13 +7,11 @@ import produce from 'immer' import { RiDeleteBinLine, RiHammerFill, - RiQuestionLine, } from '@remixicon/react' import { useFormattingChangedDispatcher } from '../../../debug/hooks' import SettingBuiltInTool from './setting-built-in-tool' import cn from '@/utils/classnames' import Panel from '@/app/components/app/configuration/base/feature-panel' -import Tooltip from '@/app/components/base/tooltip' import { InfoCircle } from '@/app/components/base/icons/src/vender/line/general' import OperationBtn from '@/app/components/app/configuration/base/operation-btn' import AppIcon from '@/app/components/base/app-icon' @@ -68,11 +66,13 @@ const AgentTools: FC = () => { title={
{t('appDebug.agent.tools.name')}
- - {t('appDebug.agent.tools.description')} -
} selector='config-tools-tooltip'> - - + + {t('appDebug.agent.tools.description')} +
+ } + /> } headerRight={ diff --git a/web/app/components/app/configuration/dataset-config/card-item/index.tsx b/web/app/components/app/configuration/dataset-config/card-item/index.tsx index 7b369d9d79847f..6c9c61884ed0c0 100644 --- a/web/app/components/app/configuration/dataset-config/card-item/index.tsx +++ b/web/app/components/app/configuration/dataset-config/card-item/index.tsx @@ -8,7 +8,7 @@ import s from './style.module.css' import cn from '@/utils/classnames' import type { DataSet } from '@/models/datasets' import { formatNumber } from '@/utils/format' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' export type ICardItemProps = { className?: string @@ -38,12 +38,12 @@ const CardItem: FC = ({
{config.name}
{!config.embedding_available && ( - - {t('dataset.unavailable')} - + {t('dataset.unavailable')} + )}
diff --git a/web/app/components/app/configuration/dataset-config/context-var/index.tsx b/web/app/components/app/configuration/dataset-config/context-var/index.tsx index be0ae472423863..58fdc7bdefbcf5 100644 --- a/web/app/components/app/configuration/dataset-config/context-var/index.tsx +++ b/web/app/components/app/configuration/dataset-config/context-var/index.tsx @@ -2,14 +2,11 @@ import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' -import { - RiQuestionLine, -} from '@remixicon/react' import type { Props } from './var-picker' import VarPicker from './var-picker' import cn from '@/utils/classnames' import { BracketsX } from '@/app/components/base/icons/src/vender/line/development' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' const ContextVar: FC = (props) => { const { t } = useTranslation() @@ -23,14 +20,14 @@ const ContextVar: FC = (props) => {
{t('appDebug.feature.dataSet.queryVariable.title')}
- - {t('appDebug.feature.dataSet.queryVariable.tip')} - } - selector='context-var-tooltip' - > - - + + {t('appDebug.feature.dataSet.queryVariable.tip')} + + } + needsDelay={false} + /> diff --git a/web/app/components/app/configuration/features/chat-group/suggested-questions-after-answer/index.tsx b/web/app/components/app/configuration/features/chat-group/suggested-questions-after-answer/index.tsx index e27eec46c8b683..ba8296cd748f25 100644 --- a/web/app/components/app/configuration/features/chat-group/suggested-questions-after-answer/index.tsx +++ b/web/app/components/app/configuration/features/chat-group/suggested-questions-after-answer/index.tsx @@ -2,12 +2,9 @@ import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' -import { - RiQuestionLine, -} from '@remixicon/react' import Panel from '@/app/components/app/configuration/base/feature-panel' import SuggestedQuestionsAfterAnswerIcon from '@/app/components/app/configuration/base/icons/suggested-questions-after-answer-icon' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' const SuggestedQuestionsAfterAnswer: FC = () => { const { t } = useTranslation() @@ -17,11 +14,14 @@ const SuggestedQuestionsAfterAnswer: FC = () => { title={
{t('appDebug.feature.suggestedQuestionsAfterAnswer.title')}
- - {t('appDebug.feature.suggestedQuestionsAfterAnswer.description')} -
} selector='suggestion-question-tooltip'> - - + + {t('appDebug.feature.suggestedQuestionsAfterAnswer.description')} + + } + needsDelay={false} + /> } headerIcon={} diff --git a/web/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn/index.tsx b/web/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn/index.tsx index b2c6792107e322..2e917e9ec711e0 100644 --- a/web/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn/index.tsx +++ b/web/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn/index.tsx @@ -100,7 +100,8 @@ const CacheCtrlBtn: FC = ({ : answer ? (
= ({ : null }
popupContent={
{tooltip}
} - > - - + iconStyle='w-3.5 h-3.5' + needsDelay={false} + />
{children}
diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index 00d7ffb0fbb206..4c5e820765e5bf 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -5,10 +5,9 @@ import useSWR from 'swr' import { HandThumbDownIcon, HandThumbUpIcon, - InformationCircleIcon, XMarkIcon, } from '@heroicons/react/24/outline' -import { RiEditFill } from '@remixicon/react' +import { RiEditFill, RiQuestionLine } from '@remixicon/react' import { get } from 'lodash-es' import InfiniteScroll from 'react-infinite-scroll-component' import dayjs from 'dayjs' @@ -379,7 +378,7 @@ function DetailPanel {targetTone} - + } htmlContent={
diff --git a/web/app/components/app/overview/appCard.tsx b/web/app/components/app/overview/appCard.tsx index ccf1f8ef1a5fe9..d6de6b528544f8 100644 --- a/web/app/components/app/overview/appCard.tsx +++ b/web/app/components/app/overview/appCard.tsx @@ -14,7 +14,7 @@ import EmbeddedModal from './embedded' import CustomizeModal from './customize' import style from './style.module.css' import type { ConfigParams } from './settings' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import AppBasic from '@/app/components/app-sidebar/basic' import { asyncRunSafe, randomString } from '@/utils' import Button from '@/app/components/base/button' @@ -193,9 +193,8 @@ function AppCard({ /> )} {isApp && isCurrentWorkspaceManager && ( -
- + )}
@@ -225,18 +224,17 @@ function AppCard({ onClick={genClickFuncByName(op.opName)} disabled={disabled} > -
{op.opName}
-
+
) })} diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx index 9e5d5af0dad838..5685d996d94fc6 100644 --- a/web/app/components/app/overview/embedded/index.tsx +++ b/web/app/components/app/overview/embedded/index.tsx @@ -5,7 +5,7 @@ import style from './style.module.css' import cn from '@/utils/classnames' import Modal from '@/app/components/base/modal' import copyStyle from '@/app/components/base/copy-btn/style.module.css' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import { useAppContext } from '@/context/app-context' import { IS_CE_EDITION } from '@/config' import type { SiteInfo } from '@/models/share' @@ -152,14 +152,13 @@ const Embedded = ({ siteInfo, isShow, onClose, appBaseUrl, accessToken, classNam {t(`${prefixEmbedded}.${option}`)}
-
-
+
diff --git a/web/app/components/base/chat/chat/answer/operation.tsx b/web/app/components/base/chat/chat/answer/operation.tsx index 8ec5c0f3b23893..419fd3718905bd 100644 --- a/web/app/components/base/chat/chat/answer/operation.tsx +++ b/web/app/components/base/chat/chat/answer/operation.tsx @@ -162,7 +162,10 @@ const Operation: FC = ({ { config?.supportFeedback && !localFeedback?.rating && onFeedback && !isOpeningStatement && (
- +
handleFeedback('like')} @@ -170,7 +173,10 @@ const Operation: FC = ({
- +
handleFeedback('dislike')} @@ -183,7 +189,10 @@ const Operation: FC = ({ } { config?.supportFeedback && localFeedback?.rating && onFeedback && !isOpeningStatement && ( - +
= ({
{t('common.operation.lineBreak')} Shift Enter
} + needsDelay={false} > {sendBtn}
diff --git a/web/app/components/base/chat/embedded-chatbot/header.tsx b/web/app/components/base/chat/embedded-chatbot/header.tsx index c35f98e3f29aef..e2b97e834b10e3 100644 --- a/web/app/components/base/chat/embedded-chatbot/header.tsx +++ b/web/app/components/base/chat/embedded-chatbot/header.tsx @@ -4,7 +4,7 @@ import { RiRefreshLine } from '@remixicon/react' import { useTranslation } from 'react-i18next' import type { Theme } from './theme/theme-context' import { CssTransform } from './theme/utils' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' export type IHeaderProps = { isMobile?: boolean @@ -40,17 +40,15 @@ const Header: FC = ({ {title}
-
{ onCreateNewChat?.() }}>
-
+
) } diff --git a/web/app/components/base/chat/embedded-chatbot/index.tsx b/web/app/components/base/chat/embedded-chatbot/index.tsx index d34fe164d1ad1f..91116b0812c10d 100644 --- a/web/app/components/base/chat/embedded-chatbot/index.tsx +++ b/web/app/components/base/chat/embedded-chatbot/index.tsx @@ -21,7 +21,7 @@ import LogoHeader from '@/app/components/base/logo/logo-embeded-chat-header' import Header from '@/app/components/base/chat/embedded-chatbot/header' import ConfigPanel from '@/app/components/base/chat/embedded-chatbot/config-panel' import ChatWrapper from '@/app/components/base/chat/embedded-chatbot/chat-wrapper' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' const Chatbot = () => { const { t } = useTranslation() @@ -87,15 +87,13 @@ const Chatbot = () => {
{!isMobile && (
-
-
+
)} diff --git a/web/app/components/base/copy-btn/index.tsx b/web/app/components/base/copy-btn/index.tsx index a03b99105740e7..29171fd811d2f4 100644 --- a/web/app/components/base/copy-btn/index.tsx +++ b/web/app/components/base/copy-btn/index.tsx @@ -1,10 +1,9 @@ 'use client' -import { useRef, useState } from 'react' +import { useState } from 'react' import { t } from 'i18next' import copy from 'copy-to-clipboard' import s from './style.module.css' -import Tooltip from '@/app/components/base/tooltip' -import { randomString } from '@/utils' +import TooltipPlus from '@/app/components/base/tooltip-plus' type ICopyBtnProps = { value: string @@ -18,14 +17,12 @@ const CopyBtn = ({ isPlain, }: ICopyBtnProps) => { const [isCopied, setIsCopied] = useState(false) - const selector = useRef(`copy-tooltip-${randomString(4)}`) return (
-
-
+
) } diff --git a/web/app/components/base/copy-feedback/index.tsx b/web/app/components/base/copy-feedback/index.tsx index e58ce9c819beb8..77f7c0bb375469 100644 --- a/web/app/components/base/copy-feedback/index.tsx +++ b/web/app/components/base/copy-feedback/index.tsx @@ -3,7 +3,6 @@ import React, { useState } from 'react' import { useTranslation } from 'react-i18next' import { debounce } from 'lodash-es' import copy from 'copy-to-clipboard' -import Tooltip from '../tooltip' import TooltipPlus from '../tooltip-plus' import copyStyle from './style.module.css' @@ -29,13 +28,13 @@ const CopyFeedback = ({ content, selectorId, className }: Props) => { }, 100) return ( -
{ }`} >
- +
) } diff --git a/web/app/components/base/copy-icon/index.tsx b/web/app/components/base/copy-icon/index.tsx index 0eb0356ffee28c..c86be92c207233 100644 --- a/web/app/components/base/copy-icon/index.tsx +++ b/web/app/components/base/copy-icon/index.tsx @@ -35,6 +35,7 @@ export const CopyIcon = ({ content }: Props) => { ? t(`${prefixEmbedded}.copied`) : t(`${prefixEmbedded}.copy`)) || '' } + needsDelay={false} >
{!isCopied diff --git a/web/app/components/base/features/feature-panel/text-to-speech/param-config-content.tsx b/web/app/components/base/features/feature-panel/text-to-speech/param-config-content.tsx index a5a2eb7bb70e34..b4afea1902c180 100644 --- a/web/app/components/base/features/feature-panel/text-to-speech/param-config-content.tsx +++ b/web/app/components/base/features/feature-panel/text-to-speech/param-config-content.tsx @@ -2,9 +2,6 @@ import useSWR from 'swr' import produce from 'immer' import React, { Fragment } from 'react' -import { - RiQuestionLine, -} from '@remixicon/react' import { usePathname } from 'next/navigation' import { useTranslation } from 'react-i18next' import { Listbox, Transition } from '@headlessui/react' @@ -17,7 +14,7 @@ import type { OnFeaturesChange } from '../../types' import classNames from '@/utils/classnames' import type { Item } from '@/app/components/base/select' import { fetchAppVoices } from '@/service/apps' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import { languages } from '@/i18n/language' import RadioGroup from '@/app/components/app/configuration/config-vision/radio-group' import { TtsAutoPlay } from '@/types/app' @@ -74,13 +71,16 @@ const VoiceParamConfig = ({
{t('appDebug.voice.voiceSettings.language')}
- - {t('appDebug.voice.voiceSettings.resolutionTooltip').split('\n').map(item => ( -
{item}
- ))} -
} selector='config-resolution-tooltip'> - - + + {t('appDebug.voice.voiceSettings.resolutionTooltip').split('\n').map(item => ( +
{item} +
+ ))} +
+ } + /> = ({ className, id, name, noTooltip, tip, step = 0.1, )} {name} {!noTooltip && ( - {tip}}> - - + {tip}} + needsDelay={false} + /> )} diff --git a/web/app/components/base/qrcode/index.tsx b/web/app/components/base/qrcode/index.tsx index 721f8c90294443..4458860b3d5c8a 100644 --- a/web/app/components/base/qrcode/index.tsx +++ b/web/app/components/base/qrcode/index.tsx @@ -2,8 +2,8 @@ import React, { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import QRCode from 'qrcode.react' -import Tooltip from '../tooltip' import QrcodeStyle from './style.module.css' +import TooltipPlus from '@/app/components/base/tooltip-plus' type Props = { content: string @@ -50,9 +50,8 @@ const ShareQRCode = ({ content, selectorId, className }: Props) => { } return ( -
{
)} -
+
) } diff --git a/web/app/components/base/tooltip-plus/index.tsx b/web/app/components/base/tooltip-plus/index.tsx index 2d221ed6e2639a..afd110c5af3a03 100644 --- a/web/app/components/base/tooltip-plus/index.tsx +++ b/web/app/components/base/tooltip-plus/index.tsx @@ -19,10 +19,6 @@ export type TooltipProps = { needsDelay?: boolean } -const arrow = ( - -) - const getArrow = (position: Placement) => { switch (position) { case 'top': @@ -124,7 +120,7 @@ const Tooltip: FC = ({ onMouseLeave={() => triggerMethod === 'hover' && handleLeave(true)} asChild={asChild} > - {children ||
} + {children ||
} = ({
{name}
{tooltip && ( - - {tooltip} - } selector='config-var-tooltip'> - - + + {tooltip} + + } + needsDelay={false} + /> )}
diff --git a/web/app/components/datasets/common/retrieval-param-config/index.tsx b/web/app/components/datasets/common/retrieval-param-config/index.tsx index 98676f2e83888b..a339fb13d2fdb5 100644 --- a/web/app/components/datasets/common/retrieval-param-config/index.tsx +++ b/web/app/components/datasets/common/retrieval-param-config/index.tsx @@ -2,15 +2,13 @@ import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' -import { - RiQuestionLine, -} from '@remixicon/react' + import cn from '@/utils/classnames' import TopKItem from '@/app/components/base/param-item/top-k-item' import ScoreThresholdItem from '@/app/components/base/param-item/score-threshold-item' import { RETRIEVE_METHOD } from '@/types/app' import Switch from '@/app/components/base/switch' -import Tooltip from '@/app/components/base/tooltip-plus' +import TooltipPlus from '@/app/components/base/tooltip-plus' import type { RetrievalConfig } from '@/types/app' import ModelSelector from '@/app/components/header/account-setting/model-provider-page/model-selector' import { useModelListAndDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks' @@ -114,9 +112,12 @@ const RetrievalParamConfig: FC = ({ )}
{t('common.modelProvider.rerankModel.key')} - {t('common.modelProvider.rerankModel.tip')}
}> - - + {t('common.modelProvider.rerankModel.tip')}
+ } + needsDelay={false} + /> = ({ onClick={() => handleChangeRerankMode(option.value)} >
{option.label}
- {option.tips}} + needsDelay={false} + iconStyle='ml-0.5 w-3.5 h-4.5' hideArrow - > - - + /> )) } diff --git a/web/app/components/datasets/documents/list.tsx b/web/app/components/datasets/documents/list.tsx index cb44f5cc289672..d356b19c196941 100644 --- a/web/app/components/datasets/documents/list.tsx +++ b/web/app/components/datasets/documents/list.tsx @@ -7,14 +7,12 @@ import { ArrowDownIcon, TrashIcon } from '@heroicons/react/24/outline' import { pick } from 'lodash-es' import { RiMoreFill, - RiQuestionLine, } from '@remixicon/react' import { useContext } from 'use-context-selector' import { useRouter } from 'next/navigation' import { useTranslation } from 'react-i18next' import dayjs from 'dayjs' import { Edit03 } from '../../base/icons/src/vender/solid/general' -import TooltipPlus from '../../base/tooltip-plus' import { Globe01 } from '../../base/icons/src/vender/line/mapsAndTravel' import s from './style.module.css' import RenameModal from './rename-modal' @@ -24,6 +22,7 @@ import Divider from '@/app/components/base/divider' import Popover from '@/app/components/base/popover' import Confirm from '@/app/components/base/confirm' import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import { ToastContext } from '@/app/components/base/toast' import type { IndicatorProps } from '@/app/components/header/indicator' import Indicator from '@/app/components/header/indicator' @@ -93,14 +92,13 @@ export const StatusItem: FC<{ {DOC_INDEX_STATUS_MAP[localStatus]?.text} { errorMessage && ( - {errorMessage} } - > - - + iconStyle='ml-1' + needsDelay={false} + /> ) } @@ -201,11 +199,14 @@ export const OperationAction: FC<{ {isListScene && embeddingAvailable && ( <> {archived - ? + ?
{ }} disabled={true} size='md' />
-
+
: handleSwitch(v ? 'enable' : 'disable')} size='md' /> } diff --git a/web/app/components/datasets/hit-testing/textarea.tsx b/web/app/components/datasets/hit-testing/textarea.tsx index 5c146ae36873c9..abc2b515fc4bee 100644 --- a/web/app/components/datasets/hit-testing/textarea.tsx +++ b/web/app/components/datasets/hit-testing/textarea.tsx @@ -2,9 +2,9 @@ import { useContext } from 'use-context-selector' import { useTranslation } from 'react-i18next' import Button from '../../base/button' import Tag from '../../base/tag' -import Tooltip from '../../base/tooltip' import { getIcon } from '../common/retrieval-method-info' import s from './style.module.css' +import TooltipPlus from '@/app/components/base/tooltip-plus' import cn from '@/utils/classnames' import DatasetDetailContext from '@/context/dataset-detail' import type { HitTestingResponse } from '@/models/datasets' @@ -76,9 +76,9 @@ const TextAreaWithButton = ({ {t('datasetHitTesting.input.title')} -
{t(`dataset.retrieval.${retrievalMethod}.title`)}
-
+
@@ -101,9 +101,9 @@ const TextAreaWithButton = ({
{text?.length > 200 ? ( -
@@ -112,7 +112,7 @@ const TextAreaWithButton = ({ 200
-
+ ) : ( { const [isCopied, setIsCopied] = useState(false) - const selector = useRef(`input-tooltip-${randomString(4)}`) - useEffect(() => { if (isCopied) { const timeout = setTimeout(() => { @@ -40,22 +37,23 @@ const InputCopy = ({
{children}
- -
{ - copy(value) - setIsCopied(true) - }}>{value}
-
+
{ + copy(value) + setIsCopied(true) + }}> + + {value} + +
-
{ @@ -64,7 +62,7 @@ const InputCopy = ({ }}>
-
+
) diff --git a/web/app/components/develop/secret-key/secret-key-modal.tsx b/web/app/components/develop/secret-key/secret-key-modal.tsx index 01973ff028488f..6cfb362e7ef9a1 100644 --- a/web/app/components/develop/secret-key/secret-key-modal.tsx +++ b/web/app/components/develop/secret-key/secret-key-modal.tsx @@ -22,7 +22,7 @@ import { fetchApiKeysList as fetchDatasetApiKeysList, } from '@/service/datasets' import type { CreateApiKeyResponse } from '@/models/app' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import Loading from '@/app/components/base/loading' import Confirm from '@/app/components/base/confirm' import useTimestamp from '@/hooks/use-timestamp' @@ -117,17 +117,15 @@ const SecretKeyModal = ({
{formatTime(Number(api.created_at), t('appLog.dateTimeFormat') as string)}
{api.last_used_at ? formatTime(Number(api.created_at), t('appLog.dateTimeFormat') as string) : t('appApi.never')}
-
{ // setIsCopied(true) copy(api.token) setCopyValue(api.token) }}>
-
+ {isCurrentWorkspaceManager &&
{ setDelKeyId(api.id) diff --git a/web/app/components/header/account-setting/members-page/invited-modal/index.tsx b/web/app/components/header/account-setting/members-page/invited-modal/index.tsx index d3bcf9870eb0d9..4e0897dca70cc0 100644 --- a/web/app/components/header/account-setting/members-page/invited-modal/index.tsx +++ b/web/app/components/header/account-setting/members-page/invited-modal/index.tsx @@ -8,7 +8,7 @@ import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' import { IS_CE_EDITION } from '@/config' import type { InvitationResult } from '@/models/common' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' export type SuccessInvationResult = Extract export type FailedInvationResult = Extract @@ -63,15 +63,15 @@ const InvitedModal = ({ { failedInvationResults.map(item =>
-
{item.email}
-
+
, ) } diff --git a/web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx b/web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx index 876c7217d5f058..dfd8a7f3b0a904 100644 --- a/web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx +++ b/web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx @@ -4,7 +4,7 @@ import { t } from 'i18next' import copy from 'copy-to-clipboard' import s from './index.module.css' import type { SuccessInvationResult } from '.' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import { randomString } from '@/utils' type IInvitationLinkProps = { @@ -38,25 +38,23 @@ const InvitationLink = ({
-
{value.url}
-
+
-
-
+
) diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx index 57ea4bdd118fed..2b0a70aa70a7d9 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx @@ -1,14 +1,11 @@ import type { FC } from 'react' import { useEffect, useRef, useState } from 'react' -import { - RiQuestionLine, -} from '@remixicon/react' import type { ModelParameterRule } from '../declarations' import { useLanguage } from '../hooks' import { isNullOrUndefined } from '../utils' import cn from '@/utils/classnames' import Switch from '@/app/components/base/switch' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import Slider from '@/app/components/base/slider' import Radio from '@/app/components/base/radio' import { SimpleSelect } from '@/app/components/base/select' @@ -230,14 +227,12 @@ const ParameterItem: FC = ({
{ parameterRule.help && ( - {parameterRule.help[language] || parameterRule.help.en_US}
)} - > - - + needsDelay={false} + /> ) } { diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/priority-use-tip.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/priority-use-tip.tsx index 294a13ecfcbc6b..e348ca963c951d 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/priority-use-tip.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/priority-use-tip.tsx @@ -1,19 +1,19 @@ import { useTranslation } from 'react-i18next' import { ChevronDownDouble } from '@/app/components/base/icons/src/vender/line/arrows' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' const PriorityUseTip = () => { const { t } = useTranslation() return ( -
-
+ ) } diff --git a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx index b2dfe4bfe494ad..39fa2dde9c5103 100644 --- a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx @@ -1,9 +1,6 @@ import type { FC } from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { - RiQuestionLine, -} from '@remixicon/react' import ModelSelector from '../model-selector' import { useModelList, @@ -15,7 +12,7 @@ import type { DefaultModelResponse, } from '../declarations' import { ModelTypeEnum } from '../declarations' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import { Settings01 } from '@/app/components/base/icons/src/vender/line/general' import { PortalToFollowElem, @@ -145,14 +142,15 @@ const SystemModel: FC = ({
{t('common.modelProvider.systemReasoningModel.key')} - {t('common.modelProvider.systemReasoningModel.tip')}
+ + {t('common.modelProvider.systemReasoningModel.tip')} +
} - > - - + needsDelay={false} + iconStyle='ml-0.5' + />
= ({
{t('common.modelProvider.embeddingModel.key')} - {t('common.modelProvider.embeddingModel.tip')}
+ + {t('common.modelProvider.embeddingModel.tip')} +
} - > - - + needsDelay={false} + iconStyle='ml-0.5' + />
= ({
{t('common.modelProvider.rerankModel.key')} - {t('common.modelProvider.rerankModel.tip')}
+ + {t('common.modelProvider.rerankModel.tip')} +
} - > - - + needsDelay={false} + iconStyle='ml-0.5' + />
= ({
{t('common.modelProvider.speechToTextModel.key')} - {t('common.modelProvider.speechToTextModel.tip')}
+ + {t('common.modelProvider.speechToTextModel.tip')} +
} - > - - + needsDelay={false} + iconStyle='ml-0.5' + />
= ({
{t('common.modelProvider.ttsModel.key')} - {t('common.modelProvider.ttsModel.tip')}
+ + {t('common.modelProvider.ttsModel.tip')} +
} - > - - + needsDelay={false} + iconStyle='ml-0.5' + />
= ({ {showFeedback && feedback.rating && feedback.rating === 'like' && ( -
{ @@ -54,13 +54,13 @@ const Header: FC = ({ className='flex w-7 h-7 items-center justify-center rounded-md cursor-pointer !text-primary-600 border border-primary-200 bg-primary-100 hover:border-primary-300 hover:bg-primary-200'>
-
+ )} {showFeedback && feedback.rating && feedback.rating === 'dislike' && ( -
{ @@ -71,14 +71,14 @@ const Header: FC = ({ className='flex w-7 h-7 items-center justify-center rounded-md cursor-pointer !text-red-600 border border-red-200 bg-red-100 hover:border-red-300 hover:bg-red-200'>
-
+ )} {showFeedback && !feedback.rating && (
-
{ @@ -89,10 +89,10 @@ const Header: FC = ({ className='flex w-6 h-6 items-center justify-center rounded-md cursor-pointer hover:bg-gray-100'>
-
- +
{ @@ -103,7 +103,7 @@ const Header: FC = ({ className='flex w-6 h-6 items-center justify-center rounded-md cursor-pointer hover:bg-gray-100'>
-
+
)}
diff --git a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx index c2c7f8c5bbde85..8f59825fec15b7 100644 --- a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx @@ -2,10 +2,7 @@ import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' -import { - RiQuestionLine, -} from '@remixicon/react' -import Tooltip from '../../base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import cn from '@/utils/classnames' import type { Credential } from '@/app/components/tools/types' import Drawer from '@/app/components/base/drawer-plus' @@ -111,16 +108,15 @@ const ConfigCredential: FC = ({
{t('tools.createTool.authMethod.key')} - {t('tools.createTool.authMethod.keyTooltip')}
} - > - - + needsDelay={false} + iconStyle='ml-0.5' + />
= ({
{t('tools.createTool.nameForToolCall')} * - {t('tools.createTool.nameForToolCallPlaceHolder')}
} - selector='workflow-tool-modal-tooltip' - > - - + needsDelay={false} + />
Date: Wed, 7 Aug 2024 18:31:40 +0800 Subject: [PATCH 12/42] fix: hunyuan assistant_prompt_message pydantic error (#7062) --- api/core/model_runtime/model_providers/hunyuan/llm/llm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/core/model_runtime/model_providers/hunyuan/llm/llm.py b/api/core/model_runtime/model_providers/hunyuan/llm/llm.py index 6d22f9d2d66622..0bdf6ec005056b 100644 --- a/api/core/model_runtime/model_providers/hunyuan/llm/llm.py +++ b/api/core/model_runtime/model_providers/hunyuan/llm/llm.py @@ -214,7 +214,7 @@ def _handle_stream_chat_response(self, model, credentials, prompt_messages, resp def _handle_chat_response(self, credentials, model, prompt_messages, response): usage = self._calc_response_usage(model, credentials, response.Usage.PromptTokens, response.Usage.CompletionTokens) - assistant_prompt_message = PromptMessage(role="assistant") + assistant_prompt_message = AssistantPromptMessage() assistant_prompt_message.content = response.Choices[0].Message.Content result = LLMResult( model=model, From a0d5b61c2a4ba1bc996acf8e74a8992f923e0176 Mon Sep 17 00:00:00 2001 From: Chenhe Gu Date: Wed, 7 Aug 2024 19:27:54 +0800 Subject: [PATCH 13/42] update enterprise inquiry link to point to chatflow (#7064) --- README.md | 2 +- README_AR.md | 2 +- README_CN.md | 2 +- README_ES.md | 2 +- README_FR.md | 2 +- README_JA.md | 2 +- README_KR.md | 2 +- README_TR.md | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f8c09b50766dde..40e657178bf408 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Dify Cloud · Self-hosting · Documentation · - Enterprise inquiry + Enterprise inquiry

diff --git a/README_AR.md b/README_AR.md index cc5d1e7b2900fb..fbe5ae723a6501 100644 --- a/README_AR.md +++ b/README_AR.md @@ -4,7 +4,7 @@ Dify Cloud · الاستضافة الذاتية · التوثيق · - استفسارات الشركات + استفسار الشركات (للإنجليزية فقط)

diff --git a/README_CN.md b/README_CN.md index 0ff74a5871f466..d156ec9bca4fa2 100644 --- a/README_CN.md +++ b/README_CN.md @@ -4,7 +4,7 @@ Dify 云服务 · 自托管 · 文档 · - 预约演示 + (需用英文)常见问题解答 / 联系团队

diff --git a/README_ES.md b/README_ES.md index 465e06ed0aa051..03fac4422722be 100644 --- a/README_ES.md +++ b/README_ES.md @@ -4,7 +4,7 @@ Dify Cloud · Auto-alojamiento · Documentación · - Programar demostración + Consultas empresariales (en inglés)

diff --git a/README_FR.md b/README_FR.md index 2e06f6bc83260a..3400e7bf97ff0e 100644 --- a/README_FR.md +++ b/README_FR.md @@ -4,7 +4,7 @@ Dify Cloud · Auto-hébergement · Documentation · - Planifier une démo + Demande d’entreprise (en anglais seulement)

diff --git a/README_JA.md b/README_JA.md index 15759d2c69c86f..cc6d025bc2fa5a 100644 --- a/README_JA.md +++ b/README_JA.md @@ -4,7 +4,7 @@ Dify Cloud · セルフホスティング · ドキュメント · - デモの予約 + 企業のお問い合わせ(英語のみ)

diff --git a/README_KR.md b/README_KR.md index dfa103b8f589d2..6bb522131f91fa 100644 --- a/README_KR.md +++ b/README_KR.md @@ -4,7 +4,7 @@ Dify 클라우드 · 셀프-호스팅 · 문서 · - 기업 문의 + 기업 문의 (영어만 가능)

diff --git a/README_TR.md b/README_TR.md index 2ae7d440a81373..f4b1c3b9d05951 100644 --- a/README_TR.md +++ b/README_TR.md @@ -4,7 +4,7 @@ Dify Bulut · Kendi Sunucunuzda Barındırma · Dokümantasyon · - Kurumsal Sorgu + Yalnızca İngilizce: Kurumsal Sorgulama

From 67a2f14cef243dbe4b89ab4b4c332fc9aa7e4d59 Mon Sep 17 00:00:00 2001 From: -LAN- Date: Wed, 7 Aug 2024 19:36:21 +0800 Subject: [PATCH 14/42] fix(api/core/workflow/nodes/tool/tool_node.py): Keep None value in tool params. (#7066) --- api/core/workflow/nodes/tool/tool_node.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/core/workflow/nodes/tool/tool_node.py b/api/core/workflow/nodes/tool/tool_node.py index 969b1c241e52a8..87bfa5beae880b 100644 --- a/api/core/workflow/nodes/tool/tool_node.py +++ b/api/core/workflow/nodes/tool/tool_node.py @@ -118,6 +118,7 @@ def _generate_parameters( for parameter_name in node_data.tool_parameters: parameter = tool_parameters_dictionary.get(parameter_name) if not parameter: + result[parameter_name] = None continue if parameter.type == ToolParameter.ToolParameterType.FILE: result[parameter_name] = [ From 7403afcab742c989d00cecde32cb13e95982c257 Mon Sep 17 00:00:00 2001 From: Yi Date: Thu, 8 Aug 2024 10:35:55 +0800 Subject: [PATCH 15/42] update tooltips --- .../config/agent/agent-tools/index.tsx | 4 +++- .../index.tsx | 2 +- web/app/components/app/log/list.tsx | 11 ++++------ web/app/components/base/audio-btn/index.tsx | 10 ++++----- .../components/base/tooltip-plus/index.tsx | 4 ++-- .../datasets/create/step-two/index.tsx | 21 +++++++++---------- .../documents/detail/metadata/index.tsx | 8 ++++--- .../components/datasets/documents/list.tsx | 10 ++++----- .../model-selector/popup-item.tsx | 9 ++++---- .../components/tools/add-tool-modal/tools.tsx | 13 ++++++------ .../workflow/block-selector/blocks.tsx | 13 ++++++------ .../workflow/block-selector/tools.tsx | 13 ++++++------ .../workflow/nodes/_base/components/field.tsx | 16 +++++++------- .../nodes/_base/components/prompt/editor.tsx | 1 + .../components/workflow/nodes/_base/panel.tsx | 1 + .../llm/components/config-prompt-item.tsx | 6 ++---- web/app/signin/oneMoreStep.tsx | 11 ++++------ 17 files changed, 72 insertions(+), 81 deletions(-) diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx index 88d19fcc872c7c..a1f66e57089c86 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx @@ -72,6 +72,7 @@ const AgentTools: FC = () => { {t('appDebug.agent.tools.description')} } + needsDelay={false} /> } @@ -121,6 +122,7 @@ const AgentTools: FC = () => { {item.provider_type === CollectionType.builtIn ? item.provider_name : item.tool_label} {item.tool_name} @@ -158,7 +160,7 @@ const AgentTools: FC = () => { -

{ +
{ setCurrentTool(item) setIsShowSettingTool(true) }}> diff --git a/web/app/components/app/configuration/features/chat-group/suggested-questions-after-answer/index.tsx b/web/app/components/app/configuration/features/chat-group/suggested-questions-after-answer/index.tsx index ba8296cd748f25..5973e6d03eaadc 100644 --- a/web/app/components/app/configuration/features/chat-group/suggested-questions-after-answer/index.tsx +++ b/web/app/components/app/configuration/features/chat-group/suggested-questions-after-answer/index.tsx @@ -12,7 +12,7 @@ const SuggestedQuestionsAfterAnswer: FC = () => { return ( +
{t('appDebug.feature.suggestedQuestionsAfterAnswer.title')}
= ({ logs, appDetail, onRefresh }) // Annotated data needs to be highlighted const renderTdValue = (value: string | number | null, isEmptyStyle: boolean, isHighlight = false, annotation?: LogAnnotation) => { return ( - {`${t('appLog.detail.annotationTip', { user: annotation?.account?.name })} ${formatTime(annotation?.created_at || dayjs().unix(), 'MM-DD hh:mm A')}`} } - className={(isHighlight && !isChatMode) ? '' : '!hidden'} - selector={`highlight-${randomString(16)}`} + popupClassName={(isHighlight && !isChatMode) ? '' : '!hidden'} >
{value || '-'}
-
+
) } diff --git a/web/app/components/base/audio-btn/index.tsx b/web/app/components/base/audio-btn/index.tsx index 675f58b53039c1..cebbbf88762aaf 100644 --- a/web/app/components/base/audio-btn/index.tsx +++ b/web/app/components/base/audio-btn/index.tsx @@ -3,7 +3,7 @@ import { useRef, useState } from 'react' import { t } from 'i18next' import { useParams, usePathname } from 'next/navigation' import s from './style.module.css' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import { randomString } from '@/utils' import Loading from '@/app/components/base/loading' import { AudioPlayerManager } from '@/app/components/base/audio-btn/audio.player.manager' @@ -84,10 +84,8 @@ const AudioBtn = ({ return (
-
)} - +
) } diff --git a/web/app/components/base/tooltip-plus/index.tsx b/web/app/components/base/tooltip-plus/index.tsx index 5b73dfcf2dd624..991a9ded7124c4 100644 --- a/web/app/components/base/tooltip-plus/index.tsx +++ b/web/app/components/base/tooltip-plus/index.tsx @@ -11,7 +11,7 @@ export type TooltipProps = { triggerMethod?: 'hover' | 'click' iconStyle?: string disabled?: boolean - popupContent: React.ReactNode + popupContent?: React.ReactNode children?: React.ReactNode hideArrow?: boolean popupClassName?: string @@ -54,7 +54,7 @@ const getArrow = (position: Placement) => { const Tooltip: FC = ({ position = 'top', triggerMethod = 'hover', - iconStyle = 'w-[14px] h-[14px]', + iconStyle = 'w-3.5 h-3.5', disabled = false, popupContent, children, diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index 3849f817d613f2..bbb70f54341273 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -7,7 +7,6 @@ import { XMarkIcon } from '@heroicons/react/20/solid' import { RocketLaunchIcon } from '@heroicons/react/24/outline' import { RiCloseLine, - RiQuestionLine, } from '@remixicon/react' import Link from 'next/link' import { groupBy } from 'lodash-es' @@ -42,7 +41,6 @@ import I18n from '@/context/i18n' import { IS_CE_EDITION } from '@/config' import { RETRIEVE_METHOD } from '@/types/app' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' -import Tooltip from '@/app/components/base/tooltip' import TooltipPlus from '@/app/components/base/tooltip-plus' import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks' import { LanguagesSupported } from '@/i18n/language' @@ -556,12 +554,12 @@ const StepTwo = ({ className='border-[0.5px] !h-8 hover:outline hover:outline-[0.5px] hover:outline-gray-300 text-gray-700 font-medium bg-white shadow-[0px_1px_2px_0px_rgba(16,24,40,0.05)]' onClick={setShowPreview} > - +
{t('datasetCreation.stepTwo.previewTitleButton')}
-
+ )}
@@ -628,13 +626,14 @@ const StepTwo = ({
{t('datasetCreation.stepTwo.overlap')} - - {t('datasetCreation.stepTwo.overlapTip')} -
- }> - - + + {t('datasetCreation.stepTwo.overlapTip')} +
+ } + needsDelay={false} + />
+ - + ) } diff --git a/web/app/components/datasets/documents/list.tsx b/web/app/components/datasets/documents/list.tsx index d356b19c196941..8bdbf71d2263cc 100644 --- a/web/app/components/datasets/documents/list.tsx +++ b/web/app/components/datasets/documents/list.tsx @@ -21,7 +21,6 @@ import Switch from '@/app/components/base/switch' import Divider from '@/app/components/base/divider' import Popover from '@/app/components/base/popover' import Confirm from '@/app/components/base/confirm' -import Tooltip from '@/app/components/base/tooltip' import TooltipPlus from '@/app/components/base/tooltip-plus' import { ToastContext } from '@/app/components/base/toast' import type { IndicatorProps } from '@/app/components/header/indicator' @@ -221,10 +220,9 @@ export const OperationAction: FC<{ {!archived && enabled ? t('datasetDocuments.list.index.enable') : t('datasetDocuments.list.index.disable')} -
@@ -235,7 +233,7 @@ export const OperationAction: FC<{ size='md' />
-
+
{!archived && enabled ? t('datasetDocuments.list.index.enableTip') : t('datasetDocuments.list.index.disableTip')} diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx index 82672158a9cd7b..8f86e4728a010a 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx @@ -20,7 +20,7 @@ import { import { Check } from '@/app/components/base/icons/src/vender/line/general' import { useModalContext } from '@/context/modal-context' import { useProviderContext } from '@/context/provider-context' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' type PopupItemProps = { defaultModel?: DefaultModel @@ -69,10 +69,9 @@ const PopupItem: FC = ({
{ model.models.map(modelItem => ( -
= ({ ) }
-
+
)) } diff --git a/web/app/components/tools/add-tool-modal/tools.tsx b/web/app/components/tools/add-tool-modal/tools.tsx index 8810294d982fe4..8cd9a1fc293cec 100644 --- a/web/app/components/tools/add-tool-modal/tools.tsx +++ b/web/app/components/tools/add-tool-modal/tools.tsx @@ -13,7 +13,7 @@ import { Tag01 } from '@/app/components/base/icons/src/vender/line/financeAndECo import type { ToolWithProvider } from '@/app/components/workflow/types' import { BlockEnum } from '@/app/components/workflow/types' import BlockIcon from '@/app/components/workflow/block-icon' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import Button from '@/app/components/base/button' import { useGetLanguage } from '@/context/i18n' import { useStore as useLabelStore } from '@/app/components/tools/labels/store' @@ -66,12 +66,11 @@ const Blocks = ({ })() const added = !!addedTools?.find(v => v.provider_id === toolWithProvider.id && v.provider_type === toolWithProvider.type && v.tool_name === tool.name) return ( - )} - noArrow + hideArrow >
{t('tools.auth.setup')} )}
-
+ ) })} diff --git a/web/app/components/workflow/block-selector/blocks.tsx b/web/app/components/workflow/block-selector/blocks.tsx index aac95b5392fe7b..8d062112e3cabe 100644 --- a/web/app/components/workflow/block-selector/blocks.tsx +++ b/web/app/components/workflow/block-selector/blocks.tsx @@ -14,7 +14,7 @@ import { import { BLOCK_CLASSIFICATIONS } from './constants' import { useBlocks } from './hooks' import type { ToolDefaultValue } from './types' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' type BlocksProps = { searchText: string @@ -65,12 +65,11 @@ const Blocks = ({ } { list.map(block => ( - {nodesExtraData[block.type].about} )} - noArrow + hideArrow >
{block.title}
-
+ )) } diff --git a/web/app/components/workflow/block-selector/tools.tsx b/web/app/components/workflow/block-selector/tools.tsx index 36480d369e6fee..8ad1376e4963e2 100644 --- a/web/app/components/workflow/block-selector/tools.tsx +++ b/web/app/components/workflow/block-selector/tools.tsx @@ -9,7 +9,7 @@ import { BlockEnum } from '../types' import type { ToolWithProvider } from '../types' import IndexBar, { groupItems } from './index-bar' import type { ToolDefaultValue } from './types' -import Tooltip from '@/app/components/base/tooltip' +import TooltipPlus from '@/app/components/base/tooltip-plus' import Empty from '@/app/components/tools/add-tool-modal/empty' import { useGetLanguage } from '@/context/i18n' @@ -42,12 +42,11 @@ const Blocks = ({ { list.map(tool => ( - {tool.description[language]} )} - noArrow + hideArrow >
{tool.label[language]}
-
+ )) } diff --git a/web/app/components/workflow/nodes/_base/components/field.tsx b/web/app/components/workflow/nodes/_base/components/field.tsx index 344fc3d7086917..de275bfa8c7dc2 100644 --- a/web/app/components/workflow/nodes/_base/components/field.tsx +++ b/web/app/components/workflow/nodes/_base/components/field.tsx @@ -3,7 +3,6 @@ import type { FC } from 'react' import React from 'react' import { RiArrowDownSLine, - RiQuestionLine, } from '@remixicon/react' import { useBoolean } from 'ahooks' import type { DefaultTFuncReturn } from 'i18next' @@ -40,12 +39,15 @@ const Filed: FC = ({
{title}
{tooltip && ( - - {tooltip} -
}> - - + + {tooltip} + } + needsDelay={false} + popupClassName='ml-1' + iconStyle='w-4 h-4 ml-1' + /> )} diff --git a/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx b/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx index daf4bddbc4a846..df929093918b64 100644 --- a/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx +++ b/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx @@ -166,6 +166,7 @@ const Editor: FC = ({ {!readOnly && ( diff --git a/web/app/components/workflow/nodes/_base/panel.tsx b/web/app/components/workflow/nodes/_base/panel.tsx index 269d8110dca0ae..22e97e5f0eb0fd 100644 --- a/web/app/components/workflow/nodes/_base/panel.tsx +++ b/web/app/components/workflow/nodes/_base/panel.tsx @@ -129,6 +129,7 @@ const BasePanel: FC = ({ canRunBySingle(data.type) && !nodesReadOnly && (
= ({ popupContent={
{t(`${i18nPrefix}.roleDescription.${payload.role}`)}
} - > - - + needsDelay={false} + />
} value={payload.edition_type === EditionType.jinja2 ? (payload.jinja2_text || '') : payload.text} diff --git a/web/app/signin/oneMoreStep.tsx b/web/app/signin/oneMoreStep.tsx index d1e94ce2fcd1c9..faad39112052ed 100644 --- a/web/app/signin/oneMoreStep.tsx +++ b/web/app/signin/oneMoreStep.tsx @@ -6,8 +6,7 @@ import useSWR from 'swr' import { useRouter } from 'next/navigation' // import { useContext } from 'use-context-selector' import Button from '@/app/components/base/button' -import Tooltip from '@/app/components/base/tooltip/index' - +import TooltipPlus from '@/app/components/base/tooltip-plus' import { SimpleSelect } from '@/app/components/base/select' import { timezones } from '@/utils/timezone' import { LanguagesSupported, languages } from '@/i18n/language' @@ -87,10 +86,8 @@ const OneMoreStep = () => {
= ({ {description} } - needsDelay={false} >
diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx index a1f66e57089c86..2c851d42395a11 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx @@ -72,7 +72,6 @@ const AgentTools: FC = () => { {t('appDebug.agent.tools.description')} } - needsDelay={false} /> } @@ -122,7 +121,6 @@ const AgentTools: FC = () => { {item.provider_type === CollectionType.builtIn ? item.provider_name : item.tool_label} {item.tool_name} @@ -134,6 +132,7 @@ const AgentTools: FC = () => {
{ if (item.notAuthor) @@ -159,6 +158,7 @@ const AgentTools: FC = () => {
{ setCurrentTool(item) diff --git a/web/app/components/app/configuration/dataset-config/card-item/index.tsx b/web/app/components/app/configuration/dataset-config/card-item/index.tsx index 6c9c61884ed0c0..09786754f9cf47 100644 --- a/web/app/components/app/configuration/dataset-config/card-item/index.tsx +++ b/web/app/components/app/configuration/dataset-config/card-item/index.tsx @@ -40,7 +40,6 @@ const CardItem: FC = ({ {!config.embedding_available && ( {t('dataset.unavailable')} diff --git a/web/app/components/app/configuration/dataset-config/context-var/index.tsx b/web/app/components/app/configuration/dataset-config/context-var/index.tsx index 58fdc7bdefbcf5..7d7975c45d206f 100644 --- a/web/app/components/app/configuration/dataset-config/context-var/index.tsx +++ b/web/app/components/app/configuration/dataset-config/context-var/index.tsx @@ -26,7 +26,6 @@ const ContextVar: FC = (props) => { {t('appDebug.feature.dataSet.queryVariable.tip')}
} - needsDelay={false} />
diff --git a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx index 3656bf6ea76b54..a09890668094bb 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx @@ -5,7 +5,6 @@ import type { FC } from 'react' import { useTranslation } from 'react-i18next' import { RiAlertFill, - RiQuestionLine, } from '@remixicon/react' import WeightedScore from './weighted-score' import TopKItem from '@/app/components/base/param-item/top-k-item' @@ -251,11 +250,14 @@ const ConfigContent: FC = ({ >
{option.label}
{option.tips}
} - hideArrow - > - -
+ popupContent={ +
+ {option.tips} +
+ } + popupClassName='ml-0.5' + iconStyle='ml-0.5 w-3.5 h-3.5' + />
)) } @@ -281,9 +283,15 @@ const ConfigContent: FC = ({ ) }
{t('common.modelProvider.rerankModel.key')}
- {t('common.modelProvider.rerankModel.tip')}}> - - + + {t('common.modelProvider.rerankModel.tip')} + + } + popupClassName='ml-0.5' + iconStyle='ml-0.5 w-3.5 h-3.5' + />
= ({
{t('common.modelProvider.systemReasoningModel.key')}
- - + />
{ {t('appDebug.feature.suggestedQuestionsAfterAnswer.description')} } - needsDelay={false} /> } diff --git a/web/app/components/app/configuration/prompt-value-panel/index.tsx b/web/app/components/app/configuration/prompt-value-panel/index.tsx index 0192024c83e527..b732865bc5586b 100644 --- a/web/app/components/app/configuration/prompt-value-panel/index.tsx +++ b/web/app/components/app/configuration/prompt-value-panel/index.tsx @@ -16,7 +16,7 @@ import { AppType, ModelModeType } from '@/types/app' import Select from '@/app/components/base/select' import { DEFAULT_VALUE_MAX_LEN } from '@/config' import Button from '@/app/components/base/button' -import Tooltip from '@/app/components/base/tooltip-plus' +import TooltipPlus from '@/app/components/base/tooltip-plus' import TextGenerationImageUploader from '@/app/components/base/image-uploader/text-generation-image-uploader' import type { VisionFile, VisionSettings } from '@/types/app' @@ -205,11 +205,12 @@ const PromptValuePanel: FC = ({ {canNotRun - ? ( {renderRunButton()} - ) +
) : renderRunButton()} diff --git a/web/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn/index.tsx b/web/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn/index.tsx index 2e917e9ec711e0..5079a62ba408de 100644 --- a/web/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn/index.tsx +++ b/web/app/components/app/configuration/toolbox/annotation/annotation-ctrl-btn/index.tsx @@ -101,7 +101,7 @@ const CacheCtrlBtn: FC = ({ ? (
= ({ }
{tooltip}
} iconStyle='w-3.5 h-3.5' - needsDelay={false} />
{children}
diff --git a/web/app/components/app/configuration/tools/index.tsx b/web/app/components/app/configuration/tools/index.tsx index 2ec8f554413234..955b11f36a5bde 100644 --- a/web/app/components/app/configuration/tools/index.tsx +++ b/web/app/components/app/configuration/tools/index.tsx @@ -7,7 +7,6 @@ import { RiAddLine, RiArrowDownSLine, RiDeleteBinLine, - RiQuestionLine, } from '@remixicon/react' import ConfigContext from '@/context/debug-configuration' import Switch from '@/app/components/base/switch' @@ -107,9 +106,14 @@ const Tools = () => {
{t('appDebug.feature.tools.title')}
- {t('appDebug.feature.tools.tips')}
}> - -
+ + {t('appDebug.feature.tools.tips')} + + } + iconStyle='w-3.5 h-3.5' + /> { !expanded && !!externalDataToolsConfig.length && ( diff --git a/web/app/components/app/create-app-modal/index.tsx b/web/app/components/app/create-app-modal/index.tsx index c4cedbb3543b9f..8397296ba81228 100644 --- a/web/app/components/app/create-app-modal/index.tsx +++ b/web/app/components/app/create-app-modal/index.tsx @@ -99,7 +99,6 @@ const CreateAppModal = ({ show, onSuccess, onClose }: CreateAppDialogProps) => {
{t('app.newApp.captionAppType')}
{t('app.newApp.chatbotDescription')}
} @@ -120,7 +119,6 @@ const CreateAppModal = ({ show, onSuccess, onClose }: CreateAppDialogProps) => {
{t('app.newApp.completionDescription')}
@@ -143,7 +141,6 @@ const CreateAppModal = ({ show, onSuccess, onClose }: CreateAppDialogProps) => {
{t('app.newApp.agentDescription')} } @@ -164,7 +161,6 @@ const CreateAppModal = ({ show, onSuccess, onClose }: CreateAppDialogProps) => {
{t('app.newApp.workflowDescription')}
diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index 308de03c8f0e6b..3b39f1670b8819 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -343,7 +343,6 @@ function DetailPanel
{detail.id}
diff --git a/web/app/components/app/overview/appCard.tsx b/web/app/components/app/overview/appCard.tsx index 8b497c5623a52c..c43c5083847a38 100644 --- a/web/app/components/app/overview/appCard.tsx +++ b/web/app/components/app/overview/appCard.tsx @@ -194,7 +194,6 @@ function AppCard({ )} {isApp && isCurrentWorkspaceManager && (
diff --git a/web/app/components/base/audio-btn/index.tsx b/web/app/components/base/audio-btn/index.tsx index 76ebaad5176d72..52985eaa22703d 100644 --- a/web/app/components/base/audio-btn/index.tsx +++ b/web/app/components/base/audio-btn/index.tsx @@ -86,7 +86,6 @@ const AudioBtn = ({
diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index bbb70f54341273..82c5375cd9c58f 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -632,7 +632,6 @@ const StepTwo = ({ {t('datasetCreation.stepTwo.overlapTip')}
} - needsDelay={false} />
= ({
{label}
{isRequired && *} {tooltip && ( - {tooltip} - }> - - + {tooltip} + } + popupClassName='relative top-[3px] w-3 h-3 ml-1' + /> )}