server

package
v0.0.160 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(envConfig *config.EnvConfig) (*http.Server, error)

New creates a new HTTP server with the given configuration

func Run

func Run(envConfig *config.EnvConfig) error

Run creates and starts the HTTP server with the given configuration

Types

type AddModelRequest added in v0.0.24

type AddModelRequest struct {
	Name  string          `json:"name"`
	Modes []cfg.ModelMode `json:"modes"` // Use alias cfg
}

AddModelRequest is the request body for adding a model to a provider's configuration

type AvailableModel added in v0.0.24

type AvailableModel struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"` // Optional description if available
}

AvailableModel represents a model available from the provider's service

type AvailableModelListResponse added in v0.0.24

type AvailableModelListResponse struct {
	Success bool             `json:"success"`
	Models  []AvailableModel `json:"models"`
	Error   string           `json:"error,omitempty"`
}

AvailableModelListResponse is the response for listing available models from a provider

type BackupResponse added in v0.0.8

type BackupResponse struct {
	Success  bool   `json:"success"`
	Message  string `json:"message,omitempty"`
	Error    string `json:"error,omitempty"`
	Filename string `json:"filename,omitempty"`
}

BackupResponse represents a response for backup operations

type BulkFileRequest added in v0.0.8

type BulkFileRequest struct {
	Files []FileRequest `json:"files"`
}

BulkFileRequest represents a request for bulk file operations

type BulkFileResponse added in v0.0.8

type BulkFileResponse struct {
	Success bool         `json:"success"`
	Message string       `json:"message,omitempty"`
	Error   string       `json:"error,omitempty"`
	Results []FileResult `json:"results,omitempty"`
}

BulkFileResponse represents a response for bulk file operations

type ChatCompletionChoice added in v0.0.84

type ChatCompletionChoice struct {
	Index        int          `json:"index"`
	Message      *ChatMessage `json:"message,omitempty"`
	Delta        *ChatDelta   `json:"delta,omitempty"`
	FinishReason *string      `json:"finish_reason"`
}

ChatCompletionChoice represents a single completion choice

type ChatCompletionRequest added in v0.0.84

type ChatCompletionRequest struct {
	Model            string        `json:"model"`
	Messages         []ChatMessage `json:"messages"`
	Stream           bool          `json:"stream,omitempty"`
	Temperature      *float64      `json:"temperature,omitempty"`
	MaxTokens        *int          `json:"max_tokens,omitempty"`
	TopP             *float64      `json:"top_p,omitempty"`
	FrequencyPenalty *float64      `json:"frequency_penalty,omitempty"`
	PresencePenalty  *float64      `json:"presence_penalty,omitempty"`
	Stop             []string      `json:"stop,omitempty"`
	User             string        `json:"user,omitempty"`
}

ChatCompletionRequest represents the OpenAI chat completion request

type ChatCompletionResponse added in v0.0.84

type ChatCompletionResponse struct {
	ID      string                 `json:"id"`
	Object  string                 `json:"object"`
	Created int64                  `json:"created"`
	Model   string                 `json:"model"`
	Choices []ChatCompletionChoice `json:"choices"`
	Usage   UsageInfo              `json:"usage"`
}

ChatCompletionResponse represents the non-streaming response

type ChatDelta added in v0.0.84

type ChatDelta struct {
	Role    string `json:"role,omitempty"`
	Content string `json:"content,omitempty"`
}

ChatDelta represents incremental content in streaming

type ChatMessage added in v0.0.84

type ChatMessage struct {
	Role       string      `json:"role"`
	Content    interface{} `json:"content"` // string or []ContentPart
	RawContent string      `json:"-"`       // Extracted text content
}

ChatMessage represents a message in the conversation Content can be a string or an array of content parts (for multi-modal)

func (*ChatMessage) GetTextContent added in v0.0.84

func (m *ChatMessage) GetTextContent() string

GetTextContent extracts the text content from the message Handles both string content and array of content parts

type ConfiguredModel added in v0.0.24

type ConfiguredModel struct {
	Name  string          `json:"name"`
	Type  string          `json:"type"`  // e.g., "local", "external"
	Modes []cfg.ModelMode `json:"modes"` // Use alias cfg
}

ConfiguredModel represents a model as configured within Comanda

type ConfiguredModelListResponse added in v0.0.24

type ConfiguredModelListResponse struct {
	Success bool              `json:"success"`
	Models  []ConfiguredModel `json:"models"`
	Error   string            `json:"error,omitempty"`
}

ConfiguredModelListResponse is the response for listing models configured for a provider

type ContentPart added in v0.0.84

type ContentPart struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
}

ContentPart represents a part of multi-modal content

type EnvironmentRequest added in v0.0.8

type EnvironmentRequest struct {
	Password string `json:"password"`
}

EnvironmentRequest represents a request for environment operations

type EnvironmentResponse added in v0.0.8

type EnvironmentResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
	Error   string `json:"error,omitempty"`
}

EnvironmentResponse represents a response for environment operations

type ErrorResponse added in v0.0.24

