balibabu
commited on
Commit
·
9aadaa2
1
Parent(s):
b7fdabe
feat: Use Badge.Ribbon to distinguish the teams to which the knowledge base belongs #2846 (#2891)
Browse files### 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):
web/src/components/api-service/chat-overview-modal/backend-service-api.tsx
CHANGED
|
@@ -22,10 +22,10 @@ const BackendServiceApi = ({ show }: { show(): void }) => {
|
|
| 22 |
<Flex gap={8} align="center">
|
| 23 |
<b>{t('backendServiceApi')}</b>
|
| 24 |
<Paragraph
|
| 25 |
-
copyable={{ text: `${location.origin}/v1
|
| 26 |
className={styles.apiLinkText}
|
| 27 |
>
|
| 28 |
-
{location.origin}/v1/
|
| 29 |
</Paragraph>
|
| 30 |
</Flex>
|
| 31 |
</Card>
|
|
|
|
| 22 |
<Flex gap={8} align="center">
|
| 23 |
<b>{t('backendServiceApi')}</b>
|
| 24 |
<Paragraph
|
| 25 |
+
copyable={{ text: `${location.origin}/api/v1/` }}
|
| 26 |
className={styles.apiLinkText}
|
| 27 |
>
|
| 28 |
+
{location.origin}/api/v1/
|
| 29 |
</Paragraph>
|
| 30 |
</Flex>
|
| 31 |
</Card>
|
web/src/interfaces/database/knowledge.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface IKnowledge {
|
|
| 22 |
update_time: number;
|
| 23 |
vector_similarity_weight: number;
|
| 24 |
embd_id: string;
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
export interface Parserconfig {
|
|
|
|
| 22 |
update_time: number;
|
| 23 |
vector_similarity_weight: number;
|
| 24 |
embd_id: string;
|
| 25 |
+
nickname?: string;
|
| 26 |
}
|
| 27 |
|
| 28 |
export interface Parserconfig {
|
web/src/pages/knowledge/knowledge-card/index.less
CHANGED
|
@@ -76,3 +76,11 @@
|
|
| 76 |
vertical-align: middle;
|
| 77 |
}
|
| 78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
vertical-align: middle;
|
| 77 |
}
|
| 78 |
}
|
| 79 |
+
|
| 80 |
+
.hideRibbon {
|
| 81 |
+
display: none !important;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
.ribbon {
|
| 85 |
+
top: 4px;
|
| 86 |
+
}
|
web/src/pages/knowledge/knowledge-card/index.tsx
CHANGED
|
@@ -6,12 +6,14 @@ import {
|
|
| 6 |
FileTextOutlined,
|
| 7 |
UserOutlined,
|
| 8 |
} from '@ant-design/icons';
|
| 9 |
-
import { Avatar, Card, Space } from 'antd';
|
|
|
|
| 10 |
import { useTranslation } from 'react-i18next';
|
| 11 |
import { useNavigate } from 'umi';
|
| 12 |
|
| 13 |
import OperateDropdown from '@/components/operate-dropdown';
|
| 14 |
import { useDeleteKnowledge } from '@/hooks/knowledge-hooks';
|
|
|
|
| 15 |
import styles from './index.less';
|
| 16 |
|
| 17 |
interface IProps {
|
|
@@ -21,6 +23,7 @@ interface IProps {
|
|
| 21 |
const KnowledgeCard = ({ item }: IProps) => {
|
| 22 |
const navigate = useNavigate();
|
| 23 |
const { t } = useTranslation();
|
|
|
|
| 24 |
|
| 25 |
const { deleteKnowledge } = useDeleteKnowledge();
|
| 26 |
|
|
@@ -35,55 +38,63 @@ const KnowledgeCard = ({ item }: IProps) => {
|
|
| 35 |
};
|
| 36 |
|
| 37 |
return (
|
| 38 |
-
<
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
<div className={styles.bottomLeft}>
|
| 51 |
-
<FileTextOutlined className={styles.leftIcon} />
|
| 52 |
-
<span className={styles.rightText}>
|
| 53 |
-
<Space>
|
| 54 |
-
{item.doc_num}
|
| 55 |
-
{t('knowledgeList.doc')}
|
| 56 |
-
</Space>
|
| 57 |
-
</span>
|
| 58 |
-
</div>
|
| 59 |
</div>
|
| 60 |
-
<div className={styles.
|
| 61 |
-
<
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
</div>
|
| 67 |
-
|
| 68 |
-
<
|
| 69 |
-
|
| 70 |
-
<
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
<Avatar
|
| 74 |
-
style={{ backgroundColor: '#
|
| 75 |
-
icon={<
|
| 76 |
/>
|
| 77 |
-
</
|
| 78 |
-
|
| 79 |
-
style={{ backgroundColor: '#1677ff' }}
|
| 80 |
-
icon={<AntDesignOutlined />}
|
| 81 |
-
/>
|
| 82 |
-
</Avatar.Group> */}
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
-
</
|
| 86 |
-
</
|
| 87 |
);
|
| 88 |
};
|
| 89 |
|
|
|
|
| 6 |
FileTextOutlined,
|
| 7 |
UserOutlined,
|
| 8 |
} from '@ant-design/icons';
|
| 9 |
+
import { Avatar, Badge, Card, Space } from 'antd';
|
| 10 |
+
import classNames from 'classnames';
|
| 11 |
import { useTranslation } from 'react-i18next';
|
| 12 |
import { useNavigate } from 'umi';
|
| 13 |
|
| 14 |
import OperateDropdown from '@/components/operate-dropdown';
|
| 15 |
import { useDeleteKnowledge } from '@/hooks/knowledge-hooks';
|
| 16 |
+
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
|
| 17 |
import styles from './index.less';
|
| 18 |
|
| 19 |
interface IProps {
|
|
|
|
| 23 |
const KnowledgeCard = ({ item }: IProps) => {
|
| 24 |
const navigate = useNavigate();
|
| 25 |
const { t } = useTranslation();
|
| 26 |
+
const { data: userInfo } = useFetchUserInfo();
|
| 27 |
|
| 28 |
const { deleteKnowledge } = useDeleteKnowledge();
|
| 29 |
|
|
|
|
| 38 |
};
|
| 39 |
|
| 40 |
return (
|
| 41 |
+
<Badge.Ribbon
|
| 42 |
+
text={item.nickname}
|
| 43 |
+
color={userInfo.nickname === item.nickname ? '#1677ff' : 'pink'}
|
| 44 |
+
className={classNames(styles.ribbon, {
|
| 45 |
+
[styles.hideRibbon]: item.permission !== 'team',
|
| 46 |
+
})}
|
| 47 |
+
>
|
| 48 |
+
<Card className={styles.card} onClick={handleCardClick}>
|
| 49 |
+
<div className={styles.container}>
|
| 50 |
+
<div className={styles.content}>
|
| 51 |
+
<Avatar size={34} icon={<UserOutlined />} src={item.avatar} />
|
| 52 |
+
<OperateDropdown deleteItem={removeKnowledge}></OperateDropdown>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
</div>
|
| 54 |
+
<div className={styles.titleWrapper}>
|
| 55 |
+
<span className={styles.title}>{item.name}</span>
|
| 56 |
+
<p>{item.description}</p>
|
| 57 |
+
</div>
|
| 58 |
+
<div className={styles.footer}>
|
| 59 |
+
<div className={styles.footerTop}>
|
| 60 |
+
<div className={styles.bottomLeft}>
|
| 61 |
+
<FileTextOutlined className={styles.leftIcon} />
|
| 62 |
+
<span className={styles.rightText}>
|
| 63 |
+
<Space>
|
| 64 |
+
{item.doc_num}
|
| 65 |
+
{t('knowledgeList.doc')}
|
| 66 |
+
</Space>
|
| 67 |
+
</span>
|
| 68 |
+
</div>
|
| 69 |
</div>
|
| 70 |
+
<div className={styles.bottom}>
|
| 71 |
+
<div className={styles.bottomLeft}>
|
| 72 |
+
<CalendarOutlined className={styles.leftIcon} />
|
| 73 |
+
<span className={styles.rightText}>
|
| 74 |
+
{formatDate(item.update_time)}
|
| 75 |
+
</span>
|
| 76 |
+
</div>
|
| 77 |
+
{/* <Avatar.Group size={25}>
|
| 78 |
+
<Avatar src="https://api.dicebear.com/7.x/miniavs/svg?seed=1" />
|
| 79 |
+
<a href="https://ant.design">
|
| 80 |
+
<Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar>
|
| 81 |
+
</a>
|
| 82 |
+
<Tooltip title="Ant User" placement="top">
|
| 83 |
+
<Avatar
|
| 84 |
+
style={{ backgroundColor: '#87d068' }}
|
| 85 |
+
icon={<UserOutlined />}
|
| 86 |
+
/>
|
| 87 |
+
</Tooltip>
|
| 88 |
<Avatar
|
| 89 |
+
style={{ backgroundColor: '#1677ff' }}
|
| 90 |
+
icon={<AntDesignOutlined />}
|
| 91 |
/>
|
| 92 |
+
</Avatar.Group> */}
|
| 93 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
</div>
|
| 95 |
</div>
|
| 96 |
+
</Card>
|
| 97 |
+
</Badge.Ribbon>
|
| 98 |
);
|
| 99 |
};
|
| 100 |
|