mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: set the object-fit attribute of the chunk image to contain so that the image is not stretched and if the chunk number of the knowledge base is greater than 0, set the embedding model to disabled (#160)
* feat: if the chunk number of the knowledge base is greater than 0, set the embedding model to disabled * feat: set the object-fit attribute of the chunk image to contain so that the image is not stretched
This commit is contained in:
@ -3,7 +3,7 @@ import { Flex, Form, InputNumber, Slider } from 'antd';
|
|||||||
const MaxTokenNumber = () => {
|
const MaxTokenNumber = () => {
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Token number"
|
label="Chunk token number"
|
||||||
tooltip="It determine the token number of a chunk approximately."
|
tooltip="It determine the token number of a chunk approximately."
|
||||||
>
|
>
|
||||||
<Flex gap={20} align="center">
|
<Flex gap={20} align="center">
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
.image {
|
.image {
|
||||||
width: 100px !important;
|
width: 100px !important;
|
||||||
min-width: 100px;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imagePreview {
|
.imagePreview {
|
||||||
width: 600px;
|
max-width: 50vw;
|
||||||
|
max-height: 50vh;
|
||||||
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
|||||||
@ -55,7 +55,7 @@ const ChunkCard = ({
|
|||||||
<Checkbox onChange={handleCheck} checked={checked}></Checkbox>
|
<Checkbox onChange={handleCheck} checked={checked}></Checkbox>
|
||||||
{item.img_id && (
|
{item.img_id && (
|
||||||
<Popover
|
<Popover
|
||||||
placement="topRight"
|
placement="right"
|
||||||
content={
|
content={
|
||||||
<Image id={item.img_id} className={styles.imagePreview}></Image>
|
<Image id={item.img_id} className={styles.imagePreview}></Image>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const { Option } = Select;
|
|||||||
const ConfigurationForm = ({ form }: { form: FormInstance }) => {
|
const ConfigurationForm = ({ form }: { form: FormInstance }) => {
|
||||||
const { submitKnowledgeConfiguration, submitLoading } =
|
const { submitKnowledgeConfiguration, submitLoading } =
|
||||||
useSubmitKnowledgeConfiguration();
|
useSubmitKnowledgeConfiguration();
|
||||||
const { parserList, embeddingModelOptions } =
|
const { parserList, embeddingModelOptions, disabled } =
|
||||||
useFetchKnowledgeConfigurationOnMount(form);
|
useFetchKnowledgeConfigurationOnMount(form);
|
||||||
|
|
||||||
const onFinishFailed = (errorInfo: any) => {
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
@ -90,6 +90,7 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
|
|||||||
<Select
|
<Select
|
||||||
placeholder="Please select a embedding model"
|
placeholder="Please select a embedding model"
|
||||||
options={embeddingModelOptions}
|
options={embeddingModelOptions}
|
||||||
|
disabled={disabled}
|
||||||
></Select>
|
></Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@ -98,7 +99,7 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
|
|||||||
tooltip="The instruction is at right."
|
tooltip="The instruction is at right."
|
||||||
rules={[{ required: true }]}
|
rules={[{ required: true }]}
|
||||||
>
|
>
|
||||||
<Select placeholder="Please select a chunk method">
|
<Select placeholder="Please select a chunk method" disabled={disabled}>
|
||||||
{parserList.map((x) => (
|
{parserList.map((x) => (
|
||||||
<Option value={x.value} key={x.value}>
|
<Option value={x.value} key={x.value}>
|
||||||
{x.label}
|
{x.label}
|
||||||
|
|||||||
@ -41,8 +41,6 @@ export const useSubmitKnowledgeConfiguration = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useFetchKnowledgeConfigurationOnMount = (form: FormInstance) => {
|
export const useFetchKnowledgeConfigurationOnMount = (form: FormInstance) => {
|
||||||
// const [form] = Form.useForm();
|
|
||||||
|
|
||||||
const knowledgeDetails = useSelectKnowledgeDetails();
|
const knowledgeDetails = useSelectKnowledgeDetails();
|
||||||
const parserList = useSelectParserList();
|
const parserList = useSelectParserList();
|
||||||
const embeddingModelOptions = useSelectLlmOptions();
|
const embeddingModelOptions = useSelectLlmOptions();
|
||||||
@ -69,7 +67,11 @@ export const useFetchKnowledgeConfigurationOnMount = (form: FormInstance) => {
|
|||||||
});
|
});
|
||||||
}, [form, knowledgeDetails]);
|
}, [form, knowledgeDetails]);
|
||||||
|
|
||||||
return { parserList, embeddingModelOptions };
|
return {
|
||||||
|
parserList,
|
||||||
|
embeddingModelOptions,
|
||||||
|
disabled: knowledgeDetails.chunk_num > 0,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useSelectKnowledgeDetailsLoading = () =>
|
export const useSelectKnowledgeDetailsLoading = () =>
|
||||||
|
|||||||
@ -47,16 +47,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.referencePopoverWrapper {
|
.referencePopoverWrapper {
|
||||||
width: 50vw;
|
max-width: 50vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.referenceChunkImage {
|
.referenceChunkImage {
|
||||||
width: 10vw;
|
width: 10vw;
|
||||||
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.referenceImagePreview {
|
.referenceImagePreview {
|
||||||
width: 600px;
|
max-width: 45vw;
|
||||||
|
max-height: 45vh;
|
||||||
}
|
}
|
||||||
.chunkContentText {
|
.chunkContentText {
|
||||||
.chunkText;
|
.chunkText;
|
||||||
|
max-height: 45vh;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ const MessageItem = ({
|
|||||||
className={styles.referencePopoverWrapper}
|
className={styles.referencePopoverWrapper}
|
||||||
>
|
>
|
||||||
<Popover
|
<Popover
|
||||||
placement="topRight"
|
placement="left"
|
||||||
content={
|
content={
|
||||||
<Image
|
<Image
|
||||||
id={chunkItem?.img_id}
|
id={chunkItem?.img_id}
|
||||||
|
|||||||
Reference in New Issue
Block a user