import { BotClient, AgentPluginMap, Session, MCPConfig } from '@glodon-aiot/bot-client-sdk'; import { BotClientApi, ICommentParam, ISession, IChatMessage, IHistory, IKnowledge, ISessionPrompt, ISearchReference, IApplication } from '@glodon-aiot/apis'; import { Theme } from 'antd/es/config-provider/context'; import { CSSProperties } from 'react'; import { MarkdownProps } from '@glodon-aiot/react-components/dist/src/components/Markdown'; export type Env = 'dev' | 'test' | 'prod' | 'local'; export type AgentClientMode = 'float' | 'inlay'; export declare enum ApiUrl { dev = "https://aiot-dev.glodon.com/api/cvforcepd", test = "https://aiot-dev.glodon.com/api/cvforce", prod = "https://copilot.glodon.com/api/cvforce", local = "http://localhost:3000/api/cvforcepd" } export interface ReasoningContentConfig { /** 展开且最小化时的内容区高度 */ minHeight?: number | string; /** 展开且完整展示时的内容区上限,超出滚动 */ maxHeight?: number | string; /** * 默认展开时是否走最小化高度。 * true → 展开后使用 minHeight * false → 展开后使用 maxHeight(未配置则不限制) */ defaultMinimized?: boolean; } export interface AgentClientUITransform { greet?: boolean; sessionList?: boolean; sessionOpen?: boolean; fileUpload?: boolean; imageUpload?: boolean; connectNetwork?: boolean; userCopy?: boolean; userEdit?: boolean; userPrompt?: boolean; prompt?: boolean; relate?: boolean; again?: boolean; metadata?: boolean; reasoning?: boolean; reasoningExpand?: boolean; reasoningContent?: ReasoningContentConfig; reference?: { iconVisible?: boolean; referenceFirst?: boolean; isExpand?: boolean; }; searchReference?: { container?: HTMLElement; openTarget?: string; }; knowledges?: boolean; promptVariables?: boolean; } export interface MessageBoxFooterItem { componentName: 'AnswerAgain' | 'Copy' | 'Comments'; position: 'left' | 'right'; visible?: boolean; } export interface AgentFeaturesConfig { greeting?: boolean | { icon?: string; text?: string; questions?: boolean; layoutBreakpoints?: number[]; }; sessionList?: boolean; siderTitle?: boolean; metadata?: boolean; newSession?: boolean; fileUpload?: boolean; imageUpload?: boolean; userMessageBox?: { copy?: boolean; editAgain?: boolean; }; botMessageBox?: { referenceFirst?: boolean; reference?: { file?: boolean; itemExpanded?: boolean; }; relatedQuesions?: boolean; reasoning?: boolean; reasoningExpand?: boolean; reasoningContent?: ReasoningContentConfig; footer?: { items?: MessageBoxFooterItem[]; }; searchReference?: { container?: HTMLElement; openTarget?: string; onOpen?: (list: ISearchReference[], messageId?: string) => void; }; }; prompts?: boolean; connectNetwork?: boolean | { diabled?: boolean; visible?: boolean; default?: boolean; }; knowledges?: boolean | { diabled?: boolean; visible?: boolean; default?: IKnowledge[]; }; promptVariables?: boolean | { visible?: boolean; default?: ISessionPrompt[]; }; markdown?: Partial; } type CommentListener = (payload: { applicationId: string; sessionId: string; comment: ICommentParam; }) => void; type MessageListener = (payload: { applicationId: string; sessionId: string; message: IChatMessage; }) => void; type SessionLoadListener = (payload: { applicationId: string; sessionId: string; session: ISession | null; sessionInstance: Session | null; }) => void; type SessionUnloadListener = (payload: { applicationId: string; sessionId: string; session: ISession; }) => void; type HistoryLoadListener = (payload: { applicationId: string; sessionId: string; histories: IHistory[]; }) => void; type BeforeMessageSendListener = (payload: { applicationId: string; sessionId: string; message: Partial; }) => boolean | Promise | IChatMessage | Promise>; export interface AgentClientDefaultProps { env?: Env; apiUrl?: string; mode?: AgentClientMode; showHeader?: boolean; className?: string; triggerButton?: { style?: CSSProperties; visible?: boolean; }; open?: boolean; size?: { width?: number | string; height?: number | string; maxWidth?: number | string; maxHeight?: number | string; minWidth?: number | string; minHeight?: number | string; }; resizable?: boolean; theme?: Theme; logo?: string; icon?: string; greeting?: string; history?: boolean; service?: BotClientApi; popupContainer?: React.RefObject; token?: string; debug?: boolean; plugins?: AgentPluginMap; mcp?: MCPConfig; transform?: AgentClientUITransform; rId?: number; footer?: HTMLDivElement | string | boolean; header?: HTMLDivElement | string | boolean; sider?: boolean; defaultInput?: { text: string; }; depId?: number; onComment?: CommentListener; onMessage?: MessageListener; onSessionLoad?: SessionLoadListener; onSessionUnload?: SessionUnloadListener; onHistoryLoad?: HistoryLoadListener; beforeMessageSend?: BeforeMessageSendListener; bodyStyle?: CSSProperties; prompts?: boolean; features?: AgentFeaturesConfig; disabled?: boolean; toolbar?: { visible?: boolean; customItems?: { icon: string; name: string; position: 'left' | 'right'; visible?: boolean; }[]; }; stream?: boolean; agentClient?: BotClient; silencedSeconds?: number; } interface DataEventListeners { comment: CommentListener; message: MessageListener; sessionload: SessionLoadListener; sessionunload: SessionUnloadListener; historyload: HistoryLoadListener; beforemessagesend: BeforeMessageSendListener; } interface UIEventListeners { } export interface AgentClientUIConfig extends AgentClientDefaultProps { getContainer: () => HTMLElement; eventListeners?: Partial; defaultInput?: { text: string; }; bodyStyle?: CSSProperties; } export interface InitalData extends AgentClientUIConfig { token: string; sessionId?: string; apiUrl?: string; docViewerUrl?: string; plugins?: AgentPluginMap; mcp?: MCPConfig; env?: Env; debug?: boolean; errorHandlers?: { token?: (error: Error) => void; refreshToken?: () => Promise; }; bodyStyle?: CSSProperties; getSessionList?: any; createSession?: any; } export interface AgentClientProps extends AgentClientDefaultProps { service: BotClientApi; docViewerUrl: string; defaultInput?: { text: string; }; bodyStyle?: CSSProperties; apiUrl?: string; sessionId?: string; disabled?: boolean; application: IApplication; } export {};