From ee30497237d9963c2bf4f8b0d8f37b0192517231 Mon Sep 17 00:00:00 2001 From: Wunmi Sogunle Date: Tue, 22 Apr 2025 02:56:53 +0100 Subject: [PATCH 1/8] fix(markdown): correctly render links with inline code (#18500) --- web/app/components/base/markdown.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/components/base/markdown.tsx b/web/app/components/base/markdown.tsx index 52b880affa..6ea84a2842 100644 --- a/web/app/components/base/markdown.tsx +++ b/web/app/components/base/markdown.tsx @@ -252,7 +252,7 @@ const Img = ({ src }: any) => { return
} -const Link = ({ node, ...props }: any) => { +const Link = ({ node, children, ...props }: any) => { if (node.properties?.href && node.properties.href?.toString().startsWith('abbr')) { // eslint-disable-next-line react-hooks/rules-of-hooks const { onSend } = useChatContext() @@ -261,7 +261,7 @@ const Link = ({ node, ...props }: any) => { return onSend?.(hidden_text)} title={node.children[0]?.value}>{node.children[0]?.value} } else { - return {node.children[0] ? node.children[0]?.value : 'Download'} + return {children || 'Download'} } } From 80f5ee1eb2d12f2a0aba9a91025c1b965b41decb Mon Sep 17 00:00:00 2001 From: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:59:14 +0800 Subject: [PATCH 2/8] fix: fix workflow as a tool confirm dialog layout issue (#18494) --- .../agent/agent-tools/setting-built-in-tool.tsx | 2 +- .../dataset-config/card-item/item.tsx | 2 +- web/app/components/app/log/list.tsx | 2 +- web/app/components/app/workflow-log/list.tsx | 2 +- web/app/components/base/drawer-plus/index.tsx | 8 +++++++- web/app/components/base/drawer/index.tsx | 14 +++++++++----- .../detail/completed/common/full-screen-drawer.tsx | 2 +- .../components/datasets/documents/detail/index.tsx | 2 +- web/app/components/datasets/hit-testing/index.tsx | 4 ++-- .../metadata-dataset/dataset-metadata-drawer.tsx | 2 +- .../plugins/plugin-detail-panel/endpoint-modal.tsx | 2 +- .../plugins/plugin-detail-panel/index.tsx | 2 +- .../plugin-detail-panel/strategy-detail.tsx | 2 +- web/app/components/tools/add-tool-modal/index.tsx | 2 +- .../config-credentials.tsx | 4 +++- web/app/components/tools/provider/detail.tsx | 2 +- .../components/dataset-item.tsx | 2 +- 17 files changed, 34 insertions(+), 22 deletions(-) diff --git a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx index 75183ab5a7..952ad66fc4 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx @@ -163,7 +163,7 @@ const SettingBuiltInTool: FC = ({ footer={null} mask={false} positionCenter={false} - panelClassname={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} + panelClassName={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} > <> {isLoading && } diff --git a/web/app/components/app/configuration/dataset-config/card-item/item.tsx b/web/app/components/app/configuration/dataset-config/card-item/item.tsx index d44fb145bb..65ad2ca941 100644 --- a/web/app/components/app/configuration/dataset-config/card-item/item.tsx +++ b/web/app/components/app/configuration/dataset-config/card-item/item.tsx @@ -97,7 +97,7 @@ const Item: FC = ({ - setShowSettingsModal(false)} footer={null} mask={isMobile} panelClassname='mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[640px] rounded-xl'> + setShowSettingsModal(false)} footer={null} mask={isMobile} panelClassName='mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[640px] rounded-xl'> setShowSettingsModal(false)} diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index b78af5cdba..056ce84f1e 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -743,7 +743,7 @@ const ConversationList: FC = ({ logs, appDetail, onRefresh }) onClose={onCloseDrawer} mask={isMobile} footer={null} - panelClassname='mt-16 mx-2 sm:mr-2 mb-4 !p-0 !max-w-[640px] rounded-xl bg-components-panel-bg' + panelClassName='mt-16 mx-2 sm:mr-2 mb-4 !p-0 !max-w-[640px] rounded-xl bg-components-panel-bg' > = ({ logs, appDetail, onRefresh }) => { onClose={onCloseDrawer} mask={isMobile} footer={null} - panelClassname='mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[600px] rounded-xl border border-components-panel-border' + panelClassName='mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[600px] rounded-xl border border-components-panel-border' > diff --git a/web/app/components/base/drawer-plus/index.tsx b/web/app/components/base/drawer-plus/index.tsx index bb022acdcb..33a1948181 100644 --- a/web/app/components/base/drawer-plus/index.tsx +++ b/web/app/components/base/drawer-plus/index.tsx @@ -9,6 +9,8 @@ import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' type Props = { isShow: boolean onHide: () => void + dialogClassName?: string + dialogBackdropClassName?: string panelClassName?: string maxWidthClassName?: string contentClassName?: string @@ -26,6 +28,8 @@ type Props = { const DrawerPlus: FC = ({ isShow, onHide, + dialogClassName = '', + dialogBackdropClassName = '', panelClassName = '', maxWidthClassName = '!max-w-[640px]', height = 'calc(100vh - 72px)', @@ -55,7 +59,9 @@ const DrawerPlus: FC = ({ footer={null} mask={isMobile || isShowMask} positionCenter={positionCenter} - panelClassname={cn('mx-2 mb-3 mt-16 rounded-xl !p-0 sm:mr-2', panelClassName, maxWidthClassName)} + dialogClassName={dialogClassName} + dialogBackdropClassName={dialogBackdropClassName} + panelClassName={cn('mx-2 mb-3 mt-16 rounded-xl !p-0 sm:mr-2', panelClassName, maxWidthClassName)} >
!clickOutsideNotOpen && onClose()} - className="fixed inset-0 z-[80] overflow-y-auto" + className={cn('fixed inset-0 z-[30] overflow-y-auto', dialogClassName)} >
{/* mask */} { !clickOutsideNotOpen && onClose() }} /> -
+
<>
{title && = ({ = ({ datasetId, documentId }) => { }
} - setShowMetadata(false)} isMobile={isMobile} panelClassname='!justify-start' footer={null}> + setShowMetadata(false)} isMobile={isMobile} panelClassName='!justify-start' footer={null}> = ({ datasetId }: Props) => { )}
- +
{/* {renderHitResults(generalResultData)} */} {submitLoading @@ -197,7 +197,7 @@ const HitTestingPage: FC = ({ datasetId }: Props) => { }
- setIsShowModifyRetrievalModal(false)} footer={null} mask={isMobile} panelClassname='mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[640px] rounded-xl'> + setIsShowModifyRetrievalModal(false)} footer={null} mask={isMobile} panelClassName='mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[640px] rounded-xl'> = ({ showClose title={t('dataset.metadata.metadata')} footer={null} - panelClassname='px-4 block !max-w-[420px] my-2 rounded-l-2xl' + panelClassName='px-4 block !max-w-[420px] my-2 rounded-l-2xl' >
{t(`${i18nPrefix}.description`)}
diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx index 46aaf6a7d6..fd862720af 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx @@ -46,7 +46,7 @@ const EndpointModal: FC = ({ footer={null} mask positionCenter={false} - panelClassname={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} + panelClassName={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} > <>
diff --git a/web/app/components/plugins/plugin-detail-panel/index.tsx b/web/app/components/plugins/plugin-detail-panel/index.tsx index 70bd9edabc..3ec867faae 100644 --- a/web/app/components/plugins/plugin-detail-panel/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/index.tsx @@ -38,7 +38,7 @@ const PluginDetailPanel: FC = ({ footer={null} mask={false} positionCenter={false} - panelClassname={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} + panelClassName={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} > {detail && ( <> diff --git a/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx b/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx index 89ee850e03..00794d83ed 100644 --- a/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx +++ b/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx @@ -78,7 +78,7 @@ const StrategyDetail: FC = ({ footer={null} mask={false} positionCenter={false} - panelClassname={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} + panelClassName={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} > <> {/* header */} diff --git a/web/app/components/tools/add-tool-modal/index.tsx b/web/app/components/tools/add-tool-modal/index.tsx index 1129fe55ce..c45313fc09 100644 --- a/web/app/components/tools/add-tool-modal/index.tsx +++ b/web/app/components/tools/add-tool-modal/index.tsx @@ -178,7 +178,7 @@ const AddToolModal: FC = ({ clickOutsideNotOpen onClose={onHide} footer={null} - panelClassname={cn('mx-2 mb-3 mt-16 rounded-xl !p-0 sm:mr-2', 'mt-2 !w-[640px]', '!max-w-[640px]')} + panelClassName={cn('mx-2 mb-3 mt-16 rounded-xl !p-0 sm:mr-2', 'mt-2 !w-[640px]', '!max-w-[640px]')} >
= ({ positionCenter={positionCenter} onHide={onHide} title={t('tools.createTool.authMethod.title')!} - panelClassName='mt-2 !w-[520px] h-fit' + dialogClassName='z-[60]' + dialogBackdropClassName='z-[70]' + panelClassName='mt-2 !w-[520px] h-fit z-[80]' maxWidthClassName='!max-w-[520px]' height={'fit-content'} headerClassName='!border-b-divider-regular' diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsx index 5d3a1794d8..21ea8bc464 100644 --- a/web/app/components/tools/provider/detail.tsx +++ b/web/app/components/tools/provider/detail.tsx @@ -234,7 +234,7 @@ const ProviderDetail = ({ footer={null} mask={false} positionCenter={false} - panelClassname={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} + panelClassName={cn('mb-2 mr-2 mt-[64px] !w-[420px] !max-w-[420px] justify-start rounded-2xl border-[0.5px] border-components-panel-border !bg-components-panel-bg !p-0 shadow-xl')} >
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-item.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-item.tsx index e424ea8e1f..f8d2dcfc75 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-item.tsx +++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-item.tsx @@ -111,7 +111,7 @@ const DatasetItem: FC = ({ } {isShowSettingsModal && ( - + Date: Tue, 22 Apr 2025 10:13:22 +0800 Subject: [PATCH 3/8] fix: filter empty marketplace collection (#18511) --- .../plugins/marketplace/list/list-with-collection.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/app/components/plugins/marketplace/list/list-with-collection.tsx b/web/app/components/plugins/marketplace/list/list-with-collection.tsx index e18356cd85..4c396c565f 100644 --- a/web/app/components/plugins/marketplace/list/list-with-collection.tsx +++ b/web/app/components/plugins/marketplace/list/list-with-collection.tsx @@ -32,7 +32,9 @@ const ListWithCollection = ({ return ( <> { - marketplaceCollections.map(collection => ( + marketplaceCollections.filter((collection) => { + return marketplaceCollectionPluginsMap[collection.name]?.length + }).map(collection => (
Date: Tue, 22 Apr 2025 11:00:22 +0800 Subject: [PATCH 4/8] fix: adjust padding and background for sticky header (#18515) --- .../datasets/settings/permission-selector/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/components/datasets/settings/permission-selector/index.tsx b/web/app/components/datasets/settings/permission-selector/index.tsx index 71a46087af..9bb6f812d4 100644 --- a/web/app/components/datasets/settings/permission-selector/index.tsx +++ b/web/app/components/datasets/settings/permission-selector/index.tsx @@ -150,8 +150,8 @@ const PermissionSelector = ({ disabled, permission, value, memberList, onChange,
{isPartialMembers && ( -
-
+
+
Date: Mon, 21 Apr 2025 23:03:01 -0400 Subject: [PATCH 5/8] feat(embedded-chatbot): support overriding locale via URL params (#18509) --- .../base/chat/embedded-chatbot/hooks.tsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/web/app/components/base/chat/embedded-chatbot/hooks.tsx b/web/app/components/base/chat/embedded-chatbot/hooks.tsx index d6a7b230e4..0f2529152c 100644 --- a/web/app/components/base/chat/embedded-chatbot/hooks.tsx +++ b/web/app/components/base/chat/embedded-chatbot/hooks.tsx @@ -80,8 +80,30 @@ export const useEmbeddedChatbot = () => { }, []) useEffect(() => { - if (appInfo?.site.default_language) - changeLanguage(appInfo.site.default_language) + const setLanguageFromParams = async () => { + // Check URL parameters for language override + const urlParams = new URLSearchParams(window.location.search) + const localeParam = urlParams.get('locale') + + // Check for encoded system variables + const systemVariables = await getProcessedSystemVariablesFromUrlParams() + const localeFromSysVar = systemVariables.locale + + if (localeParam) { + // If locale parameter exists in URL, use it instead of default + changeLanguage(localeParam) + } + else if (localeFromSysVar) { + // If locale is set as a system variable, use that + changeLanguage(localeFromSysVar) + } + else if (appInfo?.site.default_language) { + // Otherwise use the default from app config + changeLanguage(appInfo.site.default_language) + } + } + + setLanguageFromParams() }, [appInfo]) const [conversationIdInfo, setConversationIdInfo] = useLocalStorageState>>(CONVERSATION_ID_INFO, { From 67eefd0ba19dbcd2d36a25ba6163e61ce08a2a94 Mon Sep 17 00:00:00 2001 From: GuanMu Date: Tue, 22 Apr 2025 11:06:36 +0800 Subject: [PATCH 6/8] fix: update search model placeholder and add translations f (#18518) --- .../model-provider-page/model-selector/popup.tsx | 2 +- web/i18n/de-DE/dataset-settings.ts | 1 + web/i18n/en-US/dataset-settings.ts | 1 + web/i18n/es-ES/dataset-settings.ts | 1 + web/i18n/fa-IR/dataset-settings.ts | 1 + web/i18n/fr-FR/dataset-settings.ts | 1 + web/i18n/hi-IN/dataset-settings.ts | 1 + web/i18n/it-IT/dataset-settings.ts | 1 + web/i18n/ja-JP/dataset-settings.ts | 1 + web/i18n/ko-KR/dataset-settings.ts | 1 + web/i18n/pl-PL/dataset-settings.ts | 1 + web/i18n/pt-BR/dataset-settings.ts | 1 + web/i18n/ro-RO/dataset-settings.ts | 1 + web/i18n/ru-RU/dataset-settings.ts | 1 + web/i18n/sl-SI/dataset-settings.ts | 1 + web/i18n/th-TH/dataset-settings.ts | 1 + web/i18n/tr-TR/dataset-settings.ts | 1 + web/i18n/uk-UA/dataset-settings.ts | 1 + web/i18n/vi-VN/dataset-settings.ts | 1 + web/i18n/zh-Hans/dataset-settings.ts | 1 + web/i18n/zh-Hant/dataset-settings.ts | 1 + 21 files changed, 21 insertions(+), 1 deletion(-) diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx index 6a336fb6f7..63849bddda 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx @@ -74,7 +74,7 @@ const Popup: FC = ({ /> setSearchText(e.target.value)} /> diff --git a/web/i18n/de-DE/dataset-settings.ts b/web/i18n/de-DE/dataset-settings.ts index c871e13d4b..24cb1207b8 100644 --- a/web/i18n/de-DE/dataset-settings.ts +++ b/web/i18n/de-DE/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { upgradeHighQualityTip: 'Nach dem Upgrade auf den Modus "Hohe Qualität" ist das Zurücksetzen auf den Modus "Wirtschaftlich" nicht mehr möglich', helpText: 'Erfahren Sie, wie Sie eine gute Datensatzbeschreibung schreiben.', indexMethodChangeToEconomyDisabledTip: 'Nicht verfügbar für ein Downgrade von HQ auf ECO', + searchModel: 'Modell suchen', }, } diff --git a/web/i18n/en-US/dataset-settings.ts b/web/i18n/en-US/dataset-settings.ts index dffb96144d..bf10bed436 100644 --- a/web/i18n/en-US/dataset-settings.ts +++ b/web/i18n/en-US/dataset-settings.ts @@ -36,6 +36,7 @@ const translation = { retrievalSettings: 'Retrieval Settings', save: 'Save', indexMethodChangeToEconomyDisabledTip: 'Not available for downgrading from HQ to ECO', + searchModel: 'Search model', }, } diff --git a/web/i18n/es-ES/dataset-settings.ts b/web/i18n/es-ES/dataset-settings.ts index 211a23edd1..ee8072e278 100644 --- a/web/i18n/es-ES/dataset-settings.ts +++ b/web/i18n/es-ES/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: 'No disponible para degradar de HQ a ECO', helpText: 'Aprenda a escribir una buena descripción del conjunto de datos.', upgradeHighQualityTip: 'Una vez que se actualiza al modo de alta calidad, no está disponible volver al modo económico', + searchModel: 'Buscar modelo', }, } diff --git a/web/i18n/fa-IR/dataset-settings.ts b/web/i18n/fa-IR/dataset-settings.ts index 1ddee95e9b..0243929c36 100644 --- a/web/i18n/fa-IR/dataset-settings.ts +++ b/web/i18n/fa-IR/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: 'برای تنزل رتبه از HQ به ECO در دسترس نیست', helpText: 'یاد بگیرید که چگونه یک توضیحات مجموعه داده خوب بنویسید.', upgradeHighQualityTip: 'پس از ارتقاء به حالت کیفیت بالا، بازگشت به حالت اقتصادی در دسترس نیست', + searchModel: 'جستجوی مدل', }, } diff --git a/web/i18n/fr-FR/dataset-settings.ts b/web/i18n/fr-FR/dataset-settings.ts index 101214d288..20d8c47149 100644 --- a/web/i18n/fr-FR/dataset-settings.ts +++ b/web/i18n/fr-FR/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: 'Non disponible pour le déclassement de HQ à ECO', upgradeHighQualityTip: 'Une fois la mise à niveau vers le mode Haute Qualité, il n’est pas possible de revenir au mode Économique', helpText: 'Apprenez à rédiger une bonne description de jeu de données.', + searchModel: 'Rechercher un modèle', }, } diff --git a/web/i18n/hi-IN/dataset-settings.ts b/web/i18n/hi-IN/dataset-settings.ts index ff324dcb43..e7a383690c 100644 --- a/web/i18n/hi-IN/dataset-settings.ts +++ b/web/i18n/hi-IN/dataset-settings.ts @@ -40,6 +40,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: 'मुख्यालय से ईसीओ में डाउनग्रेड करने के लिए उपलब्ध नहीं है', helpText: 'एक अच्छा डेटासेट विवरण लिखना सीखें।', upgradeHighQualityTip: 'एक बार उच्च गुणवत्ता मोड में अपग्रेड करने के बाद, किफायती मोड में वापस जाना उपलब्ध नहीं है', + searchModel: 'मॉडल खोजें', }, } diff --git a/web/i18n/it-IT/dataset-settings.ts b/web/i18n/it-IT/dataset-settings.ts index 66c13bd3b4..c799872975 100644 --- a/web/i18n/it-IT/dataset-settings.ts +++ b/web/i18n/it-IT/dataset-settings.ts @@ -40,6 +40,7 @@ const translation = { helpText: 'Scopri come scrivere una buona descrizione del set di dati.', upgradeHighQualityTip: 'Una volta effettuato l\'aggiornamento alla modalità Alta qualità, il ripristino della modalità Risparmio non è disponibile', indexMethodChangeToEconomyDisabledTip: 'Non disponibile per il downgrade da HQ a ECO', + searchModel: 'Cerca modello', }, } diff --git a/web/i18n/ja-JP/dataset-settings.ts b/web/i18n/ja-JP/dataset-settings.ts index 9ea6aba9eb..6b809ddd43 100644 --- a/web/i18n/ja-JP/dataset-settings.ts +++ b/web/i18n/ja-JP/dataset-settings.ts @@ -36,6 +36,7 @@ const translation = { retrievalSettings: '取得設定', externalKnowledgeAPI: '外部ナレッジベースAPI', indexMethodChangeToEconomyDisabledTip: 'HQからECOへのダウングレードはできません。', + searchModel: 'モデル検索', }, } diff --git a/web/i18n/ko-KR/dataset-settings.ts b/web/i18n/ko-KR/dataset-settings.ts index 22e9733ed8..c15fff8db6 100644 --- a/web/i18n/ko-KR/dataset-settings.ts +++ b/web/i18n/ko-KR/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { upgradeHighQualityTip: '고품질 모드로 업그레이드한 후에는 경제적 모드로 되돌릴 수 없습니다.', indexMethodChangeToEconomyDisabledTip: 'HQ에서 ECO로 다운그레이드할 수 없습니다.', helpText: '좋은 데이터 세트 설명을 작성하는 방법을 알아보세요.', + searchModel: '모델 검색', }, } diff --git a/web/i18n/pl-PL/dataset-settings.ts b/web/i18n/pl-PL/dataset-settings.ts index ff2a2e5d5f..94099708b7 100644 --- a/web/i18n/pl-PL/dataset-settings.ts +++ b/web/i18n/pl-PL/dataset-settings.ts @@ -40,6 +40,7 @@ const translation = { helpText: 'Dowiedz się, jak napisać dobry opis zestawu danych.', upgradeHighQualityTip: 'Po uaktualnieniu do trybu wysokiej jakości powrót do trybu ekonomicznego nie jest dostępny', indexMethodChangeToEconomyDisabledTip: 'Niedostępne w przypadku zmiany z HQ na ECO', + searchModel: 'Szukaj modelu', }, } diff --git a/web/i18n/pt-BR/dataset-settings.ts b/web/i18n/pt-BR/dataset-settings.ts index b8176d222a..a9346c4dd0 100644 --- a/web/i18n/pt-BR/dataset-settings.ts +++ b/web/i18n/pt-BR/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: 'Não disponível para rebaixamento de HQ para ECO', helpText: 'Aprenda a escrever uma boa descrição do conjunto de dados.', upgradeHighQualityTip: 'Depois de atualizar para o modo de alta qualidade, reverter para o modo econômico não está disponível', + searchModel: 'Pesquisar modelo', }, } diff --git a/web/i18n/ro-RO/dataset-settings.ts b/web/i18n/ro-RO/dataset-settings.ts index baf86c7a8e..0627b08b79 100644 --- a/web/i18n/ro-RO/dataset-settings.ts +++ b/web/i18n/ro-RO/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: 'Nu este disponibil pentru retrogradarea de la HQ la ECO', upgradeHighQualityTip: 'După ce faceți upgrade la modul Înaltă calitate, revenirea la modul Economic nu este disponibilă', helpText: 'Aflați cum să scrieți o descriere bună a setului de date.', + searchModel: 'Căutare model', }, } diff --git a/web/i18n/ru-RU/dataset-settings.ts b/web/i18n/ru-RU/dataset-settings.ts index 82c2fafe2d..b3b8347dd2 100644 --- a/web/i18n/ru-RU/dataset-settings.ts +++ b/web/i18n/ru-RU/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { helpText: 'Узнайте, как написать хорошее описание набора данных.', upgradeHighQualityTip: 'После обновления до режима «Высокое качество» возврат к экономичному режиму невозможен', indexMethodChangeToEconomyDisabledTip: 'Недоступно для понижения уровня с HQ до ECO', + searchModel: 'Поиск модели', }, } diff --git a/web/i18n/sl-SI/dataset-settings.ts b/web/i18n/sl-SI/dataset-settings.ts index 5cd7a72a27..dc131c154e 100644 --- a/web/i18n/sl-SI/dataset-settings.ts +++ b/web/i18n/sl-SI/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: 'Ni na voljo za pregradnjo iz HQ v ECO', upgradeHighQualityTip: 'Ko nadgradite na način visoke kakovosti, vrnitev v ekonomični način ni na voljo', helpText: 'Naučite se napisati dober opis nabora podatkov.', + searchModel: 'Išči model', }, } diff --git a/web/i18n/th-TH/dataset-settings.ts b/web/i18n/th-TH/dataset-settings.ts index ec05db6824..e91834ced2 100644 --- a/web/i18n/th-TH/dataset-settings.ts +++ b/web/i18n/th-TH/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: 'ไม่สามารถดาวน์เกรดจาก HQ เป็น ECO ได้', helpText: 'เรียนรู้วิธีเขียนคําอธิบายชุดข้อมูลที่ดี', upgradeHighQualityTip: 'เมื่ออัปเกรดเป็นโหมดคุณภาพสูงแล้ว จะไม่สามารถเปลี่ยนกลับเป็นโหมดประหยัดได้', + searchModel: 'ค้นหารุ่น', }, } diff --git a/web/i18n/tr-TR/dataset-settings.ts b/web/i18n/tr-TR/dataset-settings.ts index d173563da8..554f3c7a5c 100644 --- a/web/i18n/tr-TR/dataset-settings.ts +++ b/web/i18n/tr-TR/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { upgradeHighQualityTip: 'Yüksek Kalite moduna yükselttikten sonra Ekonomik moda geri dönülemez', indexMethodChangeToEconomyDisabledTip: 'Genel Merkezden ECO\'ya düşürme için mevcut değil', helpText: 'İyi bir veri kümesi açıklamasının nasıl yazılacağını öğrenin.', + searchModel: 'Model Ara', }, } diff --git a/web/i18n/uk-UA/dataset-settings.ts b/web/i18n/uk-UA/dataset-settings.ts index ef3bd5eaa6..c56473896c 100644 --- a/web/i18n/uk-UA/dataset-settings.ts +++ b/web/i18n/uk-UA/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { helpText: 'Дізнайтеся, як написати хороший опис набору даних.', indexMethodChangeToEconomyDisabledTip: 'Недоступно для пониження з HQ до ECO', upgradeHighQualityTip: 'Після оновлення до режиму високої якості повернення до економного режиму недоступне', + searchModel: 'Пошук моделі', }, } diff --git a/web/i18n/vi-VN/dataset-settings.ts b/web/i18n/vi-VN/dataset-settings.ts index 790fd05ca8..7add91884e 100644 --- a/web/i18n/vi-VN/dataset-settings.ts +++ b/web/i18n/vi-VN/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { helpText: 'Tìm hiểu cách viết mô tả tập dữ liệu tốt.', indexMethodChangeToEconomyDisabledTip: 'Không khả dụng để hạ cấp từ HQ xuống ECO', upgradeHighQualityTip: 'Sau khi nâng cấp lên chế độ Chất lượng cao, không thể hoàn nguyên về chế độ Tiết kiệm', + searchModel: 'Tìm kiếm mô hình', }, } diff --git a/web/i18n/zh-Hans/dataset-settings.ts b/web/i18n/zh-Hans/dataset-settings.ts index 4ed0645e0f..f23355dbe1 100644 --- a/web/i18n/zh-Hans/dataset-settings.ts +++ b/web/i18n/zh-Hans/dataset-settings.ts @@ -36,6 +36,7 @@ const translation = { save: '保存', retrievalSettings: '检索设置', indexMethodChangeToEconomyDisabledTip: '无法从高质量降级为经济', + searchModel: '搜索模型', }, } diff --git a/web/i18n/zh-Hant/dataset-settings.ts b/web/i18n/zh-Hant/dataset-settings.ts index b22f899f32..768937c168 100644 --- a/web/i18n/zh-Hant/dataset-settings.ts +++ b/web/i18n/zh-Hant/dataset-settings.ts @@ -35,6 +35,7 @@ const translation = { indexMethodChangeToEconomyDisabledTip: '不適用於從 HQ 降級到 ECO', upgradeHighQualityTip: '升級到高品質模式后,無法恢復到經濟模式', helpText: '瞭解如何編寫良好的數據集描述。', + searchModel: '搜索模型', }, } From 94e22ba0fdc39f539f75d07e4c166f56772b7ccd Mon Sep 17 00:00:00 2001 From: allenZhang <58501701+441126098@users.noreply.github.com> Date: Tue, 22 Apr 2025 11:07:18 +0800 Subject: [PATCH 7/8] feat: add search input field (#18409) --- .../plugins/component-picker-block/index.tsx | 91 +++++++++++-------- .../plugins/on-blur-or-focus-block.tsx | 18 ++-- .../variable/var-reference-vars.tsx | 16 +++- 3 files changed, 76 insertions(+), 49 deletions(-) diff --git a/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx b/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx index d7a3a81417..562bb8c0d9 100644 --- a/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx +++ b/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx @@ -31,6 +31,7 @@ import { useOptions } from './hooks' import type { PickerBlockMenuOption } from './menu' import VarReferenceVars from '@/app/components/workflow/nodes/_base/components/variable/var-reference-vars' import { useEventEmitterContextContext } from '@/context/event-emitter' +import { KEY_ESCAPE_COMMAND } from 'lexical' type ComponentPickerProps = { triggerString: string @@ -118,6 +119,13 @@ const ComponentPicker = ({ editor.dispatchCommand(INSERT_WORKFLOW_VARIABLE_BLOCK_COMMAND, variables) }, [editor, checkForTriggerMatch, triggerString]) + const handleClose = useCallback(() => { + ReactDOM.flushSync(() => { + const escapeEvent = new KeyboardEvent('keydown', { key: 'Escape' }) + editor.dispatchCommand(KEY_ESCAPE_COMMAND, escapeEvent) + }) + }, [editor]) + const renderMenu = useCallback>(( anchorElementRef, { options, selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }, @@ -141,51 +149,54 @@ const ComponentPicker = ({ visibility: isPositioned ? 'visible' : 'hidden', }} ref={refs.setFloating} + data-testid="component-picker-container" > { - options.map((option, index) => ( - - { - // Divider - index !== 0 && options.at(index - 1)?.group !== option.group && ( -
- ) - } - {option.renderMenuOption({ - queryString, - isSelected: selectedIndex === index, - onSelect: () => { - selectOptionAndCleanUp(option) - }, - onSetHighlight: () => { - setHighlightedIndex(index) - }, - })} -
- )) + workflowVariableBlock?.show && ( +
+ { + handleSelectWorkflowVariable(variables) + }} + maxHeightClass='max-h-[34vh]' + isSupportFileVar={isSupportFileVar} + onClose={handleClose} + onBlur={handleClose} + /> +
+ ) } { - workflowVariableBlock?.show && ( - <> - { - (!!options.length) && ( -
- ) - } -
- { - handleSelectWorkflowVariable(variables) - }} - maxHeightClass='max-h-[34vh]' - isSupportFileVar={isSupportFileVar} - /> -
- + workflowVariableBlock?.show && !!options.length && ( +
) } +
+ { + options.map((option, index) => ( + + { + // Divider + index !== 0 && options.at(index - 1)?.group !== option.group && ( +
+ ) + } + {option.renderMenuOption({ + queryString, + isSelected: selectedIndex === index, + onSelect: () => { + selectOptionAndCleanUp(option) + }, + onSetHighlight: () => { + setHighlightedIndex(index) + }, + })} +
+ )) + } +
, anchorElementRef.current, @@ -193,7 +204,7 @@ const ComponentPicker = ({ } ) - }, [allFlattenOptions.length, workflowVariableBlock?.show, refs, isPositioned, floatingStyles, queryString, workflowVariableOptions, handleSelectWorkflowVariable]) + }, [allFlattenOptions.length, workflowVariableBlock?.show, refs, isPositioned, floatingStyles, queryString, workflowVariableOptions, handleSelectWorkflowVariable, handleClose, isSupportFileVar]) return ( = ({ ), editor.registerCommand( BLUR_COMMAND, - () => { - ref.current = setTimeout(() => { - editor.dispatchCommand(KEY_ESCAPE_COMMAND, new KeyboardEvent('keydown', { key: 'Escape' })) - }, 200) - - if (onBlur) - onBlur() - + (event) => { + // Check if the clicked target element is var-search-input + const target = event?.relatedTarget as HTMLElement + if (!target?.classList?.contains('var-search-input')) { + ref.current = setTimeout(() => { + editor.dispatchCommand(KEY_ESCAPE_COMMAND, new KeyboardEvent('keydown', { key: 'Escape' })) + }, 200) + if (onBlur) + onBlur() + } return true }, COMMAND_PRIORITY_EDITOR, diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx index 751e1990cf..023916ec5b 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx @@ -258,6 +258,8 @@ type Props = { onChange: (value: ValueSelector, item: Var) => void itemWidth?: number maxHeightClass?: string + onClose?: () => void + onBlur?: () => void } const VarReferenceVars: FC = ({ hideSearch, @@ -267,10 +269,19 @@ const VarReferenceVars: FC = ({ onChange, itemWidth, maxHeightClass, + onClose, + onBlur, }) => { const { t } = useTranslation() const [searchText, setSearchText] = useState('') + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Escape') { + e.preventDefault() + onClose?.() + } + } + const filteredVars = vars.filter((v) => { const children = v.vars.filter(v => checkKeys([v.variable], false).isValid || v.variable.startsWith('sys.') || v.variable.startsWith('env.') || v.variable.startsWith('conversation.')) return children.length > 0 @@ -301,14 +312,17 @@ const VarReferenceVars: FC = ({ { !hideSearch && ( <> -
e.stopPropagation()}> +
e.stopPropagation()}> setSearchText(e.target.value)} + onKeyDown={handleKeyDown} onClear={() => setSearchText('')} + onBlur={onBlur} autoFocus />
From e0e92921b5cb7d3ae1700e4c700bcbdbd712a705 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Tue, 22 Apr 2025 11:29:45 +0800 Subject: [PATCH 8/8] fix: external knowledge setting in knowledge selector (#18519) --- .../dataset-config/settings-modal/index.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx index 90885dacc8..645f6045f0 100644 --- a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx +++ b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx @@ -62,13 +62,13 @@ const SettingsModal: FC = ({ const { notify } = useToastContext() const ref = useRef(null) const isExternal = currentDataset.provider === 'external' - const [topK, setTopK] = useState(currentDataset?.external_retrieval_model.top_k ?? 2) - const [scoreThreshold, setScoreThreshold] = useState(currentDataset?.external_retrieval_model.score_threshold ?? 0.5) - const [scoreThresholdEnabled, setScoreThresholdEnabled] = useState(currentDataset?.external_retrieval_model.score_threshold_enabled ?? false) const { setShowAccountSettingModal } = useModalContext() const [loading, setLoading] = useState(false) const { isCurrentWorkspaceDatasetOperator } = useAppContext() const [localeCurrentDataset, setLocaleCurrentDataset] = useState({ ...currentDataset }) + const [topK, setTopK] = useState(localeCurrentDataset?.external_retrieval_model.top_k ?? 2) + const [scoreThreshold, setScoreThreshold] = useState(localeCurrentDataset?.external_retrieval_model.score_threshold ?? 0.5) + const [scoreThresholdEnabled, setScoreThresholdEnabled] = useState(localeCurrentDataset?.external_retrieval_model.score_threshold_enabled ?? false) const [selectedMemberIDs, setSelectedMemberIDs] = useState(currentDataset.partial_member_list || []) const [memberList, setMemberList] = useState([]) @@ -88,6 +88,14 @@ const SettingsModal: FC = ({ setScoreThreshold(data.score_threshold) if (data.score_threshold_enabled !== undefined) setScoreThresholdEnabled(data.score_threshold_enabled) + + setLocaleCurrentDataset({ + ...localeCurrentDataset, + external_retrieval_model: { + ...localeCurrentDataset?.external_retrieval_model, + ...data, + }, + }) } const handleSave = async () => {