config

package
v0.0.0-...-2ca5d0e Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

internal/config/config.go

internal/config/env.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigDir

func GetConfigDir() string

Types

type Config

type Config struct {
	DefaultModel    string          `json:"default_model" mapstructure:"default_model"`
	AvailableModels []string        `json:"available_models" mapstructure:"available_models"` // New field
	OpenAIKey       string          `json:"openai_api_key" mapstructure:"openai_api_key"`
	OpenAIURL       string          `json:"openai_api_url" mapstructure:"openai_api_url"`
	AnthropicKey    string          `json:"anthropic_api_key" mapstructure:"anthropic_api_key"`
	GeminiKey       string          `json:"gemini_api_key" mapstructure:"gemini_api_key"`
	GroqKey         string          `json:"groq_api_key" mapstructure:"groq_api_key"`
	OllamaHost      string          `json:"ollama_host" mapstructure:"ollama_host"`
	Commands        []CustomCommand `json:"commands" mapstructure:"commands"`
}

func Load

func Load() (*Config, error)

type CustomCommand

type CustomCommand struct {
	Name         string                 `mapstructure:"command"`
	Description  string                 `mapstructure:"description"`
	Example      string                 `mapstructure:"example"`
	Prompt       string                 `mapstructure:"prompt"`
	Variables    map[string]interface{} `mapstructure:"variables"`
	RequireStdin bool                   `mapstructure:"require_stdin"`
}

type EnvConfig

type EnvConfig struct {
	OpenAIKey    string
	AnthropicKey string
	GoogleAPIKey string
	GroqAPIKey   string
	DefaultModel string
}

EnvConfig stores environment configuration

func LoadEnv

func LoadEnv() (*EnvConfig, error)

LoadEnv loads environment variables from a .env file if it exists and falls back to system environment variables if not found in .env

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