修改rag的实体类
This commit is contained in:
@@ -10,10 +10,17 @@ import (
|
||||
|
||||
// Agent Agent 结构体
|
||||
type Agent struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
DSL map[string]interface{} `json:"dsl"` // Canvas DSL 对象
|
||||
ID string `json:"id"` // Agent ID
|
||||
Title string `json:"title"` // Agent 标题
|
||||
Description string `json:"description"` // Agent 描述
|
||||
Avatar string `json:"avatar"` // 头像(Base64 编码)
|
||||
CanvasType string `json:"canvas_type"` // 画布类型
|
||||
CreateDate string `json:"create_date"` // 创建日期(格式化字符串)
|
||||
CreateTime int64 `json:"create_time"` // 创建时间(Unix 时间戳)
|
||||
UpdateDate string `json:"update_date"` // 更新日期(格式化字符串)
|
||||
UpdateTime int64 `json:"update_time"` // 更新时间(Unix 时间戳)
|
||||
UserID string `json:"user_id"` // 用户 ID
|
||||
DSL map[string]interface{} `json:"dsl"` // Canvas DSL 对象,定义 Agent 的工作流
|
||||
}
|
||||
|
||||
// CreateAgentReq 创建 Agent 请求
|
||||
@@ -41,10 +48,10 @@ type ListAgentsReq struct {
|
||||
}
|
||||
|
||||
// ListAgentsRes 列出 Agent 响应
|
||||
// 注意:API 不返回 total 字段,仅返回 data 数组
|
||||
type ListAgentsRes struct {
|
||||
Code int `json:"code"`
|
||||
Data []*Agent `json:"data"`
|
||||
Total int `json:"total"`
|
||||
Code int `json:"code"` // 状态码,0 表示成功
|
||||
Data []*Agent `json:"data"` // Agent 列表
|
||||
}
|
||||
|
||||
// CreateAgent 创建 Agent
|
||||
@@ -79,7 +86,8 @@ func (c *Client) UpdateAgent(ctx context.Context, agentID string, req *UpdateAge
|
||||
func (c *Client) DeleteAgent(ctx context.Context, agentID string) error {
|
||||
path := fmt.Sprintf("/api/v1/agents/%s", agentID)
|
||||
var res CommonResponse
|
||||
if err := c.request(ctx, "DELETE", path, nil, &res); err != nil {
|
||||
// 官方文档要求传空对象,不是 nil
|
||||
if err := c.request(ctx, "DELETE", path, map[string]interface{}{}, &res); err != nil {
|
||||
return fmt.Errorf("delete agent failed: %w", err)
|
||||
}
|
||||
if !res.IsSuccess() {
|
||||
|
||||
Reference in New Issue
Block a user