mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-20 21:06:54 +08:00
feat: fetch knowledge detail on KnowledgeUploadFile mount and add category column to chunk table and set initial value for the model field of chat setting (#104)
* feat: set initial value for the model field of chat setting * feat: add category column to chunk table * feat: fetch knowledge detail on KnowledgeUploadFile mount
This commit is contained in:
18
web/src/pages/chat/chat-configuration-modal/hooks.ts
Normal file
18
web/src/pages/chat/chat-configuration-modal/hooks.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import {
|
||||
useFetchTenantInfo,
|
||||
useSelectTenantInfo,
|
||||
} from '@/hooks/userSettingHook';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const useFetchModelId = (visible: boolean) => {
|
||||
const fetchTenantInfo = useFetchTenantInfo(false);
|
||||
const tenantInfo = useSelectTenantInfo();
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
fetchTenantInfo();
|
||||
}
|
||||
}, [visible, fetchTenantInfo]);
|
||||
|
||||
return tenantInfo?.llm_id ?? '';
|
||||
};
|
||||
@ -13,6 +13,7 @@ import { variableEnabledFieldMap } from '../constants';
|
||||
import { useFetchDialog, useResetCurrentDialog, useSetDialog } from '../hooks';
|
||||
import { IPromptConfigParameters } from '../interface';
|
||||
import { excludeUnEnabledVariables } from '../utils';
|
||||
import { useFetchModelId } from './hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
enum ConfigurationSegmented {
|
||||
@ -54,6 +55,7 @@ const ChatConfigurationModal = ({ visible, hideModal, id }: IProps) => {
|
||||
);
|
||||
const promptEngineRef = useRef<Array<IPromptConfigParameters>>([]);
|
||||
const loading = useOneNamespaceEffectsLoading('chatModel', ['setDialog']);
|
||||
const modelId = useFetchModelId(visible);
|
||||
|
||||
const setDialog = useSetDialog();
|
||||
const currentDialog = useFetchDialog(id, visible);
|
||||
@ -128,9 +130,13 @@ const ChatConfigurationModal = ({ visible, hideModal, id }: IProps) => {
|
||||
if (icon) {
|
||||
fileList = [{ uid: '1', name: 'file', thumbUrl: icon, status: 'done' }];
|
||||
}
|
||||
form.setFieldsValue({ ...currentDialog, icon: fileList });
|
||||
form.setFieldsValue({
|
||||
...currentDialog,
|
||||
icon: fileList,
|
||||
llm_id: currentDialog.llm_id ?? modelId,
|
||||
});
|
||||
}
|
||||
}, [currentDialog, form, visible]);
|
||||
}, [currentDialog, form, visible, modelId]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
Reference in New Issue
Block a user