type ErrorResponse struct {
	Success bool   `json:"success"` // Should always be false
	Error   string `json:"error"`
}

ErrorResponse represents a generic error API response

type FileInfo added in v0.0.8

type FileInfo struct {
	Name       string    `json:"name"`
	Path       string    `json:"path"`
	Size       int64     `json:"size"`
	IsDir      bool      `json:"isDir"`
	CreatedAt  time.Time `json:"createdAt"`
	ModifiedAt time.Time `json:"modifiedAt"`
	Methods    string    `json:"methods,omitempty"`
}

FileInfo represents detailed information about a file

type FileRequest added in v0.0.8

type FileRequest struct {
	Path    string `json:"path"`
	Content string `json:"content"`
}

FileRequest represents a request to create/edit a file

type FileResponse added in v0.0.8

type FileResponse struct {
	Success bool     `json:"success"`
	Message string   `json:"message,omitempty"`
	Error   string   `json:"error,omitempty"`
	File    FileInfo `json:"file,omitempty"`
}

FileResponse represents a response for file operations

type FileResult added in v0.0.8

type FileResult struct {
	Path    string `json:"path"`
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

FileResult represents the result of a single file operation

type FileUploadResponse added in v0.0.14

type FileUploadResponse struct {
	Success bool     `json:"success"`
	Message string   `json:"message,omitempty"`
	Error   string   `json:"error,omitempty"`
	File    FileInfo `json:"file,omitempty"`
}

FileUploadResponse represents a response for file upload operations

type GenerateRequest added in v0.0.35

type GenerateRequest struct {
	Prompt string `json:"prompt"`
	Model  string `json:"model,omitempty"`
}

GenerateRequest represents the request body for the generate endpoint

type GenerateResponse added in v0.0.35

type GenerateResponse struct {
	Success bool   `json:"success"`
	YAML    string `json:"yaml,omitempty"`
	Error   string `json:"error,omitempty"`
	Model   string `json:"model,omitempty"`
}

GenerateResponse represents the response for the generate endpoint

type HealthResponse

type HealthResponse struct {
	Status    string `json:"status"`
	Timestamp string `json:"timestamp"`
}

HealthResponse represents the health check response

type ListResponse

type ListResponse struct {
	Success bool       `json:"success"`
	Files   []FileInfo `json:"files"`
	Error   string     `json:"error,omitempty"`
}

ListResponse represents the response for file listing

type ModelInfo added in v0.0.84

type ModelInfo struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	Created int64  `json:"created"`
	OwnedBy string `json:"owned_by"`
}

ModelInfo represents model information for /v1/models

type ModelListResponse added in v0.0.84

type ModelListResponse struct {
	Object string      `json:"object"`
	Data   []ModelInfo `json:"data"`
}

ModelListResponse represents the models list response

type OpenAIError added in v0.0.84

type OpenAIError struct {
	Error OpenAIErrorDetail `json:"error"`
}

OpenAIError represents an error response

type OpenAIErrorDetail added in v0.0.84

type OpenAIErrorDetail struct {
	Message string  `json:"message"`
	Type    string  `json:"type"`
	Param   *string `json:"param"`
	Code    *string `json:"code"`
}

OpenAIErrorDetail represents the error details

type ProcessResponse

type ProcessResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
	Error   string `json:"error,omitempty"`
	Output  string `json:"output,omitempty"`
}

ProcessResponse represents the response for process operations

type ProviderInfo added in v0.0.8

type ProviderInfo struct {
	Name    string   `json:"name"`
	Models  []string `json:"models"`
	Enabled bool     `json:"enabled"`
}

ProviderInfo represents information about a provider

type ProviderListResponse added in v0.0.8

type ProviderListResponse struct {
	Success   bool           `json:"success"`
	Providers []ProviderInfo `json:"providers"`
	Error     string         `json:"error,omitempty"`
}

ProviderListResponse represents the response for provider listing

type ProviderRequest added in v0.0.8

type ProviderRequest struct {
	Name    string   `json:"name"`
	APIKey  string   `json:"apiKey"`
	Models  []string `json:"models,omitempty"`
	Enabled bool     `json:"enabled"`
}

ProviderRequest represents a request to modify a provider

type RestoreRequest added in v0.0.8

type RestoreRequest struct {
	Backup string `json:"backup"`
}

RestoreRequest represents a request for restore operations

type Server added in v0.0.8

type Server struct {
	// contains filtered or unexported fields
}

Server represents the HTTP server

type SuccessResponse added in v0.0.24

type SuccessResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
}

SuccessResponse represents a generic successful API response

type UpdateModelRequest added in v0.0.24

type UpdateModelRequest struct {
	Modes []cfg.ModelMode `json:"modes"` // Use alias cfg
}

UpdateModelRequest is the request body for updating a configured model's modes

type UsageInfo added in v0.0.84

type UsageInfo struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

UsageInfo represents token usage information

type YAMLRequest added in v0.0.14

type YAMLRequest struct {
	Content   string `json:"content"`
	Input     string `json:"input"`
	Streaming bool   `json:"streaming"`
}

YAMLRequest represents a request for YAML operations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL