Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions common/agent/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ func (t *AIInfraScanAgent) executeScan(ctx context.Context, request TaskRequest,
callbacks.StepStatusUpdateCallback(step01, statusId01, AgentStatusRunning, "Thinking", "")

// 配置选项
language := request.Language
if language == "" {
language = "zh"
}
opts := &options.Options{
TimeOut: reqScan.Timeout,
RateLimit: 200,
Expand All @@ -363,6 +367,7 @@ func (t *AIInfraScanAgent) executeScan(ctx context.Context, request TaskRequest,
WebServer: false,
Target: reqScan.Target,
LoadRemote: true,
Language: language,
}

headers := make([]string, 0)
Expand Down
43 changes: 23 additions & 20 deletions common/websocket/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ type MCPTaskRequest struct {
// AIInfraScanTaskRequest represents AI infrastructure scan task request structure
// @Description AI infrastructure security scan task parameters: target URLs, custom headers, and optional model config for result analysis
type AIInfraScanTaskRequest struct {
Target []string `json:"target" example:"https://example.com"` // List of scan target URLs
Headers map[string]string `json:"headers" example:"{\"Authorization\":\"Bearer token\"}"` // Custom request headers
Timeout int `json:"timeout" example:"30"` // Request timeout in seconds
Model struct {
Target []string `json:"target" example:"https://example.com"` // List of scan target URLs
Headers map[string]string `json:"headers" example:"{\"Authorization\":\"Bearer token\"}"` // Custom request headers
Timeout int `json:"timeout" example:"30"` // Request timeout in seconds
Language string `json:"language,omitempty" example:"zh"` // Language code - optional
Model struct {
Model string `json:"model" binding:"required" example:"gpt-4"` // Model name - required
Token string `json:"token" binding:"required" example:"sk-xxx"` // API key - required
BaseUrl string `json:"base_url,omitempty" example:"https://api.openai.com/v1"` // Base URL - optional
Expand Down Expand Up @@ -302,14 +303,15 @@ func SubmitTask(c *gin.Context, tm *TaskManager) {

// Build TaskCreateRequest
taskReq = TaskCreateRequest{
ID: messageId,
SessionID: sessionId,
Username: username,
Task: agent.TaskTypeMcpScan,
Timestamp: time.Now().UnixMilli(),
Content: req.Prompt,
Params: params,
Attachments: attachments,
ID: messageId,
SessionID: sessionId,
Username: username,
Task: agent.TaskTypeMcpScan,
Timestamp: time.Now().UnixMilli(),
Content: req.Prompt,
Params: params,
Attachments: attachments,
CountryIsoCode: req.Language,
}
case "ai_infra_scan":
var req AIInfraScanTaskRequest
Expand All @@ -333,14 +335,15 @@ func SubmitTask(c *gin.Context, tm *TaskManager) {
}

taskReq = TaskCreateRequest{
ID: messageId,
SessionID: sessionId,
Username: username,
Task: agent.TaskTypeAIInfraScan,
Timestamp: time.Now().UnixMilli(),
Params: scanParams,
Content: strings.Join(req.Target, "\n"),
Attachments: []string{},
ID: messageId,
SessionID: sessionId,
Username: username,
Task: agent.TaskTypeAIInfraScan,
Timestamp: time.Now().UnixMilli(),
Params: scanParams,
Content: strings.Join(req.Target, "\n"),
Attachments: []string{},
CountryIsoCode: req.Language,
}
case "model_redteam_report":
var req PromptSecurityTaskRequest
Expand Down
Loading