mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 03:06:07 +08:00
### 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):
This commit is contained in:
parent
ceecac69e9
commit
8fdfa0f669
@ -22,10 +22,10 @@ const BackendServiceApi = ({ show }: { show(): void }) => {
|
|||||||
<Flex gap={8} align="center">
|
<Flex gap={8} align="center">
|
||||||
<b>{t('backendServiceApi')}</b>
|
<b>{t('backendServiceApi')}</b>
|
||||||
<Paragraph
|
<Paragraph
|
||||||
copyable={{ text: `${location.origin}/v1/api/` }}
|
copyable={{ text: `${location.origin}/api/v1/` }}
|
||||||
className={styles.apiLinkText}
|
className={styles.apiLinkText}
|
||||||
>
|
>
|
||||||
{location.origin}/v1/api/
|
{location.origin}/api/v1/
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -22,6 +22,7 @@ export interface IKnowledge {
|
|||||||
update_time: number;
|
update_time: number;
|
||||||
vector_similarity_weight: number;
|
vector_similarity_weight: number;
|
||||||
embd_id: string;
|
embd_id: string;
|
||||||
|
nickname?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Parserconfig {
|
export interface Parserconfig {
|
||||||
|
@ -76,3 +76,11 @@
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hideRibbon {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ribbon {
|
||||||
|
top: 4px;
|
||||||
|
}
|
||||||
|
@ -6,12 +6,14 @@ import {
|
|||||||
FileTextOutlined,
|
FileTextOutlined,
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
} from '@ant-design/icons';
|
} 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 { useTranslation } from 'react-i18next';
|
||||||
import { useNavigate } from 'umi';
|
import { useNavigate } from 'umi';
|
||||||
|
|
||||||
import OperateDropdown from '@/components/operate-dropdown';
|
import OperateDropdown from '@/components/operate-dropdown';
|
||||||
import { useDeleteKnowledge } from '@/hooks/knowledge-hooks';
|
import { useDeleteKnowledge } from '@/hooks/knowledge-hooks';
|
||||||
|
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
@ -21,6 +23,7 @@ interface IProps {
|
|||||||
const KnowledgeCard = ({ item }: IProps) => {
|
const KnowledgeCard = ({ item }: IProps) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const { data: userInfo } = useFetchUserInfo();
|
||||||
|
|
||||||
const { deleteKnowledge } = useDeleteKnowledge();
|
const { deleteKnowledge } = useDeleteKnowledge();
|
||||||
|
|
||||||
@ -35,55 +38,63 @@ const KnowledgeCard = ({ item }: IProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className={styles.card} onClick={handleCardClick}>
|
<Badge.Ribbon
|
||||||
<div className={styles.container}>
|
text={item.nickname}
|
||||||
<div className={styles.content}>
|
color={userInfo.nickname === item.nickname ? '#1677ff' : 'pink'}
|
||||||
<Avatar size={34} icon={<UserOutlined />} src={item.avatar} />
|
className={classNames(styles.ribbon, {
|
||||||
<OperateDropdown deleteItem={removeKnowledge}></OperateDropdown>
|
[styles.hideRibbon]: item.permission !== 'team',
|
||||||
</div>
|
})}
|
||||||
<div className={styles.titleWrapper}>
|
>
|
||||||
<span className={styles.title}>{item.name}</span>
|
<Card className={styles.card} onClick={handleCardClick}>
|
||||||
<p>{item.description}</p>
|
<div className={styles.container}>
|
||||||
</div>
|
<div className={styles.content}>
|
||||||
<div className={styles.footer}>
|
<Avatar size={34} icon={<UserOutlined />} src={item.avatar} />
|
||||||
<div className={styles.footerTop}>
|
<OperateDropdown deleteItem={removeKnowledge}></OperateDropdown>
|
||||||
<div className={styles.bottomLeft}>
|
|
||||||
<FileTextOutlined className={styles.leftIcon} />
|
|
||||||
<span className={styles.rightText}>
|
|
||||||
<Space>
|
|
||||||
{item.doc_num}
|
|
||||||
{t('knowledgeList.doc')}
|
|
||||||
</Space>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.bottom}>
|
<div className={styles.titleWrapper}>
|
||||||
<div className={styles.bottomLeft}>
|
<span className={styles.title}>{item.name}</span>
|
||||||
<CalendarOutlined className={styles.leftIcon} />
|
<p>{item.description}</p>
|
||||||
<span className={styles.rightText}>
|
</div>
|
||||||
{formatDate(item.update_time)}
|
<div className={styles.footer}>
|
||||||
</span>
|
<div className={styles.footerTop}>
|
||||||
|
<div className={styles.bottomLeft}>
|
||||||
|
<FileTextOutlined className={styles.leftIcon} />
|
||||||
|
<span className={styles.rightText}>
|
||||||
|
<Space>
|
||||||
|
{item.doc_num}
|
||||||
|
{t('knowledgeList.doc')}
|
||||||
|
</Space>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* <Avatar.Group size={25}>
|
<div className={styles.bottom}>
|
||||||
<Avatar src="https://api.dicebear.com/7.x/miniavs/svg?seed=1" />
|
<div className={styles.bottomLeft}>
|
||||||
<a href="https://ant.design">
|
<CalendarOutlined className={styles.leftIcon} />
|
||||||
<Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar>
|
<span className={styles.rightText}>
|
||||||
</a>
|
{formatDate(item.update_time)}
|
||||||
<Tooltip title="Ant User" placement="top">
|
</span>
|
||||||
|
</div>
|
||||||
|
{/* <Avatar.Group size={25}>
|
||||||
|
<Avatar src="https://api.dicebear.com/7.x/miniavs/svg?seed=1" />
|
||||||
|
<a href="https://ant.design">
|
||||||
|
<Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar>
|
||||||
|
</a>
|
||||||
|
<Tooltip title="Ant User" placement="top">
|
||||||
|
<Avatar
|
||||||
|
style={{ backgroundColor: '#87d068' }}
|
||||||
|
icon={<UserOutlined />}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
<Avatar
|
<Avatar
|
||||||
style={{ backgroundColor: '#87d068' }}
|
style={{ backgroundColor: '#1677ff' }}
|
||||||
icon={<UserOutlined />}
|
icon={<AntDesignOutlined />}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Avatar.Group> */}
|
||||||
<Avatar
|
</div>
|
||||||
style={{ backgroundColor: '#1677ff' }}
|
|
||||||
icon={<AntDesignOutlined />}
|
|
||||||
/>
|
|
||||||
</Avatar.Group> */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Card>
|
||||||
</Card>
|
</Badge.Ribbon>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user