Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Feat: Translate embedded dialog text. (#13623)

balibabufa48ffe5de77
diff --git a/web/src/components/embed-dialog/index.tsx b/web/src/components/embed-dialog/index.tsx
index e84f5e1bff..d2656b2ae0 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 }) => (
<FormItem>
- <FormLabel>Embed Type</FormLabel>
+ <FormLabel>{t('chat.embedType')}</FormLabel>
<FormControl>
<RadioGroup
onValueChange={field.onChange}
@@ -204,13 +204,13 @@ window.addEventListener('message',e=>{
<div className="flex items-center space-x-2">
<RadioGroupItem value="fullscreen" id="fullscreen" />
<Label htmlFor="fullscreen" className="text-sm">
- Fullscreen Chat (Traditional iframe)
+ {t('chat.fullscreenChat')}
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="widget" id="widget" />
<Label htmlFor="widget" className="text-sm">
- Floating Widget (Intercom-style)
+ {t('chat.floatingWidget')}
</Label>
</div>
</RadioGroup>
@@ -225,7 +225,7 @@ window.addEventListener('message',e=>{
name="theme"
render={({ field }) => (
<FormItem>
- <FormLabel>Theme</FormLabel>
+ <FormLabel>{t('chat.theme')}</FormLabel>
<FormControl>
<RadioGroup
onValueChange={field.onChange}
@@ -238,13 +238,13 @@ window.addEventListener('message',e=>{
id="light"
/>
<Label htmlFor="light" className="text-sm">
- Light
+ {t('chat.light')}
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value={ThemeEnum.Dark} id="dark" />
<Label htmlFor="dark" className="text-sm">
- Dark
+ {t('chat.dark')}
</Label>
</div>
</RadioGroup>
@@ -254,75 +254,31 @@ window.addEventListener('message',e=>{
)}
/>
)}
- <FormField
- control={form.control}
+ <SwitchFormField
name="visibleAvatar"
- render={({ field }) => (
- <FormItem>
- <FormLabel>{t('chat.avatarHidden')}</FormLabel>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- ></Switch>
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="publishAvatar"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Publish Avatar</FormLabel>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- ></Switch>
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
+ label={t('chat.avatarHidden')}
+ ></SwitchFormField>
+ {isAgent && (
+ <SwitchFormField
+ name="published"
+ label={t('chat.published')}
+ tooltip={t('chat.publishedTooltip')}
+ ></SwitchFormField>
+ )}
{values.embedType === 'widget' && (
- <FormField
- control={form.control}
+ <SwitchFormField
name="enableStreaming"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Enable Streaming Responses</FormLabel>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- ></Switch>
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
+ label={t('chat.enableStreaming')}
+ ></SwitchFormField>
)}
- <FormField
- control={form.control}
- name="locale"
- render={({ field }) => (
- <FormItem>
- <FormLabel>{t('chat.locale')}</FormLabel>
- <FormControl>
- <SelectWithSearch
- {...field}
- options={languageOptions}
- ></SelectWithSearch>
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <RAGFlowFormItem name="userId" label={t('flow.userId')}>
- <Input></Input>
+ <RAGFlowFormItem name="locale" label={t('chat.locale')}>
+ <SelectWithSearch options={languageOptions}></SelectWithSearch>
</RAGFlowFormItem>
+ {isAgent && (
+ <RAGFlowFormItem name="userId" label={t('flow.userId')}>
+ <Input></Input>
+ </RAGFlowFormItem>
+ )}
</form>
</Form>
<div>
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index ab49e1de4d..0b19997283 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 e4e7998b6c..dfdeba399f 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嵌入您的网站处于所需位置',