utils

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package utils contains utility functions for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath(fileName ...string) string

ConfigPath returns the path to the configuration file. It is located in the user's home directory.

func InitConfig

func InitConfig(fileName string) error

InitConfig initializes the configuration file if it does not exist.

func UserPrompt

func UserPrompt(args []string) string

UserPrompt processes the user's prompt. It reads files, gets MCP prompts, and replaces variables.

Types

type AppConf

type AppConf struct {
	LLM    LLM            `yaml:"llm" json:"llm"`
	LLMs   map[string]LLM `yaml:"llms,omitempty" json:"llms,omitempty"`
	Prompt *Prompt
}

AppConf defines the application's configuration.

func LoadConfig

func LoadConfig(fileName string) (*AppConf, error)

LoadConfig loads the configuration from the given file.

func (*AppConf) PickupModel

func (c *AppConf) PickupModel()

PickupModel overrides the default model with the one provided by the user.

type LLM

type LLM struct {
	Gateway  string `yaml:"gateway,omitempty" json:"gateway,omitempty"`
	ApiKey   string `yaml:"apiKey,omitempty" json:"apiKey,omitempty"`
	Provider string `yaml:"provider" json:"provider"`
	Model    string `yaml:"model" json:"model"`
}

LLM defines the configuration for a large language model.

type Prompt

type Prompt struct {
	System        string
	Images        []string
	User          string
	WithUsage     bool
	JsonMode      bool
	OverrideModel string
	OnlyCodeBlock bool
	Temperature   float64
	MCPServers    *mcps.MCPs
}

Prompt defines the structure of a user prompt.

Jump to

Keyboard shortcuts

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