Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BasicColors = []ColorInfo{ {Color: color.RGBA{R: 255, G: 0, B: 0, A: 255}, Name: "Red"}, {Color: color.RGBA{R: 0, G: 255, B: 0, A: 255}, Name: "Green"}, {Color: color.RGBA{R: 0, G: 0, B: 255, A: 255}, Name: "Blue"}, {Color: color.RGBA{R: 255, G: 255, B: 0, A: 255}, Name: "Yellow"}, {Color: color.RGBA{R: 255, G: 0, B: 255, A: 255}, Name: "Magenta"}, {Color: color.RGBA{R: 0, G: 255, B: 255, A: 255}, Name: "Cyan"}, {Color: color.RGBA{R: 255, G: 165, B: 0, A: 255}, Name: "Orange"}, {Color: color.RGBA{R: 128, G: 0, B: 128, A: 255}, Name: "Purple"}, {Color: color.RGBA{R: 165, G: 42, B: 42, A: 255}, Name: "Brown"}, }
BasicColors provides a list of basic colors with their names
Functions ¶
func FindAvailablePort ¶
FindAvailablePort finds an available port starting from the given port
func IsPortAvailable ¶
IsPortAvailable checks if a port is available
Types ¶
type ChatMessage ¶ added in v0.0.7
type ChatMessage struct { Role string `json:"role"` Content []MessageContent `json:"content"` }
ChatMessage represents a message in the chat
type ChatRequest ¶ added in v0.0.7
type ChatRequest struct { Model string `json:"model"` Messages []ChatMessage `json:"messages"` MaxTokens int `json:"max_tokens"` Stream bool `json:"stream"` }
ChatRequest represents the chat completion request structure
type ChatResponse ¶ added in v0.0.7
type ChatResponse struct { Choices []struct { Message struct { Content string `json:"content"` } `json:"message"` } `json:"choices"` }
ChatResponse represents the chat completion response structure
func SendChatRequest ¶ added in v0.0.7
func SendChatRequest(ctx context.Context, url, apiKey, model string, imageURL string, maxTokens int) (*ChatResponse, error)
SendChatRequest sends a chat completion request to the specified URL
type ColorInfo ¶ added in v0.0.7
ColorInfo represents a basic color with its name
func GenerateRandomImage ¶
GenerateRandomImage creates a random colored image with a pattern
func GetRandomUniqueColors ¶ added in v0.0.7
GetRandomUniqueColors returns n unique random colors from the basic colors
type ImageURL ¶ added in v0.0.7
type ImageURL struct {
URL string `json:"url"`
}
ImageURL represents an image URL
type MessageContent ¶ added in v0.0.7
type MessageContent struct { Type string `json:"type"` Text string `json:"text,omitempty"` ImageURL *ImageURL `json:"image_url,omitempty"` }
MessageContent represents the content of a message