config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeminiTestUrl = "https://generativelanguage.googleapis.com/v1beta/models"

	LinkTestDefaultModel = "gpt-4o"
	// Input prompts
	InputPromptOpenAIKey = "请输入API Key,多个Key 用空格分隔 :"
	InputPromptOpenAIURL = "请输入API URL:"

	InputPromptModelTitle        = "选择测试模型"
	InputPromptModelDescription  = "选择方式: 1-2 选择模型组合,3-12 选择单个模型"
	InputPromptModelDescription2 = "支持多选(空格或逗号分隔),也可直接输入模型名称"
	InputPromptModelDescription3 = "回车使用默认模型"
	InputPromptModelQuickSelect  = "%d. %s: %s"

	InputPromptModel = "请输入测试的模型 (回车使用默认模型: %s)"

	ErrorReadFailed         = "读取选择失败: %v"
	ErrorTestFailed         = "测试失败: %v"
	ErrorNoAPIKey           = "未输入API Key"
	ErrorReadModelFailed    = "读取模型失败: %v"
	ErrorNoURL              = "未检测到URL (应以http开头)"
	ErrorNoKey              = "未检测到API Key"
	ErrorInvalidURL         = "无法识别URL,请确保URL以http://或https://开头"
	ErrorInvalidKey         = "无法识别API Key,请确保Key以sk-、key-、ak-、token-或AI开头"
	ErrorInvalidModelChoice = "无效的模型选择,请输入1-2的数字或直接输入模型名称"

	// Configuration info
	ConfigTypeGemini = "类型: Gemini API"
	ConfigTypeOpenAI = "类型: 通用 API"
	ConfigURL        = "API URL:  %s"
	ConfigModel      = "模型: %s"
	ConfigKeyCount   = "数量: %d 个 API Keys"
	ConfigKeyMasked  = "API Keys: %s"
	ConfigImageURL   = "临时图片URL: %s"

	// Update related
	UpdateCommand     = "curl -fsSL https://raw.githubusercontent.com/go-coders/check-gpt/main/install.sh | bash"
	UpdateCheckURL    = "https://api.github.com/repos/go-coders/check-gpt/releases/latest"
	UpdatePrompt      = "发现新版本 %s,是否更新? [y/N]: "
	UpdateSkipped     = "跳过更新"
	UpdateError       = "更新失败: %v"
	CurrentVersion    = "当前版本: %s"
	LatestVersion     = "最新版本: %s"
	CheckingForUpdate = "正在检查更新..."
)

Variables

View Source
var CommonOpenAIModels = []string{
	"gpt-3.5-turbo",
	"gpt-4-turbo",
	"gpt-4o",
	"gpt-4o-mini",
	"gpt-4o-128k",
	"o1-preview",
	"o1-mini",
	"claude-3.5-sonnet",
	"claude-3.5-haiku",
	"claude-3.5-opus",
	"claude-3-5-sonnet-20241022",
	"claude-3-5-haiku-20241022",
	"claude-3-opus-20240229",
	"gemini-1.5-pro",
	"gemini-2.0-flash-exp",
	"gemini-2.0-flash-thinking-exp",
}

CommonOpenAIModels defines the list of common OpenAI models

View Source
var ModelGroups = []ModelGroup{
	{
		Title:   "ChatGPT",
		Models:  []string{"gpt-3.5-turbo", "gpt-4o", "gpt-4o-mini"},
		Default: true,
	},
	{
		Title:  "ChatGPT o1",
		Models: []string{"o1-preview", "o1", "o1-mini"},
	},
	{
		Title:  "Claude",
		Models: []string{"claude-3.5-sonnet", "claude-3.5-haiku", "claude-3-opus"},
	},
}

ModelGroups defines the available model groups

Functions

func AllModels added in v0.1.8

func AllModels() []string

AllModels returns all available models

Types

type Config

type Config struct {
	Port           int
	Debug          bool
	Version        bool
	Timeout        time.Duration
	MaxTokens      int
	DefaultModel   string
	ImagePath      string
	ImageWidth     int
	ImageHeight    int
	Stream         bool
	GitRepo        string
	Prompt         string
	OPENAICIDR     []string
	MaxConcurrency int
}

Config represents the application configuration

func New

func New() *Config

New creates a new configuration with default values

type ImageType

type ImageType string

ImageType represents the type of image to generate

const (
	PNG ImageType = "png"
)

type ModelGroup added in v0.1.8

type ModelGroup struct {
	Title   string
	Models  []string
	Default bool
}

ModelGroup represents a model group configuration

Jump to

Keyboard shortcuts

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