RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix(web): make sidebar i18n reactive and refine template card/icon UI (#16646)
Yoorim Choi17a59604bc06
diff --git a/web/src/components/card-container.tsx b/web/src/components/card-container.tsxindex 9f79dbedb1..756bcf4d8b 100644--- a/web/src/components/card-container.tsx+++ b/web/src/components/card-container.tsx@@ -28,6 +28,7 @@ export function CardContainer({ children, className }: CardContainerProps) {)}>{children}+ <div className="col-span-full h-6" aria-hidden="true" /></div>);}diff --git a/web/src/components/file-uploader.tsx b/web/src/components/file-uploader.tsxindex 769ea94213..bd4dc65d2c 100644--- a/web/src/components/file-uploader.tsx+++ b/web/src/components/file-uploader.tsx@@ -47,7 +47,7 @@ function FilePreview({ file }: FilePreviewProps) {}return (- <FileText className="size-10 text-muted-foreground" aria-hidden="true" />+ <FileText strokeWidth={1} className="size-10 text-muted-foreground" aria-hidden="true" />);}diff --git a/web/src/locales/ko.ts b/web/src/locales/ko.tsindex c1210cad2c..ff120ad939 100644--- a/web/src/locales/ko.ts+++ b/web/src/locales/ko.ts@@ -680,10 +680,10 @@ export default {parseType: '파싱 유형',manualSetup: '파이프라인',builtIn: '기본 제공',- titleDescription: 'LLM 및 프롬프트를 포함한 데이터셋에 대해 설정합니다.',+ titleDescription: 'LLM 및 프롬프트를 포함한 데이터셋에 대해 설정합니다',name: '데이터셋 이름',photo: '데이터셋 사진',- photoTip: '최대 4MB의 이미지를 업로드할 수 있습니다.',+ photoTip: '최대 4MB의 이미지를 업로드할 수 있습니다',description: '설명',language: '문서 언어',languageMessage: '언어를 입력해 주세요',diff --git a/web/src/pages/agents/template-card.tsx b/web/src/pages/agents/template-card.tsxindex e7cff0d3e3..bdeec0f6ef 100644--- a/web/src/pages/agents/template-card.tsx+++ b/web/src/pages/agents/template-card.tsx@@ -4,8 +4,9 @@ import { Card, CardContent } from '@/components/ui/card';import { LanguageAbbreviation } from '@/constants/common';import { IFlowTemplate } from '@/interfaces/database/agent';import i18n from '@/locales/config';-import { useCallback, useMemo } from 'react';+import { useCallback } from 'react';import { useTranslation } from 'react-i18next';+interface IProps {data: IFlowTemplate;isCreate?: boolean;@@ -19,12 +20,13 @@ export function TemplateCard({ data, showModal }: IProps) {showModal(data);}, [data, showModal]);- const language = useMemo(() => {- if (i18n.language === LanguageAbbreviation.Zh) {- return 'zh';- }- return i18n.language || 'en';- }, []) as 'en' | 'zh' | 'de';+ const language = (+ i18n.language === LanguageAbbreviation.Zh+ ? 'zh'+ : i18n.language === LanguageAbbreviation.De+ ? 'de'+ : 'en'+ ) as 'en' | 'zh' | 'de';return (<Card className="border-colors-outline-neutral-standard group relative min-h-40">@@ -48,10 +50,10 @@ export function TemplateCard({ data, showModal }: IProps) {<div className="group-hover:bg-gradient-to-t from-black/70 from-10% via-black/0 via-50% to-black/0 w-full h-full group-hover:block absolute top-0 left-0 hidden rounded-xl"><Buttonvariant="default"- className="w-1/3 absolute bottom-4 right-4 left-4 justify-center text-center m-auto"onClick={handleClick}+ className="absolute bottom-4 left-4 right-4 mx-auto px-4 py-2 max-w-[280px] whitespace-normal text-center">- {t('flow.useTemplate')}+ <span className="inline-block">{t('flow.useTemplate')}</span></Button></div></CardContent>diff --git a/web/src/pages/agents/template-sidebar.tsx b/web/src/pages/agents/template-sidebar.tsxindex 4506de0638..4772709588 100644--- a/web/src/pages/agents/template-sidebar.tsx+++ b/web/src/pages/agents/template-sidebar.tsx@@ -1,6 +1,5 @@import { Button } from '@/components/ui/button';import { cn } from '@/lib/utils';-import { t } from 'i18next';import { lowerFirst } from 'lodash';import {Box,@@ -11,6 +10,8 @@ import {Route,Sparkle,} from 'lucide-react';+import { useMemo } from 'react';+import { useTranslation } from 'react-i18next';export enum MenuItemKey {Recommended = 'Recommended',Agent = 'Agent',@@ -20,53 +21,6 @@ export enum MenuItemKey {Pipeline = 'Ingestion Pipeline',Other = 'Other',}-const menuItems = [- {- // section: 'All Templates',- section: '',- items: [- {- icon: Sparkle,- label: t('flow.' + lowerFirst(MenuItemKey.Recommended)),- key: MenuItemKey.Recommended,- },- {- icon: Box,- label: t('flow.' + lowerFirst(MenuItemKey.Agent)),- key: MenuItemKey.Agent,- },- {- icon: MessageCircleCode,- label: t(- 'flow.' + lowerFirst(MenuItemKey.CustomerSupport).replace(' ', ''),- ),- key: MenuItemKey.CustomerSupport,- },- {- icon: ChartPie,- label: t('flow.' + lowerFirst(MenuItemKey.Marketing)),- key: MenuItemKey.Marketing,- },- {- icon: Component,- label: t(- 'flow.' + lowerFirst(MenuItemKey.ConsumerApp.replace(' ', '')),- ),- key: MenuItemKey.ConsumerApp,- },- {- icon: Route,- label: t('flow.' + lowerFirst(MenuItemKey.Pipeline.replace(' ', ''))),- key: MenuItemKey.Pipeline,- },- {- icon: PencilRuler,- label: t('flow.' + lowerFirst(MenuItemKey.Other)),- key: MenuItemKey.Other,- },- ],- },-];export function SideBar({change,@@ -75,10 +29,66 @@ export function SideBar({change: (keyword: string) => void;selected?: string;}) {+ const { t } = useTranslation();+const handleMenuClick = (key: string) => {change(key);};+ const menuItems = useMemo(+ () => [+ {+ // section: 'All Templates',+ section: '',+ items: [+ {+ icon: Sparkle,+ label: t('flow.' + lowerFirst(MenuItemKey.Recommended)),+ key: MenuItemKey.Recommended,+ },+ {+ icon: Box,+ label: t('flow.' + lowerFirst(MenuItemKey.Agent)),+ key: MenuItemKey.Agent,+ },+ {+ icon: MessageCircleCode,+ label: t(+ 'flow.' ++ lowerFirst(MenuItemKey.CustomerSupport).replace(' ', ''),+ ),+ key: MenuItemKey.CustomerSupport,+ },+ {+ icon: ChartPie,+ label: t('flow.' + lowerFirst(MenuItemKey.Marketing)),+ key: MenuItemKey.Marketing,+ },+ {+ icon: Component,+ label: t(+ 'flow.' + lowerFirst(MenuItemKey.ConsumerApp.replace(' ', '')),+ ),+ key: MenuItemKey.ConsumerApp,+ },+ {+ icon: Route,+ label: t(+ 'flow.' + lowerFirst(MenuItemKey.Pipeline.replace(' ', '')),+ ),+ key: MenuItemKey.Pipeline,+ },+ {+ icon: PencilRuler,+ label: t('flow.' + lowerFirst(MenuItemKey.Other)),+ key: MenuItemKey.Other,+ },+ ],+ },+ ],+ [t],+ );+return (<aside className="w-[303px] bg-text-title-invert border-r flex flex-col"><div className="flex-1 overflow-auto">diff --git a/web/src/pages/dataset/dataset/parsing-status-cell.tsx b/web/src/pages/dataset/dataset/parsing-status-cell.tsxindex b2c2e6f3db..dcee61dea9 100644--- a/web/src/pages/dataset/dataset/parsing-status-cell.tsx+++ b/web/src/pages/dataset/dataset/parsing-status-cell.tsx@@ -155,9 +155,9 @@ export function ParsingStatusCell({<Progress value={p} className="h-1 flex-1 min-w-10" /><div className="flex items-center gap-1">{p}%- <sup className="inline-flex">- <CircleQuestionMark className="size-[1.25em]" />- </sup>+ <span className="inline-flex items-center">+ <CircleQuestionMark className="size-[1em]" />+ </span></div></Button>