mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-22 07:31:05 +08:00
### What problem does this PR solve? Fix: The agent form sheet will be obscured by the message log sheet. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import { INodeEvent } from '@/hooks/use-send-message';
|
|
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
|
import { IMessage } from '@/interfaces/database/chat';
|
|
import { HandleType, Position } from '@xyflow/react';
|
|
import { Dispatch, SetStateAction, createContext } from 'react';
|
|
import { useAddNode } from './hooks/use-add-node';
|
|
import { useCacheChatLog } from './hooks/use-cache-chat-log';
|
|
import { useShowFormDrawer, useShowLogSheet } from './hooks/use-show-drawer';
|
|
|
|
export const AgentFormContext = createContext<RAGFlowNodeType | undefined>(
|
|
undefined,
|
|
);
|
|
|
|
type AgentInstanceContextType = Pick<
|
|
ReturnType<typeof useAddNode>,
|
|
'addCanvasNode'
|
|
> &
|
|
Pick<ReturnType<typeof useShowFormDrawer>, 'showFormDrawer'> & {
|
|
lastNode?: INodeEvent | null;
|
|
currentSendLoading?: boolean;
|
|
startButNotFinishedNodeIds?: string[];
|
|
};
|
|
|
|
export const AgentInstanceContext = createContext<AgentInstanceContextType>(
|
|
{} as AgentInstanceContextType,
|
|
);
|
|
|
|
type AgentChatContextType = Pick<
|
|
ReturnType<typeof useShowLogSheet>,
|
|
'showLogSheet'
|
|
> & {
|
|
setLastSendLoadingFunc: (loading: boolean, messageId: string) => void;
|
|
setDerivedMessages: Dispatch<SetStateAction<IMessage[] | undefined>>;
|
|
};
|
|
|
|
export const AgentChatContext = createContext<AgentChatContextType>(
|
|
{} as AgentChatContextType,
|
|
);
|
|
|
|
type AgentChatLogContextType = Pick<
|
|
ReturnType<typeof useCacheChatLog>,
|
|
'addEventList' | 'setCurrentMessageId'
|
|
>;
|
|
|
|
export const AgentChatLogContext = createContext<AgentChatLogContextType>(
|
|
{} as AgentChatLogContextType,
|
|
);
|
|
|
|
export type HandleContextType = {
|
|
nodeId?: string;
|
|
id?: string;
|
|
type: HandleType;
|
|
position: Position;
|
|
isFromConnectionDrag: boolean;
|
|
};
|
|
|
|
export const HandleContext = createContext<HandleContextType>(
|
|
{} as HandleContextType,
|
|
);
|