141 lines
4.2 KiB
Go
141 lines
4.2 KiB
Go
package main
|
|
|
|
type Config struct {
|
|
Volcengine VolcengineConfig `toml:"volcengine"`
|
|
Agent AgentConfig `toml:"agent"`
|
|
}
|
|
|
|
type VolcengineConfig struct {
|
|
BaseURL string `toml:"base_url"`
|
|
APIKey string `toml:"api_key"`
|
|
Model string `toml:"model"`
|
|
}
|
|
|
|
type AgentConfig struct {
|
|
AppDataDir string `toml:"app_data_dir"`
|
|
RegionsPath string `toml:"regions_path"`
|
|
ScreenshotPath string `toml:"screenshot_path"`
|
|
TaskOutputPath string `toml:"task_output_path"`
|
|
TaskHistoryDir string `toml:"task_history_dir"`
|
|
DryRun bool `toml:"dry_run"`
|
|
}
|
|
|
|
type LogEntry struct {
|
|
Level string `json:"level"`
|
|
Message string `json:"message"`
|
|
Timestamp string `json:"timestamp"`
|
|
}
|
|
|
|
type AnnotationFile struct {
|
|
App string `json:"app"`
|
|
ScreenshotPath string `json:"screenshotPath"`
|
|
ScreenshotWidth int `json:"screenshotWidth"`
|
|
ScreenshotHeight int `json:"screenshotHeight"`
|
|
ScaleFactor float64 `json:"scaleFactor"`
|
|
Source jsonRawOptional `json:"source,omitempty"`
|
|
Regions []Region `json:"regions"`
|
|
CreatedAt string `json:"createdAt"`
|
|
UpdatedAt string `json:"updatedAt"`
|
|
}
|
|
|
|
type jsonRawOptional map[string]any
|
|
|
|
type Region struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Type string `json:"type"`
|
|
BBoxImage [4]float64 `json:"bbox_image"`
|
|
BBoxSource [4]float64 `json:"bbox_source,omitempty"`
|
|
BBoxScreen [4]float64 `json:"bbox_screen"`
|
|
ScaleFactor float64 `json:"scaleFactor"`
|
|
}
|
|
|
|
type RegionSummary struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description,omitempty"`
|
|
Type string `json:"type"`
|
|
BBoxScreen [4]float64 `json:"bbox_screen"`
|
|
BBoxSource [4]float64 `json:"bbox_source,omitempty"`
|
|
CenterScreen [2]float64 `json:"center_screen"`
|
|
CenterSource [2]float64 `json:"center_source,omitempty"`
|
|
}
|
|
|
|
type Task struct {
|
|
TaskID string `json:"task_id"`
|
|
TaskName string `json:"task_name"`
|
|
TaskType string `json:"task_type"`
|
|
TaskStatus string `json:"task_status"`
|
|
CreatedAt string `json:"created_at"`
|
|
Source TaskSource `json:"source"`
|
|
Confidence float64 `json:"confidence"`
|
|
LLMSummary LLMSummary `json:"llm_summary"`
|
|
Regions []RegionSummary `json:"regions"`
|
|
Actions []Action `json:"actions"`
|
|
ExecutionLog []ExecutionLog `json:"execution_log"`
|
|
}
|
|
|
|
type TaskSource struct {
|
|
RegionsPath string `json:"regions_path"`
|
|
ScreenshotPath string `json:"screenshot_path"`
|
|
}
|
|
|
|
type LLMSummary struct {
|
|
ContactName string `json:"contact_name"`
|
|
ChatSummary string `json:"chat_summary"`
|
|
LatestUserMessage string `json:"latest_user_message"`
|
|
ReplyText string `json:"reply_text"`
|
|
}
|
|
|
|
type Action struct {
|
|
ActionID string `json:"action_id"`
|
|
Type string `json:"type"`
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
TargetRegion string `json:"target_region,omitempty"`
|
|
Point *[2]float64 `json:"point,omitempty"`
|
|
Text string `json:"text,omitempty"`
|
|
DeltaY int `json:"delta_y,omitempty"`
|
|
DurationMs int `json:"duration_ms,omitempty"`
|
|
Reason string `json:"reason,omitempty"`
|
|
}
|
|
|
|
type ExecutionLog struct {
|
|
ActionID string `json:"action_id"`
|
|
Status string `json:"status"`
|
|
Message string `json:"message"`
|
|
Time string `json:"time"`
|
|
}
|
|
|
|
type openAIRequest struct {
|
|
Model string `json:"model"`
|
|
Messages []openAIMessage `json:"messages"`
|
|
Temperature float64 `json:"temperature"`
|
|
}
|
|
|
|
type openAIMessage struct {
|
|
Role string `json:"role"`
|
|
Content []openAIContent `json:"content"`
|
|
}
|
|
|
|
type openAIContent struct {
|
|
Type string `json:"type"`
|
|
Text string `json:"text,omitempty"`
|
|
ImageURL *openAIImageURL `json:"image_url,omitempty"`
|
|
}
|
|
|
|
type openAIImageURL struct {
|
|
URL string `json:"url"`
|
|
}
|
|
|
|
type openAIResponse struct {
|
|
Choices []struct {
|
|
Message struct {
|
|
Content string `json:"content"`
|
|
} `json:"message"`
|
|
} `json:"choices"`
|
|
Error *struct {
|
|
Message string `json:"message"`
|
|
} `json:"error,omitempty"`
|
|
}
|