diff --git a/web/src/components/ragflow-avatar.tsx b/web/src/components/ragflow-avatar.tsx new file mode 100644 index 000000000..08d883aca --- /dev/null +++ b/web/src/components/ragflow-avatar.tsx @@ -0,0 +1,35 @@ +import * as AvatarPrimitive from '@radix-ui/react-avatar'; +import { random } from 'lodash'; +import { forwardRef } from 'react'; +import { Avatar, AvatarFallback, AvatarImage } from './ui/avatar'; + +const Colors = [ + { from: '#4F6DEE', to: '#67BDF9' }, + { from: '#38A04D', to: '#93DCA2' }, + { from: '#EDB395', to: '#C35F2B' }, + { from: '#633897', to: '#CBA1FF' }, +]; + +export const RAGFlowAvatar = forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + name?: string; + avatar?: string; + } +>(({ name, avatar, ...props }, ref) => { + const index = random(0, 3); + console.log('🚀 ~ index:', index); + const value = Colors[index]; + return ( + + + + {name?.slice(0, 1)} + + + ); +}); + +RAGFlowAvatar.displayName = 'RAGFlowAvatar'; diff --git a/web/src/components/ui/card.tsx b/web/src/components/ui/card.tsx index 84f09d539..3e6e7f5f7 100644 --- a/web/src/components/ui/card.tsx +++ b/web/src/components/ui/card.tsx @@ -9,7 +9,7 @@ const Card = React.forwardRef<
() => { @@ -158,10 +158,12 @@ export function Header() { {theme === 'light' ? : }
- - - CN - + Pro diff --git a/web/src/pages/add-knowledge/components/knowledge-file/index.tsx b/web/src/pages/add-knowledge/components/knowledge-file/index.tsx index c9d2ab2ea..c0d9a7ee1 100644 --- a/web/src/pages/add-knowledge/components/knowledge-file/index.tsx +++ b/web/src/pages/add-knowledge/components/knowledge-file/index.tsx @@ -7,7 +7,7 @@ import { import { useSetSelectedRecord } from '@/hooks/logic-hooks'; import { useSelectParserList } from '@/hooks/user-setting-hooks'; import { getExtension } from '@/utils/document-util'; -import { Divider, Flex, Switch, Table, Typography } from 'antd'; +import { Divider, Flex, Switch, Table, Tooltip, Typography } from 'antd'; import type { ColumnsType } from 'antd/es/table'; import { useTranslation } from 'react-i18next'; import CreateFileModal from './create-file-modal'; @@ -31,6 +31,7 @@ import FileUploadModal from '@/components/file-upload-modal'; import { RunningStatus } from '@/constants/knowledge'; import { IDocumentInfo } from '@/interfaces/database/document'; import { formatDate } from '@/utils/date'; +import { CircleHelp } from 'lucide-react'; import styles from './index.less'; import { SetMetaModal } from './set-meta-modal'; @@ -157,7 +158,14 @@ const KnowledgeFile = () => { ), }, { - title: t('parsingStatus'), + title: ( + + {t('parsingStatus')} + + + + + ), dataIndex: 'run', key: 'run', filters: Object.entries(RunningStatus).map(([key, value]) => ({ diff --git a/web/src/pages/datasets/dataset-card.tsx b/web/src/pages/datasets/dataset-card.tsx index 6c4157032..e4fd13cd1 100644 --- a/web/src/pages/datasets/dataset-card.tsx +++ b/web/src/pages/datasets/dataset-card.tsx @@ -26,7 +26,7 @@ export function DatasetCard({ return ( @@ -81,7 +81,7 @@ export function SeeAllCard() { className="bg-colors-background-inverse-weak w-40" onClick={navigateToDatasetList} > - + See All diff --git a/web/src/pages/home/application-card.tsx b/web/src/pages/home/application-card.tsx index a5031f9fb..c3d9cb6fb 100644 --- a/web/src/pages/home/application-card.tsx +++ b/web/src/pages/home/application-card.tsx @@ -1,6 +1,7 @@ import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Card, CardContent } from '@/components/ui/card'; import { formatDate } from '@/utils/date'; +import { ChevronRight } from 'lucide-react'; type ApplicationCardProps = { app: { @@ -12,19 +13,33 @@ type ApplicationCardProps = { export function ApplicationCard({ app }: ApplicationCardProps) { return ( - - + + CN
-

- {app.title} -

-

{formatDate(app.update_time)}

+

{app.title}

+

+ {formatDate(app.update_time)} +

); } + +export type SeeAllAppCardProps = { + click(): void; +}; + +export function SeeAllAppCard({ click }: SeeAllAppCardProps) { + return ( + + + See All + + + ); +} diff --git a/web/src/pages/home/applications.tsx b/web/src/pages/home/applications.tsx index 97505ed73..29e8291b6 100644 --- a/web/src/pages/home/applications.tsx +++ b/web/src/pages/home/applications.tsx @@ -1,10 +1,11 @@ import { Segmented, SegmentedValue } from '@/components/ui/segmented'; import { Routes } from '@/routes'; import { Cpu, MessageSquare, Search } from 'lucide-react'; -import { useMemo, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { useNavigate } from 'umi'; import { Agents } from './agent-list'; -import { ApplicationCard } from './application-card'; +import { ApplicationCard, SeeAllAppCard } from './application-card'; import { ChatList } from './chat-list'; const applications = [ @@ -38,15 +39,22 @@ const applications = [ }, ]; +const All = 'all'; + export function Applications() { const [val, setVal] = useState('all'); const { t } = useTranslation(); + const navigate = useNavigate(); + + const handleNavigate = useCallback(() => { + navigate(val); + }, [navigate, val]); const options = useMemo( () => [ { label: 'All', - value: 'all', + value: All, }, { value: Routes.Chats, label: t('header.chat') }, { value: Routes.Searches, label: t('header.search') }, @@ -61,7 +69,7 @@ export function Applications() { return (
-
+

Applications

- {(val === 'all' || val === Routes.Searches) && + {(val === All || val === Routes.Searches) && [...Array(12)].map((_, i) => { const app = applications[i % 4]; return ; })} {val === Routes.Agents && } {val === Routes.Chats && } + {val === All || }
); diff --git a/web/tailwind.config.js b/web/tailwind.config.js index f09f2c7e2..fd63ff112 100644 --- a/web/tailwind.config.js +++ b/web/tailwind.config.js @@ -48,6 +48,7 @@ module.exports = { 'text-sub-title': 'var(--text-sub-title)', 'text-title-invert': 'var(--text-title-invert)', 'background-header-bar': 'var(--background-header-bar)', + 'background-card': 'var(--background-card)', primary: { DEFAULT: 'hsl(var(--primary))', diff --git a/web/tailwind.css b/web/tailwind.css index dab606cb8..e9e73ddfa 100644 --- a/web/tailwind.css +++ b/web/tailwind.css @@ -82,6 +82,7 @@ --background-header-bar: rgba(11, 11, 12, 1); --text-title-invert: rgba(255, 255, 255, 1); + --background-card: rgba(22, 22, 24, 0.05); } .dark { @@ -184,6 +185,8 @@ --background-header-bar: rgba(11, 11, 12, 1); --text-title-invert: rgba(22, 22, 24, 1); + + --background-card: rgba(255, 255, 255, 0.05); } }