mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: create a chat assistant and extract SimilaritySlider (#67)
* feat: extract SimilaritySlider * feat: create a chat assistant
This commit is contained in:
29
web/src/pages/chat/hooks.ts
Normal file
29
web/src/pages/chat/hooks.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { IDialog } from '@/interfaces/database/chat';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { useDispatch, useSelector } from 'umi';
|
||||
|
||||
export const useFetchDialogList = () => {
|
||||
const dispatch = useDispatch();
|
||||
const dialogList: IDialog[] = useSelector(
|
||||
(state: any) => state.chatModel.dialogList,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch({ type: 'chatModel/listDialog' });
|
||||
}, [dispatch]);
|
||||
|
||||
return dialogList;
|
||||
};
|
||||
|
||||
export const useSetDialog = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const setDialog = useCallback(
|
||||
(payload: IDialog) => {
|
||||
dispatch({ type: 'chatModel/setDialog', payload });
|
||||
},
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
return setDialog;
|
||||
};
|
||||
Reference in New Issue
Block a user