From 8fdfa0f66974747277d2d9b2f32e560bcaf546ba Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 18 Oct 2024 12:50:06 +0800 Subject: [PATCH] feat: Use Badge.Ribbon to distinguish the teams to which the knowledge base belongs #2846 (#2891) ### What problem does this PR solve? feat: Use Badge.Ribbon to distinguish the teams to which the knowledge base belongs #2846 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): --- .../backend-service-api.tsx | 4 +- web/src/interfaces/database/knowledge.ts | 1 + .../pages/knowledge/knowledge-card/index.less | 8 ++ .../pages/knowledge/knowledge-card/index.tsx | 99 ++++++++++--------- 4 files changed, 66 insertions(+), 46 deletions(-) diff --git a/web/src/components/api-service/chat-overview-modal/backend-service-api.tsx b/web/src/components/api-service/chat-overview-modal/backend-service-api.tsx index b5ea34adbb..0cf86eda10 100644 --- a/web/src/components/api-service/chat-overview-modal/backend-service-api.tsx +++ b/web/src/components/api-service/chat-overview-modal/backend-service-api.tsx @@ -22,10 +22,10 @@ const BackendServiceApi = ({ show }: { show(): void }) => { {t('backendServiceApi')} - {location.origin}/v1/api/ + {location.origin}/api/v1/ diff --git a/web/src/interfaces/database/knowledge.ts b/web/src/interfaces/database/knowledge.ts index b8fb2c3a3b..98db87c5ca 100644 --- a/web/src/interfaces/database/knowledge.ts +++ b/web/src/interfaces/database/knowledge.ts @@ -22,6 +22,7 @@ export interface IKnowledge { update_time: number; vector_similarity_weight: number; embd_id: string; + nickname?: string; } export interface Parserconfig { diff --git a/web/src/pages/knowledge/knowledge-card/index.less b/web/src/pages/knowledge/knowledge-card/index.less index 1c7d174e0f..bd5d819110 100644 --- a/web/src/pages/knowledge/knowledge-card/index.less +++ b/web/src/pages/knowledge/knowledge-card/index.less @@ -76,3 +76,11 @@ vertical-align: middle; } } + +.hideRibbon { + display: none !important; +} + +.ribbon { + top: 4px; +} diff --git a/web/src/pages/knowledge/knowledge-card/index.tsx b/web/src/pages/knowledge/knowledge-card/index.tsx index fe3dfaee80..7f6e131692 100644 --- a/web/src/pages/knowledge/knowledge-card/index.tsx +++ b/web/src/pages/knowledge/knowledge-card/index.tsx @@ -6,12 +6,14 @@ import { FileTextOutlined, UserOutlined, } from '@ant-design/icons'; -import { Avatar, Card, Space } from 'antd'; +import { Avatar, Badge, Card, Space } from 'antd'; +import classNames from 'classnames'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'umi'; import OperateDropdown from '@/components/operate-dropdown'; import { useDeleteKnowledge } from '@/hooks/knowledge-hooks'; +import { useFetchUserInfo } from '@/hooks/user-setting-hooks'; import styles from './index.less'; interface IProps { @@ -21,6 +23,7 @@ interface IProps { const KnowledgeCard = ({ item }: IProps) => { const navigate = useNavigate(); const { t } = useTranslation(); + const { data: userInfo } = useFetchUserInfo(); const { deleteKnowledge } = useDeleteKnowledge(); @@ -35,55 +38,63 @@ const KnowledgeCard = ({ item }: IProps) => { }; return ( - -
-
- } src={item.avatar} /> - -
-
- {item.name} -

{item.description}

-
-
-
-
- - - - {item.doc_num} - {t('knowledgeList.doc')} - - -
+ + +
+
+ } src={item.avatar} /> +
-
-
- - - {formatDate(item.update_time)} - +
+ {item.name} +

{item.description}

+
+
+
+
+ + + + {item.doc_num} + {t('knowledgeList.doc')} + + +
- {/* - - - K - - +
+
+ + + {formatDate(item.update_time)} + +
+ {/* + + + K + + + } + /> + } + style={{ backgroundColor: '#1677ff' }} + icon={} /> - - } - /> - */} + */} +
-
- + + ); };