useXAgent
useXAgent
Used for model scheduling with Agent hooks.
Importimport{ useXAgent }from"@ant-design/x"; |
Sourcecomponents/use-x-agent |
Importimport{ useXAgent }from"@ant-design/x"; |
Sourcecomponents/use-x-agent |
Connect with the backend model to provide an abstract data flow.
type useXAgent<AgentMessage> = (config: XAgentConfigPreset | XAgentConfigCustom<AgentMessage>,) => [Agent];
Use preset protocol for request, protocol is not implemented yet.
Property | Description | Type | Default | Version |
---|---|---|---|---|
baseURL | Request for server address | string | - | |
key | Request key | string | - | |
model | Preset protocol model | string | - | |
dangerouslyApiKey | Enabling this option can be dangerous, exposing secret API credentials | string | - | - |
Custom request protocol.
Property | Description | Type | Default | Version |
---|---|---|---|---|
request | Config custom request, support streaming update | RequestFn |
interface RequestFnInfo<Message> extends Partial<XAgentConfigPreset>, AnyObject {messages?: Message[];}type RequestFn<Message> = (info: RequestFnInfo<Message>,callbacks: {onUpdate: (message: Message) => void;onSuccess: (message: Message) => void;onError: (error: Error) => void;},) => void;
Property | Description | Type | Version |
---|---|---|---|
request | Call the configured request of useXAgent | AgentRequestFn | |
isRequesting | Check if it is requesting | () => boolean |
interface AgentRequestFnInfo<Message> extends Partial<XAgentConfigPreset>, AnyObject {messages?: Message[];}type AgentRequestFn<AgentMessage> = (info: AgentRequestFnInfo<Message>,callbacks: {onUpdate: (message: AgentMessage) => void;onSuccess: (message: AgentMessage) => void;onError: (error: Error) => void;},) => void;
Status- |
Update Times0 |