mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: add description text to operators and extract the useFetchModelId to logicHooks.ts and drag the operator to the canvas and initialize the form data #918 (#1379)
### What problem does this PR solve? feat: add description text to operators #918 feat: drag the operator to the canvas and initialize the form data #918 feat: extract the useFetchModelId to logicHooks.ts ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -22,8 +22,13 @@ import { useTranslation } from 'react-i18next';
|
||||
import { useDispatch } from 'umi';
|
||||
import { useSetModalState, useTranslate } from './commonHooks';
|
||||
import { useSetDocumentParser } from './documentHooks';
|
||||
import { useFetchLlmList } from './llmHooks';
|
||||
import { useOneNamespaceEffectsLoading } from './storeHooks';
|
||||
import { useSaveSetting } from './userSettingHook';
|
||||
import {
|
||||
useFetchTenantInfo,
|
||||
useSaveSetting,
|
||||
useSelectTenantInfo,
|
||||
} from './userSettingHook';
|
||||
|
||||
export const useChangeDocumentParser = (documentId: string) => {
|
||||
const setDocumentParser = useSetDocumentParser();
|
||||
@ -269,3 +274,26 @@ export const useSelectItem = (defaultId?: string) => {
|
||||
|
||||
return { selectedId, handleItemClick };
|
||||
};
|
||||
|
||||
export const useFetchModelId = (visible: boolean) => {
|
||||
const fetchTenantInfo = useFetchTenantInfo(false);
|
||||
const tenantInfo = useSelectTenantInfo();
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
fetchTenantInfo();
|
||||
}
|
||||
}, [visible, fetchTenantInfo]);
|
||||
|
||||
return tenantInfo?.llm_id ?? '';
|
||||
};
|
||||
|
||||
export const useFetchLlmModelOnVisible = (visible: boolean) => {
|
||||
const fetchLlmList = useFetchLlmList();
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
fetchLlmList();
|
||||
}
|
||||
}, [fetchLlmList, visible]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user