diff --git a/web/src/components/embed-dialog/index.tsx b/web/src/components/embed-dialog/index.tsx index e84f5e1bf..d2656b2ae 100644 --- a/web/src/components/embed-dialog/index.tsx +++ b/web/src/components/embed-dialog/index.tsx @@ -17,7 +17,6 @@ import { } from '@/components/ui/form'; import { Label } from '@/components/ui/label'; import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'; -import { Switch } from '@/components/ui/switch'; import { SharedFrom } from '@/constants/chat'; import { LanguageAbbreviation, @@ -39,12 +38,13 @@ import { } from 'react-syntax-highlighter/dist/esm/styles/prism'; import { z } from 'zod'; import { RAGFlowFormItem } from '../ragflow-form'; +import { SwitchFormField } from '../switch-fom-field'; import { useIsDarkTheme } from '../theme-provider'; import { Input } from '../ui/input'; const FormSchema = z.object({ visibleAvatar: z.boolean(), - publishAvatar: z.boolean(), + published: z.boolean(), locale: z.string(), embedType: z.enum(['fullscreen', 'widget']), enableStreaming: z.boolean(), @@ -74,7 +74,7 @@ function EmbedDialog({ resolver: zodResolver(FormSchema), defaultValues: { visibleAvatar: false, - publishAvatar: false, + published: false, locale: '', embedType: 'fullscreen' as const, enableStreaming: false, @@ -94,7 +94,7 @@ function EmbedDialog({ const generateIframeSrc = useCallback(() => { const { visibleAvatar, - publishAvatar, + published, locale, embedType, enableStreaming, @@ -113,7 +113,7 @@ function EmbedDialog({ src.searchParams.append('from', from); src.searchParams.append('auth', beta); - if (publishAvatar) { + if (published) { src.searchParams.append('release', 'true'); } if (visibleAvatar) { @@ -194,7 +194,7 @@ window.addEventListener('message',e=>{ name="embedType" render={({ field }) => ( - Embed Type + {t('chat.embedType')} {
@@ -225,7 +225,7 @@ window.addEventListener('message',e=>{ name="theme" render={({ field }) => ( - Theme + {t('chat.theme')} { id="light" />
@@ -254,75 +254,31 @@ window.addEventListener('message',e=>{ )} /> )} - ( - - {t('chat.avatarHidden')} - - - - - - )} - /> - ( - - Publish Avatar - - - - - - )} - /> - {values.embedType === 'widget' && ( - ( - - Enable Streaming Responses - - - - - - )} - /> + label={t('chat.avatarHidden')} + > + {isAgent && ( + )} - ( - - {t('chat.locale')} - - - - - - )} - /> - - + {values.embedType === 'widget' && ( + + )} + + + {isAgent && ( + + + + )}
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index ab49e1de4..0b1999728 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -875,6 +875,16 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s created: 'Created', action: 'Action', embedModalTitle: 'Embed into webpage', + published: 'Published', + publishedTooltip: + 'Use the published version for this embed. When enabled, the generated URL includes release=true.', + embedType: 'Embed type', + fullscreenChat: 'Fullscreen chat (traditional iframe)', + floatingWidget: 'Floating widget (Intercom-style)', + theme: 'Theme', + light: 'Light', + dark: 'Dark', + enableStreaming: 'Enable streaming responses', comingSoon: 'Coming soon', fullScreenTitle: 'Full embed', fullScreenDescription: diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index e4e7998b6..dfdeba399 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -795,6 +795,16 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 created: '创建于', action: '操作', embedModalTitle: '嵌入网站', + published: '已发布', + publishedTooltip: + '在嵌入中使用已发布的版本。启用后,生成的 URL 将包含 release=true。', + embedType: '嵌入类型', + fullscreenChat: '全屏聊天(传统 iframe)', + floatingWidget: '悬浮组件(Intercom 风格)', + theme: '主题', + light: '浅色', + dark: '深色', + enableStreaming: '启用流式响应', comingSoon: '即将推出', fullScreenTitle: '全屏嵌入', fullScreenDescription: '将以下iframe嵌入您的网站处于所需位置',