fix(share): The language of the shared page will cause the language of the original website to change. (#18043)

This commit is contained in:
chanx
2026-08-10 17:26:18 +08:00
committed by GitHub
parent d6292da508
commit 5a2cd36b45
8 changed files with 44 additions and 47 deletions

View File

@@ -294,7 +294,7 @@ const FloatingChatWidget = () => {
}, 50);
if (locale && i18n.language !== locale) {
changeLanguageAsync(locale);
changeLanguageAsync(locale, { persist: false });
}
return () => clearTimeout(timer);

View File

@@ -131,32 +131,29 @@ export function NextMessageInput({
};
}, [isResizing]);
const thinkingOptions = useMemo(
() => [
{
label: t('chat.thinkingLevelUltra'),
value: '4',
description: t('chat.thinkingLevelUltraDescription'),
},
{
label: t('chat.thinkingLevelHigh'),
value: '3',
description: t('chat.thinkingLevelHighDescription'),
},
{
label: t('chat.thinkingLevelMedium'),
value: '2',
description: t('chat.thinkingLevelMediumDescription'),
},
{
label: t('chat.thinkingLevelLow'),
value: '1',
description: t('chat.thinkingLevelLowDescription'),
},
{ label: t('chat.thinkingLevelNone'), value: '0' },
],
[t],
);
const thinkingOptions = [
{
label: t('chat.thinkingLevelUltra'),
value: '4',
description: t('chat.thinkingLevelUltraDescription'),
},
{
label: t('chat.thinkingLevelHigh'),
value: '3',
description: t('chat.thinkingLevelHighDescription'),
},
{
label: t('chat.thinkingLevelMedium'),
value: '2',
description: t('chat.thinkingLevelMediumDescription'),
},
{
label: t('chat.thinkingLevelLow'),
value: '1',
description: t('chat.thinkingLevelLowDescription'),
},
{ label: t('chat.thinkingLevelNone'), value: '0' },
];
const handleThinkingChange = useCallback((value: string) => {
setEnableThinking(value);

View File

@@ -28,9 +28,9 @@ import {
PopoverTrigger,
} from '@/components/ui/popover';
import { cn } from '@/lib/utils';
import { t } from 'i18next';
import { RAGFlowSelectOptionType } from '../ui/select';
import { Separator } from '../ui/separator';
import { useTranslation } from 'react-i18next';
export type SelectWithSearchOptionType = RAGFlowSelectOptionType & {
description?: ReactNode;
@@ -127,8 +127,8 @@ export const SelectWithSearch = forwardRef<
triggerClassName,
allowClear = false,
disabled = false,
placeholder = t('common.selectPlaceholder'),
emptyData = t('common.noDataFound'),
placeholder,
emptyData,
allowCustomValue = false,
onNoMatchEnter,
disableAutoSelectOnEnter = false,
@@ -137,6 +137,9 @@ export const SelectWithSearch = forwardRef<
},
ref,
) => {
const { t } = useTranslation();
const resolvedPlaceholder = placeholder ?? t('common.selectPlaceholder');
const resolvedEmptyData = emptyData ?? t('common.noDataFound');
const id = useId();
const [open, setOpen] = useState<boolean>(false);
const [value, setValue] = useState<string>('');
@@ -257,7 +260,7 @@ export const SelectWithSearch = forwardRef<
{selectLabel || value}
</span>
) : (
<span className="text-text-disabled">{placeholder}</span>
<span className="text-text-disabled">{resolvedPlaceholder}</span>
)}
<div className="flex items-center justify-between">
{value && allowClear && (
@@ -296,7 +299,7 @@ export const SelectWithSearch = forwardRef<
)}
<CommandList className="mt-2 outline-none">
<CommandEmpty>
<div dangerouslySetInnerHTML={{ __html: emptyData }}></div>
<div dangerouslySetInnerHTML={{ __html: resolvedEmptyData }}></div>
</CommandEmpty>
{hasCustomSearchValue && (
<CommandItem