From 8ad47bf242e228535b5730d57bf6981fa0e3e499 Mon Sep 17 00:00:00 2001 From: PentaFDevs <149094373+PentaFrame-Development@users.noreply.github.com> Date: Wed, 25 Feb 2026 06:39:02 +0100 Subject: [PATCH] feat: add 'Open in new tab' button for agents (#13044) - Add new button in agent management dropdown to open agent in new tab - Implement token-based authentication for shared agent access - Add translations for 9 languages (en, zh, zh-tw, de, fr, it, ru, pt-br, vi) - Keep existing 'Embed into webpage' functionality intact ### What problem does this PR solve? This allows users to open agents in a separate tab to work in background while continuing to use other parts of the application. image image image ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- docs/guides/agent/embed_agent_into_webpage.md | 11 +++++++++-- web/src/components/embed-dialog/index.tsx | 15 +++++++++++++++ web/src/locales/de.ts | 1 + web/src/locales/en.ts | 1 + web/src/locales/fr.ts | 1 + web/src/locales/it.ts | 1 + web/src/locales/pt-br.ts | 1 + web/src/locales/ru.ts | 1 + web/src/locales/vi.ts | 1 + web/src/locales/zh-traditional.ts | 1 + web/src/locales/zh.ts | 1 + web/src/pages/agent/index.tsx | 1 - 12 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/guides/agent/embed_agent_into_webpage.md b/docs/guides/agent/embed_agent_into_webpage.md index 97dae8b66c..4676443e16 100644 --- a/docs/guides/agent/embed_agent_into_webpage.md +++ b/docs/guides/agent/embed_agent_into_webpage.md @@ -11,7 +11,14 @@ You can use iframe to embed an agent into a third-party webpage. 1. Before proceeding, you must [acquire an API key](../models/llm_api_key_setup.md); otherwise, an error message would appear. 2. On the **Agent** page, click an intended agent to access its editing page. -3. Click **Management > Embed into webpage** on the top right corner of the canvas to show the **iframe** window: -4. Copy the iframe and embed it into your webpage. +3. Click **Management > Embed into webpage** on the top right corner of the canvas to show the **Embed into webpage** dialog. +4. Configure your embed options: + - **Embed Type**: Choose between Fullscreen Chat (traditional iframe) or Floating Widget (Intercom-style) + - **Theme**: Select Light or Dark theme (for fullscreen mode) + - **Hide avatar**: Toggle avatar visibility + - **Enable Streaming Responses**: Enable streaming for widget mode + - **Locale**: Select the language for the embedded agent +5. Copy the generated iframe code and embed it into your webpage. +6. **Chat in new tab**: Click the "Chat in new tab" button to preview the agent in a separate browser tab with your configured settings. This allows you to test the agent before embedding it. ![Embed_agent](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/embed_agent_into_webpage.jpg) \ No newline at end of file diff --git a/web/src/components/embed-dialog/index.tsx b/web/src/components/embed-dialog/index.tsx index 341abd0342..27e669457a 100644 --- a/web/src/components/embed-dialog/index.tsx +++ b/web/src/components/embed-dialog/index.tsx @@ -1,6 +1,7 @@ import CopyToClipboard from '@/components/copy-to-clipboard'; import HighLightMarkdown from '@/components/highlight-markdown'; import { SelectWithSearch } from '@/components/originui/select-with-search'; +import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, @@ -28,6 +29,7 @@ import { useTranslate } from '@/hooks/common-hooks'; import { IModalProps } from '@/interfaces/common'; import { Routes } from '@/routes'; import { zodResolver } from '@hookform/resolvers/zod'; +import { ExternalLink } from 'lucide-react'; import { memo, useCallback, useMemo } from 'react'; import { useForm, useWatch } from 'react-hook-form'; import { z } from 'zod'; @@ -146,6 +148,11 @@ function EmbedDialog({ } }, [generateIframeSrc, values]); + const handleOpenInNewTab = useCallback(() => { + const iframeSrc = generateIframeSrc(); + window.open(iframeSrc, '_blank'); + }, [generateIframeSrc]); + return ( @@ -280,6 +287,14 @@ function EmbedDialog({ {text} +
{t(isAgent ? 'flow' : 'chat', { keyPrefix: 'header' })} ID diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts index 646b8e82d7..44d9eda23d 100644 --- a/web/src/locales/de.ts +++ b/web/src/locales/de.ts @@ -48,6 +48,7 @@ export default { submit: 'Absenden', clear: 'Leeren', embedIntoSite: 'In Webseite einbetten', + openInNewTab: 'Chat in neuem Tab', previousPage: 'Zurück', nextPage: 'Weiter', add: 'Hinzufügen', diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 22742aa38e..9218b32ea6 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -46,6 +46,7 @@ export default { submit: 'Submit', clear: 'Clear', embedIntoSite: 'Embed into webpage', + openInNewTab: 'Chat in new tab', previousPage: 'Previous', nextPage: 'Next', add: 'Add', diff --git a/web/src/locales/fr.ts b/web/src/locales/fr.ts index 93cdbf5592..e40de4c383 100644 --- a/web/src/locales/fr.ts +++ b/web/src/locales/fr.ts @@ -37,6 +37,7 @@ export default { pleaseInput: 'Veuillez saisir', submit: 'Soumettre', embedIntoSite: 'Intégrer dans la page web', + openInNewTab: 'Chat dans un nouvel onglet', previousPage: 'Précédent', nextPage: 'Suivant', add: 'Ajouter', diff --git a/web/src/locales/it.ts b/web/src/locales/it.ts index 81cc14eacd..1dd13fe0b8 100644 --- a/web/src/locales/it.ts +++ b/web/src/locales/it.ts @@ -53,6 +53,7 @@ export default { submit: 'Invia', clear: 'Cancella', embedIntoSite: 'Incorpora nella pagina web', + openInNewTab: 'Chat in una nuova scheda', previousPage: 'Precedente', nextPage: 'Successivo', add: 'Aggiungi', diff --git a/web/src/locales/pt-br.ts b/web/src/locales/pt-br.ts index a19dce4da1..aa195cbe4b 100644 --- a/web/src/locales/pt-br.ts +++ b/web/src/locales/pt-br.ts @@ -36,6 +36,7 @@ export default { pleaseInput: 'Por favor, insira', submit: 'Enviar', embedIntoSite: 'Incorporar no site', + openInNewTab: 'Chat em nova aba', previousPage: 'Anterior', nextPage: 'Próxima', }, diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts index 4709255443..ce8ba863f8 100644 --- a/web/src/locales/ru.ts +++ b/web/src/locales/ru.ts @@ -45,6 +45,7 @@ export default { submit: 'Отправить', clear: 'Очистить', embedIntoSite: 'Встроить на веб-страницу', + openInNewTab: 'Чат в новой вкладке', previousPage: 'Назад', nextPage: 'Вперед', add: 'Добавить', diff --git a/web/src/locales/vi.ts b/web/src/locales/vi.ts index 1671c608e2..7beecc6ba8 100644 --- a/web/src/locales/vi.ts +++ b/web/src/locales/vi.ts @@ -39,6 +39,7 @@ export default { spanish: 'Tiếng Tây Ban Nha', japanese: 'Tiếng Nhật', embedIntoSite: 'Nhúng vào trang web', + openInNewTab: 'Chat trong tab mới', nextPage: 'Tới', previousPage: 'Lùi', }, diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index 8ce2693bc4..ce1f4932cd 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -36,6 +36,7 @@ export default { pleaseInput: '請輸入', submit: '提交', embedIntoSite: '嵌入網站', + openInNewTab: '在新標籤頁中聊天', previousPage: '上一頁', nextPage: '下一頁', add: '添加', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 033acfe3d9..1850232ebd 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -45,6 +45,7 @@ export default { submit: '提交', clear: '清空', embedIntoSite: '嵌入网站', + openInNewTab: '在新标签页中聊天', previousPage: '上一页', nextPage: '下一页', add: '添加', diff --git a/web/src/pages/agent/index.tsx b/web/src/pages/agent/index.tsx index e16a30b07d..39a5aee3b4 100644 --- a/web/src/pages/agent/index.tsx +++ b/web/src/pages/agent/index.tsx @@ -17,7 +17,6 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; -import message from '@/components/ui/message'; import { SharedFrom } from '@/constants/chat'; import { useSetModalState } from '@/hooks/common-hooks'; import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';