mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 01:28:59 +08:00
### What problem does this PR solve? Feat: Add tooltip to question item of ChunkCreatingModal #3873 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
1f0a153d0e
commit
3a0e9f9263
@ -1,8 +1,21 @@
|
|||||||
.tweenGroup {
|
.tweenGroup {
|
||||||
display: inline-block;
|
display: flex;
|
||||||
:global(.ant-tag) {
|
gap: 8px;
|
||||||
margin-bottom: 8px;
|
flex-wrap: wrap;
|
||||||
font-size: 14px;
|
width: 100%;
|
||||||
padding: 2px 8px;
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 2px 20px 2px 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
.textEllipsis();
|
||||||
|
position: relative;
|
||||||
|
:global(.ant-tag-close-icon) {
|
||||||
|
position: absolute;
|
||||||
|
top: 7px;
|
||||||
|
right: 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,10 @@ const EditTag = ({ tags, setTags }: EditTagsProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const forMap = (tag: string) => {
|
const forMap = (tag: string) => {
|
||||||
const tagElem = (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
|
key={tag}
|
||||||
|
className={styles.tag}
|
||||||
closable
|
closable
|
||||||
onClose={(e) => {
|
onClose={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -56,11 +58,6 @@ const EditTag = ({ tags, setTags }: EditTagsProps) => {
|
|||||||
{tag}
|
{tag}
|
||||||
</Tag>
|
</Tag>
|
||||||
);
|
);
|
||||||
return (
|
|
||||||
<span key={tag} style={{ display: 'inline-block' }}>
|
|
||||||
{tagElem}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const tagChild = tags?.map(forMap);
|
const tagChild = tags?.map(forMap);
|
||||||
@ -71,8 +68,8 @@ const EditTag = ({ tags, setTags }: EditTagsProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div>
|
||||||
<span>
|
{Array.isArray(tagChild) && tagChild.length > 0 && (
|
||||||
<TweenOneGroup
|
<TweenOneGroup
|
||||||
className={styles.tweenGroup}
|
className={styles.tweenGroup}
|
||||||
enter={{
|
enter={{
|
||||||
@ -91,7 +88,7 @@ const EditTag = ({ tags, setTags }: EditTagsProps) => {
|
|||||||
>
|
>
|
||||||
{tagChild}
|
{tagChild}
|
||||||
</TweenOneGroup>
|
</TweenOneGroup>
|
||||||
</span>
|
)}
|
||||||
{inputVisible ? (
|
{inputVisible ? (
|
||||||
<Input
|
<Input
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
@ -107,7 +104,7 @@ const EditTag = ({ tags, setTags }: EditTagsProps) => {
|
|||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
</Tag>
|
</Tag>
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ When you want to search the given knowledge base at first place, set a higher pa
|
|||||||
graph: 'Knowledge graph',
|
graph: 'Knowledge graph',
|
||||||
mind: 'Mind map',
|
mind: 'Mind map',
|
||||||
question: 'Question',
|
question: 'Question',
|
||||||
|
questionTip: `If there're given questions, the embedding of the chunk will be based on them.`,
|
||||||
},
|
},
|
||||||
chat: {
|
chat: {
|
||||||
newConversation: 'New conversation',
|
newConversation: 'New conversation',
|
||||||
|
@ -310,6 +310,7 @@ export default {
|
|||||||
graph: '知識圖譜',
|
graph: '知識圖譜',
|
||||||
mind: '心智圖',
|
mind: '心智圖',
|
||||||
question: '問題',
|
question: '問題',
|
||||||
|
questionTip: `如果存在給定的問題,則區塊的嵌入將基於它們。`,
|
||||||
},
|
},
|
||||||
chat: {
|
chat: {
|
||||||
newConversation: '新會話',
|
newConversation: '新會話',
|
||||||
|
@ -327,6 +327,7 @@ export default {
|
|||||||
graph: '知识图谱',
|
graph: '知识图谱',
|
||||||
mind: '思维导图',
|
mind: '思维导图',
|
||||||
question: '问题',
|
question: '问题',
|
||||||
|
questionTip: `如果有给定的问题,则块的嵌入将基于它们。`,
|
||||||
},
|
},
|
||||||
chat: {
|
chat: {
|
||||||
newConversation: '新会话',
|
newConversation: '新会话',
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import EditTag from '@/components/edit-tag';
|
import EditTag from '@/components/edit-tag';
|
||||||
import { useFetchChunk } from '@/hooks/chunk-hooks';
|
import { useFetchChunk } from '@/hooks/chunk-hooks';
|
||||||
import { IModalProps } from '@/interfaces/common';
|
import { IModalProps } from '@/interfaces/common';
|
||||||
import { DeleteOutlined } from '@ant-design/icons';
|
import { DeleteOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
||||||
import { Divider, Form, Input, Modal, Space, Switch } from 'antd';
|
import { Divider, Form, Input, Modal, Space, Switch, Tooltip } from 'antd';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useDeleteChunkByIds } from '../../hooks';
|
import { useDeleteChunkByIds } from '../../hooks';
|
||||||
@ -41,7 +41,7 @@ const ChunkCreatingModal: React.FC<IModalProps<any> & kFProps> = ({
|
|||||||
form.setFieldsValue({ content: content_with_weight });
|
form.setFieldsValue({ content: content_with_weight });
|
||||||
setKeywords(important_kwd);
|
setKeywords(important_kwd);
|
||||||
setQuestion(question_kwd);
|
setQuestion(question_kwd);
|
||||||
setChecked(available_int === 1);
|
setChecked(available_int !== 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chunkId) {
|
if (!chunkId) {
|
||||||
@ -93,11 +93,16 @@ const ChunkCreatingModal: React.FC<IModalProps<any> & kFProps> = ({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
<section>
|
<section>
|
||||||
<p className="mb-2">{t('chunk.keyword')} *</p>
|
<p className="mb-2">{t('chunk.keyword')} </p>
|
||||||
<EditTag tags={keywords} setTags={setKeywords} />
|
<EditTag tags={keywords} setTags={setKeywords} />
|
||||||
</section>
|
</section>
|
||||||
<section className="pt-2">
|
<section className="mt-4">
|
||||||
<p className="mb-2">{t('chunk.question')} *</p>
|
<div className="flex items-center gap-2 mb-2">
|
||||||
|
<span>{t('chunk.question')}</span>
|
||||||
|
<Tooltip title={t('chunk.questionTip')}>
|
||||||
|
<QuestionCircleOutlined className="text-xs" />
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
<EditTag tags={question} setTags={setQuestion} />
|
<EditTag tags={question} setTags={setQuestion} />
|
||||||
</section>
|
</section>
|
||||||
{chunkId && (
|
{chunkId && (
|
||||||
|
@ -112,20 +112,6 @@ export const downloadFileFromBlob = (blob: Blob, name?: string) => {
|
|||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const downloadFile = async ({
|
|
||||||
id,
|
|
||||||
filename,
|
|
||||||
target,
|
|
||||||
}: {
|
|
||||||
id: string;
|
|
||||||
filename?: string;
|
|
||||||
target?: string;
|
|
||||||
}) => {
|
|
||||||
const response = await fileManagerService.getFile({}, id);
|
|
||||||
const blob = new Blob([response.data], { type: response.data.type });
|
|
||||||
downloadFileFromBlob(blob, filename);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const downloadDocument = async ({
|
export const downloadDocument = async ({
|
||||||
id,
|
id,
|
||||||
filename,
|
filename,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user