Documentation
¶
Index ¶
- Constants
- func ParseAPIError(statusCode int, body []byte) error
- type APIError
- type AnnotationConfig
- type AppMetaResponse
- type AppParametersResponse
- type AudioToTextResponse
- type ChatClient
- func (c *ChatClient) DeleteConversation(ctx context.Context, conversationID string, user string) error
- func (c *ChatClient) GetConversations(ctx context.Context, user string, lastID string, limit int, pinned *bool) (*ConversationListResponse, error)
- func (c *ChatClient) GetMessages(ctx context.Context, conversationID string, user string, firstID string, ...) (*MessageListResponse, error)
- func (c *ChatClient) GetMeta(ctx context.Context, user string) (*AppMetaResponse, error)
- func (c *ChatClient) GetParameters(ctx context.Context, user string) (*AppParametersResponse, error)
- func (c *ChatClient) GetSuggestedQuestions(ctx context.Context, messageID string, user string) (*SuggestedResponse, error)
- func (c *ChatClient) MessageFeedback(ctx context.Context, messageID string, req *FeedbackRequest) (*FeedbackResponse, error)
- func (c *ChatClient) RenameConversation(ctx context.Context, conversationID string, req *RenameRequest) (*RenameResponse, error)
- func (c *ChatClient) SendMessage(ctx context.Context, req *ChatRequest) (*ChatResponse, error)
- func (c *ChatClient) SendMessageStream(ctx context.Context, req *ChatRequest) (*StreamReader, error)
- func (c *ChatClient) StopMessage(ctx context.Context, taskID string, user string) (*StopResponse, error)
- type ChatRequest
- type ChatResponse
- type Client
- func (c *Client) AudioToText(ctx context.Context, audioFilePath string, user string) (*AudioToTextResponse, error)
- func (c *Client) TextToAudio(ctx context.Context, text string, user string, streaming bool) (io.ReadCloser, error)
- func (c *Client) UploadFile(ctx context.Context, filePath string, user string) (*FileUploadResponse, error)
- func (c *Client) UploadFileFromReader(ctx context.Context, reader io.Reader, filename string, user string) (*FileUploadResponse, error)
- type ClientConfig
- type CompletionClient
- func (c *CompletionClient) GetMeta(ctx context.Context, user string) (*AppMetaResponse, error)
- func (c *CompletionClient) GetParameters(ctx context.Context, user string) (*AppParametersResponse, error)
- func (c *CompletionClient) MessageFeedback(ctx context.Context, messageID string, req *FeedbackRequest) (*FeedbackResponse, error)
- func (c *CompletionClient) SendMessage(ctx context.Context, req *CompletionRequest) (*CompletionResponse, error)
- func (c *CompletionClient) SendMessageStream(ctx context.Context, req *CompletionRequest) (*StreamReader, error)
- func (c *CompletionClient) StopMessage(ctx context.Context, taskID string, user string) (*StopResponse, error)
- type CompletionRequest
- type CompletionResponse
- type Conversation
- type ConversationListResponse
- type ErrorStreamEvent
- type Feedback
- type FeedbackRequest
- type FeedbackResponse
- type FileInput
- type FileUploadConfig
- type FileUploadResponse
- type FormItemConfig
- type ImageUploadConfig
- type Message
- type MessageEndStreamEvent
- type MessageFile
- type MessageListResponse
- type MessageStreamEvent
- type Metadata
- type NodeFinishedData
- type NodeFinishedEvent
- type NodeStartedData
- type NodeStartedEvent
- type RenameRequest
- type RenameResponse
- type RetrieverConfig
- type RetrieverResource
- type SSEMessage
- type SSEReader
- type SpeechToTextConfig
- type StopRequest
- type StopResponse
- type StreamEvent
- type StreamReader
- type SuggestedQAConfig
- type SuggestedResponse
- type SystemParamsConfig
- type TextToSpeechConfig
- type Usage
- type UserInputFormItem
- type WorkflowClient
- func (c *WorkflowClient) GetMeta(ctx context.Context, user string) (*AppMetaResponse, error)
- func (c *WorkflowClient) GetParameters(ctx context.Context, user string) (*AppParametersResponse, error)
- func (c *WorkflowClient) GetRunStatus(ctx context.Context, workflowRunID string) (*WorkflowRunResponse, error)
- func (c *WorkflowClient) Run(ctx context.Context, req *WorkflowRequest) (*WorkflowResponse, error)
- func (c *WorkflowClient) RunStream(ctx context.Context, req *WorkflowRequest) (*StreamReader, error)
- func (c *WorkflowClient) Stop(ctx context.Context, taskID string, user string) (*StopResponse, error)
- type WorkflowData
- type WorkflowFinishedEvent
- type WorkflowRequest
- type WorkflowResponse
- type WorkflowRunResponse
- type WorkflowStartedData
- type WorkflowStartedEvent
Constants ¶
const ( DefaultTimeout = 120 * time.Second DefaultUser = "dify-go-sdk" )
const ( ErrCodeNoAPIKey = "no_api_key" ErrCodeInvalidAPIKey = "invalid_api_key" ErrCodeProviderNotInitialize = "provider_not_initialize" ErrCodeProviderQuotaExceeded = "provider_quota_exceeded" ErrCodeModelCurrentlyNotSupport = "model_currently_not_support" ErrCodeCompletionRequestError = "completion_request_error" ErrCodeNotFound = "not_found" ErrCodeNotChatApp = "not_chat_app" ErrCodeNotCompletionApp = "not_completion_app" ErrCodeConversationCompleted = "conversation_completed" ErrCodeFileNotFound = "file_not_found" ErrCodeFileTooLarge = "file_too_large" ErrCodeUnsupportedFileType = "unsupported_file_type" ErrCodeS3ConnectionFailed = "s3_connection_failed" ErrCodeS3PermissionDenied = "s3_permission_denied" ErrCodeS3FileTooLarge = "s3_file_too_large" )
常见错误码
Variables ¶
This section is empty.
Functions ¶
func ParseAPIError ¶
ParseAPIError 解析 API 错误响应
Types ¶
type APIError ¶
type APIError struct {
StatusCode int `json:"-"`
Code string `json:"code"`
Message string `json:"message"`
Status int `json:"status"`
}
APIError Dify API 错误
type AnnotationConfig ¶
type AnnotationConfig struct {
Enabled bool `json:"enabled"`
}
AnnotationConfig 标注回复配置
type AppMetaResponse ¶
type AppMetaResponse struct {
ToolIcons map[string]interface{} `json:"tool_icons"`
}
AppMetaResponse 应用元信息响应
type AppParametersResponse ¶
type AppParametersResponse struct {
OpeningStatement string `json:"opening_statement"`
SuggestedQuestions []string `json:"suggested_questions"`
SuggestedQuestionsAfterAnswer SuggestedQAConfig `json:"suggested_questions_after_answer"`
SpeechToText SpeechToTextConfig `json:"speech_to_text"`
TextToSpeech TextToSpeechConfig `json:"text_to_speech"`
RetrieverResource RetrieverConfig `json:"retriever_resource"`
AnnotationReply AnnotationConfig `json:"annotation_reply"`
UserInputForm []UserInputFormItem `json:"user_input_form"`
FileUpload FileUploadConfig `json:"file_upload"`
SystemParameters SystemParamsConfig `json:"system_parameters"`
}
AppParametersResponse 应用参数响应
type AudioToTextResponse ¶
type AudioToTextResponse struct {
Text string `json:"text"`
}
AudioToTextResponse 语音转文字响应
type ChatClient ¶
type ChatClient struct {
*Client
}
ChatClient 对话型应用客户端
func NewChatClient ¶
func NewChatClient(config ClientConfig) (*ChatClient, error)
NewChatClient 创建对话型应用客户端
func (*ChatClient) DeleteConversation ¶
func (c *ChatClient) DeleteConversation(ctx context.Context, conversationID string, user string) error
DeleteConversation 删除会话
func (*ChatClient) GetConversations ¶
func (c *ChatClient) GetConversations(ctx context.Context, user string, lastID string, limit int, pinned *bool) (*ConversationListResponse, error)
GetConversations 获取会话列表
func (*ChatClient) GetMessages ¶
func (c *ChatClient) GetMessages(ctx context.Context, conversationID string, user string, firstID string, limit int) (*MessageListResponse, error)
GetMessages 获取会话历史消息
func (*ChatClient) GetMeta ¶
func (c *ChatClient) GetMeta(ctx context.Context, user string) (*AppMetaResponse, error)
GetMeta 获取应用元信息
func (*ChatClient) GetParameters ¶
func (c *ChatClient) GetParameters(ctx context.Context, user string) (*AppParametersResponse, error)
GetParameters 获取应用参数
func (*ChatClient) GetSuggestedQuestions ¶
func (c *ChatClient) GetSuggestedQuestions(ctx context.Context, messageID string, user string) (*SuggestedResponse, error)
GetSuggestedQuestions 获取下一轮建议问题
func (*ChatClient) MessageFeedback ¶
func (c *ChatClient) MessageFeedback(ctx context.Context, messageID string, req *FeedbackRequest) (*FeedbackResponse, error)
MessageFeedback 消息反馈
func (*ChatClient) RenameConversation ¶
func (c *ChatClient) RenameConversation(ctx context.Context, conversationID string, req *RenameRequest) (*RenameResponse, error)
RenameConversation 重命名会话
func (*ChatClient) SendMessage ¶
func (c *ChatClient) SendMessage(ctx context.Context, req *ChatRequest) (*ChatResponse, error)
SendMessage 发送对话消息 (阻塞模式)
func (*ChatClient) SendMessageStream ¶
func (c *ChatClient) SendMessageStream(ctx context.Context, req *ChatRequest) (*StreamReader, error)
SendMessageStream 发送对话消息 (流式模式)
func (*ChatClient) StopMessage ¶
func (c *ChatClient) StopMessage(ctx context.Context, taskID string, user string) (*StopResponse, error)
StopMessage 停止响应
type ChatRequest ¶
type ChatRequest struct {
Query string `json:"query"`
Inputs map[string]interface{} `json:"inputs,omitempty"`
ResponseMode string `json:"response_mode"`
User string `json:"user"`
ConversationID string `json:"conversation_id,omitempty"`
Files []FileInput `json:"files,omitempty"`
AutoGenerateName bool `json:"auto_generate_name,omitempty"`
}
ChatRequest 对话消息请求
type ChatResponse ¶
type ChatResponse struct {
MessageID string `json:"message_id"`
ConversationID string `json:"conversation_id"`
Mode string `json:"mode"`
Answer string `json:"answer"`
Metadata Metadata `json:"metadata"`
CreatedAt int64 `json:"created_at"`
}
ChatResponse 对话消息响应 (blocking 模式)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client Dify API 客户端
func (*Client) AudioToText ¶
func (c *Client) AudioToText(ctx context.Context, audioFilePath string, user string) (*AudioToTextResponse, error)
AudioToText 语音转文字
func (*Client) TextToAudio ¶
func (c *Client) TextToAudio(ctx context.Context, text string, user string, streaming bool) (io.ReadCloser, error)
TextToAudio 文字转语音
func (*Client) UploadFile ¶
func (c *Client) UploadFile(ctx context.Context, filePath string, user string) (*FileUploadResponse, error)
UploadFile 上传文件
type ClientConfig ¶
ClientConfig 客户端配置
type CompletionClient ¶
type CompletionClient struct {
*Client
}
CompletionClient 文本生成型应用客户端
func NewCompletionClient ¶
func NewCompletionClient(config ClientConfig) (*CompletionClient, error)
NewCompletionClient 创建文本生成型应用客户端
func (*CompletionClient) GetMeta ¶
func (c *CompletionClient) GetMeta(ctx context.Context, user string) (*AppMetaResponse, error)
GetMeta 获取应用元信息
func (*CompletionClient) GetParameters ¶
func (c *CompletionClient) GetParameters(ctx context.Context, user string) (*AppParametersResponse, error)
GetParameters 获取应用参数
func (*CompletionClient) MessageFeedback ¶
func (c *CompletionClient) MessageFeedback(ctx context.Context, messageID string, req *FeedbackRequest) (*FeedbackResponse, error)
MessageFeedback 消息反馈
func (*CompletionClient) SendMessage ¶
func (c *CompletionClient) SendMessage(ctx context.Context, req *CompletionRequest) (*CompletionResponse, error)
SendMessage 发送文本生成请求 (阻塞模式)
func (*CompletionClient) SendMessageStream ¶
func (c *CompletionClient) SendMessageStream(ctx context.Context, req *CompletionRequest) (*StreamReader, error)
SendMessageStream 发送文本生成请求 (流式模式)
func (*CompletionClient) StopMessage ¶
func (c *CompletionClient) StopMessage(ctx context.Context, taskID string, user string) (*StopResponse, error)
StopMessage 停止响应
type CompletionRequest ¶
type CompletionRequest struct {
Inputs map[string]interface{} `json:"inputs"`
ResponseMode string `json:"response_mode"`
User string `json:"user"`
Files []FileInput `json:"files,omitempty"`
}
CompletionRequest 文本生成请求
type CompletionResponse ¶
type CompletionResponse struct {
MessageID string `json:"message_id"`
Mode string `json:"mode"`
Answer string `json:"answer"`
Metadata Metadata `json:"metadata"`
CreatedAt int64 `json:"created_at"`
}
CompletionResponse 文本生成响应 (blocking 模式)
type Conversation ¶
type Conversation struct {
ID string `json:"id"`
Name string `json:"name"`
Inputs map[string]interface{} `json:"inputs"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Conversation 会话信息
type ConversationListResponse ¶
type ConversationListResponse struct {
Data []Conversation `json:"data"`
HasMore bool `json:"has_more"`
Limit int `json:"limit"`
}
ConversationListResponse 会话列表响应
type ErrorStreamEvent ¶
type ErrorStreamEvent struct {
Event string `json:"event"`
TaskID string `json:"task_id"`
MessageID string `json:"message_id,omitempty"`
Status int `json:"status"`
Code string `json:"code"`
Message string `json:"message"`
}
ErrorStreamEvent 错误流事件
type FeedbackRequest ¶
FeedbackRequest 反馈请求
type FeedbackResponse ¶
type FeedbackResponse struct {
Result string `json:"result"`
}
FeedbackResponse 反馈响应
type FileInput ¶
type FileInput struct {
Type string `json:"type"`
TransferMethod string `json:"transfer_method"`
URL string `json:"url,omitempty"`
UploadFileID string `json:"upload_file_id,omitempty"`
}
FileInput 文件输入
type FileUploadConfig ¶
type FileUploadConfig struct {
Image ImageUploadConfig `json:"image"`
}
FileUploadConfig 文件上传配置
type FileUploadResponse ¶
type FileUploadResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
Extension string `json:"extension"`
MimeType string `json:"mime_type"`
CreatedBy string `json:"created_by"`
CreatedAt int64 `json:"created_at"`
}
FileUploadResponse 文件上传响应
type FormItemConfig ¶
type FormItemConfig struct {
Label string `json:"label"`
Variable string `json:"variable"`
Required bool `json:"required"`
Default string `json:"default"`
MaxLength int `json:"max_length,omitempty"`
Options []string `json:"options,omitempty"`
}
FormItemConfig 表单项配置
type ImageUploadConfig ¶
type ImageUploadConfig struct {
Enabled bool `json:"enabled"`
NumberLimits int `json:"number_limits"`
TransferMethods []string `json:"transfer_methods"`
}
ImageUploadConfig 图片上传配置
type Message ¶
type Message struct {
ID string `json:"id"`
ConversationID string `json:"conversation_id"`
Inputs map[string]interface{} `json:"inputs"`
Query string `json:"query"`
Answer string `json:"answer"`
MessageFiles []MessageFile `json:"message_files"`
Feedback *Feedback `json:"feedback"`
RetrieverResources []RetrieverResource `json:"retriever_resources"`
CreatedAt int64 `json:"created_at"`
}
Message 消息信息
type MessageEndStreamEvent ¶
type MessageEndStreamEvent struct {
Event string `json:"event"`
TaskID string `json:"task_id"`
MessageID string `json:"message_id"`
ConversationID string `json:"conversation_id,omitempty"`
Metadata Metadata `json:"metadata"`
}
MessageEndStreamEvent 消息结束流事件
type MessageFile ¶
type MessageFile struct {
ID string `json:"id"`
Type string `json:"type"`
URL string `json:"url"`
BelongsTo string `json:"belongs_to"`
}
MessageFile 消息文件
type MessageListResponse ¶
type MessageListResponse struct {
Data []Message `json:"data"`
HasMore bool `json:"has_more"`
Limit int `json:"limit"`
}
MessageListResponse 消息列表响应
type MessageStreamEvent ¶
type MessageStreamEvent struct {
Event string `json:"event"`
TaskID string `json:"task_id"`
MessageID string `json:"message_id"`
ConversationID string `json:"conversation_id,omitempty"`
Answer string `json:"answer"`
CreatedAt int64 `json:"created_at"`
}
MessageStreamEvent 消息流事件
type Metadata ¶
type Metadata struct {
Usage Usage `json:"usage"`
RetrieverResources []RetrieverResource `json:"retriever_resources,omitempty"`
}
Metadata 响应元数据
type NodeFinishedData ¶
type NodeFinishedData struct {
ID string `json:"id"`
NodeID string `json:"node_id"`
NodeType string `json:"node_type"`
Title string `json:"title"`
Index int `json:"index"`
PredecessorNodeID string `json:"predecessor_node_id"`
Inputs map[string]interface{} `json:"inputs"`
ProcessData map[string]interface{} `json:"process_data"`
Outputs map[string]interface{} `json:"outputs"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
ElapsedTime float64 `json:"elapsed_time"`
ExecutionMetadata map[string]interface{} `json:"execution_metadata"`
CreatedAt int64 `json:"created_at"`
}
NodeFinishedData 节点完成数据
type NodeFinishedEvent ¶
type NodeFinishedEvent struct {
Event string `json:"event"`
TaskID string `json:"task_id"`
WorkflowRunID string `json:"workflow_run_id"`
Data NodeFinishedData `json:"data"`
}
NodeFinishedEvent 节点完成事件
type NodeStartedData ¶
type NodeStartedData struct {
ID string `json:"id"`
NodeID string `json:"node_id"`
NodeType string `json:"node_type"`
Title string `json:"title"`
Index int `json:"index"`
PredecessorNodeID string `json:"predecessor_node_id"`
Inputs map[string]interface{} `json:"inputs"`
CreatedAt int64 `json:"created_at"`
}
NodeStartedData 节点开始数据
type NodeStartedEvent ¶
type NodeStartedEvent struct {
Event string `json:"event"`
TaskID string `json:"task_id"`
WorkflowRunID string `json:"workflow_run_id"`
Data NodeStartedData `json:"data"`
}
NodeStartedEvent 节点开始事件
type RenameRequest ¶
type RenameRequest struct {
Name string `json:"name,omitempty"`
AutoGenerate bool `json:"auto_generate,omitempty"`
User string `json:"user"`
}
RenameRequest 重命名请求
type RenameResponse ¶
type RenameResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Inputs map[string]interface{} `json:"inputs"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
RenameResponse 重命名响应
type RetrieverConfig ¶
type RetrieverConfig struct {
Enabled bool `json:"enabled"`
}
RetrieverConfig 知识库配置
type RetrieverResource ¶
type RetrieverResource struct {
Position int `json:"position"`
DatasetID string `json:"dataset_id"`
DatasetName string `json:"dataset_name"`
DocumentID string `json:"document_id"`
DocumentName string `json:"document_name"`
SegmentID string `json:"segment_id"`
Score float64 `json:"score"`
Content string `json:"content"`
}
RetrieverResource 表示知识库引用资源
type SSEReader ¶
type SSEReader struct {
// contains filtered or unexported fields
}
SSEReader SSE 事件读取器
type SpeechToTextConfig ¶
type SpeechToTextConfig struct {
Enabled bool `json:"enabled"`
}
SpeechToTextConfig 语音转文字配置
type StreamReader ¶
type StreamReader struct {
// contains filtered or unexported fields
}
StreamReader 流式响应读取器
func NewStreamReader ¶
func NewStreamReader(resp *http.Response) *StreamReader
NewStreamReader 创建流式读取器
type SuggestedQAConfig ¶
type SuggestedQAConfig struct {
Enabled bool `json:"enabled"`
}
SuggestedQAConfig 建议问题配置
type SuggestedResponse ¶
SuggestedResponse 建议问题响应
type SystemParamsConfig ¶
type SystemParamsConfig struct {
FileSizeLimit int `json:"file_size_limit"`
ImageFileSizeLimit int `json:"image_file_size_limit"`
AudioFileSizeLimit int `json:"audio_file_size_limit"`
VideoFileSizeLimit int `json:"video_file_size_limit"`
}
SystemParamsConfig 系统参数配置
type TextToSpeechConfig ¶
type TextToSpeechConfig struct {
Enabled bool `json:"enabled"`
Voice string `json:"voice"`
Language string `json:"language"`
}
TextToSpeechConfig 文字转语音配置
type Usage ¶
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
PromptUnitPrice string `json:"prompt_unit_price"`
PromptPriceUnit string `json:"prompt_price_unit"`
PromptPrice string `json:"prompt_price"`
CompletionTokens int `json:"completion_tokens"`
CompletionUnitPrice string `json:"completion_unit_price"`
CompletionPriceUnit string `json:"completion_price_unit"`
CompletionPrice string `json:"completion_price"`
TotalTokens int `json:"total_tokens"`
TotalPrice string `json:"total_price"`
Currency string `json:"currency"`
Latency float64 `json:"latency"`
}
Usage 表示 token 使用量
type WorkflowClient ¶
type WorkflowClient struct {
*Client
}
WorkflowClient 工作流应用客户端
func NewWorkflowClient ¶
func NewWorkflowClient(config ClientConfig) (*WorkflowClient, error)
NewWorkflowClient 创建工作流应用客户端
func (*WorkflowClient) GetMeta ¶
func (c *WorkflowClient) GetMeta(ctx context.Context, user string) (*AppMetaResponse, error)
GetMeta 获取应用元信息
func (*WorkflowClient) GetParameters ¶
func (c *WorkflowClient) GetParameters(ctx context.Context, user string) (*AppParametersResponse, error)
GetParameters 获取应用参数
func (*WorkflowClient) GetRunStatus ¶
func (c *WorkflowClient) GetRunStatus(ctx context.Context, workflowRunID string) (*WorkflowRunResponse, error)
GetRunStatus 获取工作流执行状态
func (*WorkflowClient) Run ¶
func (c *WorkflowClient) Run(ctx context.Context, req *WorkflowRequest) (*WorkflowResponse, error)
Run 执行工作流 (阻塞模式)
func (*WorkflowClient) RunStream ¶
func (c *WorkflowClient) RunStream(ctx context.Context, req *WorkflowRequest) (*StreamReader, error)
RunStream 执行工作流 (流式模式)
func (*WorkflowClient) Stop ¶
func (c *WorkflowClient) Stop(ctx context.Context, taskID string, user string) (*StopResponse, error)
Stop 停止工作流
type WorkflowData ¶
type WorkflowData struct {
ID string `json:"id"`
WorkflowID string `json:"workflow_id"`
Status string `json:"status"`
Outputs map[string]interface{} `json:"outputs"`
Error string `json:"error,omitempty"`
ElapsedTime float64 `json:"elapsed_time"`
TotalTokens int `json:"total_tokens"`
TotalSteps int `json:"total_steps"`
CreatedAt int64 `json:"created_at"`
FinishedAt int64 `json:"finished_at"`
}
WorkflowData 工作流数据
type WorkflowFinishedEvent ¶
type WorkflowFinishedEvent struct {
Event string `json:"event"`
TaskID string `json:"task_id"`
WorkflowRunID string `json:"workflow_run_id"`
Data WorkflowData `json:"data"`
}
WorkflowFinishedEvent 工作流完成事件
type WorkflowRequest ¶
type WorkflowRequest struct {
Inputs map[string]interface{} `json:"inputs"`
ResponseMode string `json:"response_mode"`
User string `json:"user"`
Files []FileInput `json:"files,omitempty"`
}
WorkflowRequest 工作流执行请求
type WorkflowResponse ¶
type WorkflowResponse struct {
WorkflowRunID string `json:"workflow_run_id"`
TaskID string `json:"task_id"`
Data WorkflowData `json:"data"`
}
WorkflowResponse 工作流执行响应 (blocking 模式)
type WorkflowRunResponse ¶
type WorkflowRunResponse struct {
ID string `json:"id"`
WorkflowID string `json:"workflow_id"`
Status string `json:"status"`
Inputs map[string]interface{} `json:"inputs"`
Outputs map[string]interface{} `json:"outputs"`
Error string `json:"error,omitempty"`
TotalSteps int `json:"total_steps"`
TotalTokens int `json:"total_tokens"`
CreatedAt int64 `json:"created_at"`
FinishedAt int64 `json:"finished_at"`
ElapsedTime float64 `json:"elapsed_time"`
}
WorkflowRunResponse 工作流执行状态响应
type WorkflowStartedData ¶
type WorkflowStartedData struct {
ID string `json:"id"`
WorkflowID string `json:"workflow_id"`
SequenceNum int `json:"sequence_number"`
CreatedAt int64 `json:"created_at"`
}
WorkflowStartedData 工作流开始数据
type WorkflowStartedEvent ¶
type WorkflowStartedEvent struct {
Event string `json:"event"`
TaskID string `json:"task_id"`
WorkflowRunID string `json:"workflow_run_id"`
Data WorkflowStartedData `json:"data"`
}
WorkflowStartedEvent 工作流开始事件