mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-01 05:22:03 +08:00
### What problem does this PR solve? Feat: Add question parameter to edit chunk modal #3873 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
593ffc4067
commit
cfe23badb0
@ -325,6 +325,7 @@ When you want to search the given knowledge base at first place, set a higher pa
|
|||||||
ellipse: 'Ellipse',
|
ellipse: 'Ellipse',
|
||||||
graph: 'Knowledge graph',
|
graph: 'Knowledge graph',
|
||||||
mind: 'Mind map',
|
mind: 'Mind map',
|
||||||
|
question: 'Question',
|
||||||
},
|
},
|
||||||
chat: {
|
chat: {
|
||||||
newConversation: 'New conversation',
|
newConversation: 'New conversation',
|
||||||
|
@ -309,6 +309,7 @@ export default {
|
|||||||
ellipse: '省略',
|
ellipse: '省略',
|
||||||
graph: '知識圖譜',
|
graph: '知識圖譜',
|
||||||
mind: '心智圖',
|
mind: '心智圖',
|
||||||
|
question: '問題',
|
||||||
},
|
},
|
||||||
chat: {
|
chat: {
|
||||||
newConversation: '新會話',
|
newConversation: '新會話',
|
||||||
|
@ -326,6 +326,7 @@ export default {
|
|||||||
ellipse: '省略',
|
ellipse: '省略',
|
||||||
graph: '知识图谱',
|
graph: '知识图谱',
|
||||||
mind: '思维导图',
|
mind: '思维导图',
|
||||||
|
question: '问题',
|
||||||
},
|
},
|
||||||
chat: {
|
chat: {
|
||||||
newConversation: '新会话',
|
newConversation: '新会话',
|
||||||
|
@ -25,6 +25,7 @@ const ChunkCreatingModal: React.FC<IModalProps<any> & kFProps> = ({
|
|||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [checked, setChecked] = useState(false);
|
const [checked, setChecked] = useState(false);
|
||||||
const [keywords, setKeywords] = useState<string[]>([]);
|
const [keywords, setKeywords] = useState<string[]>([]);
|
||||||
|
const [question, setQuestion] = useState<string[]>([]);
|
||||||
const { removeChunk } = useDeleteChunkByIds();
|
const { removeChunk } = useDeleteChunkByIds();
|
||||||
const { data } = useFetchChunk(chunkId);
|
const { data } = useFetchChunk(chunkId);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -35,14 +36,17 @@ const ChunkCreatingModal: React.FC<IModalProps<any> & kFProps> = ({
|
|||||||
content_with_weight,
|
content_with_weight,
|
||||||
important_kwd = [],
|
important_kwd = [],
|
||||||
available_int,
|
available_int,
|
||||||
|
question_kwd = [],
|
||||||
} = data.data;
|
} = data.data;
|
||||||
form.setFieldsValue({ content: content_with_weight });
|
form.setFieldsValue({ content: content_with_weight });
|
||||||
setKeywords(important_kwd);
|
setKeywords(important_kwd);
|
||||||
|
setQuestion(question_kwd);
|
||||||
setChecked(available_int === 1);
|
setChecked(available_int === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chunkId) {
|
if (!chunkId) {
|
||||||
setKeywords([]);
|
setKeywords([]);
|
||||||
|
setQuestion([]);
|
||||||
form.setFieldsValue({ content: undefined });
|
form.setFieldsValue({ content: undefined });
|
||||||
}
|
}
|
||||||
}, [data, form, chunkId]);
|
}, [data, form, chunkId]);
|
||||||
@ -53,6 +57,7 @@ const ChunkCreatingModal: React.FC<IModalProps<any> & kFProps> = ({
|
|||||||
onOk?.({
|
onOk?.({
|
||||||
content: values.content,
|
content: values.content,
|
||||||
keywords, // keywords
|
keywords, // keywords
|
||||||
|
question_kwd: question,
|
||||||
available_int: checked ? 1 : 0, // available_int
|
available_int: checked ? 1 : 0, // available_int
|
||||||
});
|
});
|
||||||
} catch (errorInfo) {
|
} catch (errorInfo) {
|
||||||
@ -91,6 +96,10 @@ const ChunkCreatingModal: React.FC<IModalProps<any> & kFProps> = ({
|
|||||||
<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">
|
||||||
|
<p className="mb-2">{t('chunk.question')} *</p>
|
||||||
|
<EditTag tags={question} setTags={setQuestion} />
|
||||||
|
</section>
|
||||||
{chunkId && (
|
{chunkId && (
|
||||||
<section>
|
<section>
|
||||||
<Divider></Divider>
|
<Divider></Divider>
|
||||||
|
@ -99,10 +99,12 @@ export const useUpdateChunk = () => {
|
|||||||
content,
|
content,
|
||||||
keywords,
|
keywords,
|
||||||
available_int,
|
available_int,
|
||||||
|
question_kwd,
|
||||||
}: {
|
}: {
|
||||||
content: string;
|
content: string;
|
||||||
keywords: string;
|
keywords: string;
|
||||||
available_int: number;
|
available_int: number;
|
||||||
|
question_kwd: string;
|
||||||
}) => {
|
}) => {
|
||||||
const code = await createChunk({
|
const code = await createChunk({
|
||||||
content_with_weight: content,
|
content_with_weight: content,
|
||||||
@ -110,6 +112,7 @@ export const useUpdateChunk = () => {
|
|||||||
chunk_id: chunkId,
|
chunk_id: chunkId,
|
||||||
important_kwd: keywords, // keywords
|
important_kwd: keywords, // keywords
|
||||||
available_int,
|
available_int,
|
||||||
|
question_kwd,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user