Skip to content

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

Fix: The model category filter does not change based on the system language, and there is no clear visual indicator to show which item is currently selected. (#22038)

balibabu37ac873b1d6e
diff --git a/web/src/components/large-model-form-field.tsx b/web/src/components/large-model-form-field.tsx
index 8101f5077f..deb42ddfff 100644
--- a/web/src/components/large-model-form-field.tsx
+++ b/web/src/components/large-model-form-field.tsx
@@ -17,7 +17,8 @@
import {
DropdownMenu,
DropdownMenuContent,
- DropdownMenuItem,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import {
@@ -28,29 +29,15 @@ import {
FormMessage,
} from '@/components/ui/form';
import { LlmModelType } from '@/constants/knowledge';
-import { t } from 'i18next';
+import { cn } from '@/lib/utils';
import { Funnel } from 'lucide-react';
+import { useMemo } from 'react';
import { useFormContext, useWatch } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { z } from 'zod';
import { NextInnerLLMSelectProps, NextLLMSelect } from './llm-select/next';
import { Button } from './ui/button';
-const ModelTypes = [
- {
- title: t('flow.allModels'),
- value: 'all',
- },
- {
- title: t('flow.textOnlyModels'),
- value: LlmModelType.Chat,
- },
- {
- title: t('flow.multimodalModels'),
- value: LlmModelType.Image2text,
- },
-];
-
export const LargeModelFilterFormSchema = {
llm_filter: z.string().optional(),
};
@@ -69,6 +56,24 @@ export function LargeModelFormField({
const { t } = useTranslation();
const filter = useWatch({ control: form.control, name: 'llm_filter' });
+ const modelTypes = useMemo(
+ () => [
+ {
+ title: t('flow.allModels'),
+ value: 'all',
+ },
+ {
+ title: t('flow.textOnlyModels'),
+ value: LlmModelType.Chat,
+ },
+ {
+ title: t('flow.multimodalModels'),
+ value: LlmModelType.Image2text,
+ },
+ ],
+ [t],
+ );
+
return (
<>
<FormField
@@ -89,20 +94,29 @@ export function LargeModelFormField({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant={'ghost'}>
- <Funnel className="text-text-disabled" />
+ <Funnel
+ className={cn(
+ filter && filter !== 'all'
+ ? 'text-accent-primary'
+ : 'text-text-disabled',
+ )}
+ />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
- {ModelTypes.map((x) => (
- <DropdownMenuItem
- key={x.value}
- onClick={() => {
- field.onChange(x.value);
- }}
- >
- {x.title}
- </DropdownMenuItem>
- ))}
+ <DropdownMenuRadioGroup
+ value={field.value || 'all'}
+ onValueChange={field.onChange}
+ >
+ {modelTypes.map((x) => (
+ <DropdownMenuRadioItem
+ key={x.value}
+ value={x.value}
+ >
+ {x.title}
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
</FormControl>