Documentation
¶
Index ¶
- type AIService
- type APIProvider
- type AgentToolInfo
- type CCProviderConfig
- type Config
- func (c *Config) CCProviderConfig(name string) (*CCProviderConfig, error)
- func (c *Config) CCProviderNames() []string
- func (c *Config) Init() error
- func (c *Config) IsCCProvider(name string) bool
- func (c *Config) IsProvider(name string) bool
- func (c *Config) ModelName(name string) string
- func (c *Config) ProviderConfig(name string) (*ProviderConfig, error)
- func (c *Config) ProviderName(name string) string
- func (c *Config) ProviderNames() []string
- type ProviderConfig
- type SetClaudeCodeParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIService ¶
type AIService struct {
Config
// contains filtered or unexported fields
}
func (*AIService) SetClaudeCode ¶
func (s *AIService) SetClaudeCode(opts SetClaudeCodeParam) error
SetClaudeCode 设置 cc 的 API url 和令牌信息
func (*AIService) ShowConfig ¶
type APIProvider ¶
type AgentToolInfo ¶
AgentToolInfo agent tool config
type CCProviderConfig ¶
type CCProviderConfig struct {
ProviderConfig `yaml:",squash"`
// 配置到 cc config 的模型代码
ModelCode string `json:"model_code" yaml:"model_code"`
// 环境变量 需要设置到 cc config
Envs map[string]string `yaml:"envs"`
// API 提供者 key 是提供者名称
APIProviders map[string]*APIProvider `yaml:"api_providers"`
}
CCProviderConfig holds the configuration for a single CC provider
func (*CCProviderConfig) GetEnvMaps ¶
func (p *CCProviderConfig) GetEnvMaps(keyName, model string) map[string]string
GetEnvMaps returns the environment variables for the provider
type Config ¶
type Config struct {
// 默认的模型提供者
DefaultProvider string `json:"default_provider" yaml:"default_provider"`
// 默认的模型名称
DefaultModel string `json:"default_model" yaml:"default_model"`
// 支持的模型提供者列表(API场景使用)
Providers map[string]*ProviderConfig `json:"providers" yaml:"providers"`
// 提供者别名映射
ProviderAliases map[string]string `json:"provider_aliases" yaml:"provider_aliases"`
// 模型别名映射
ModelAliases map[string]string `json:"model_aliases" yaml:"model_aliases"`
// 不同场景使用的模型映射
SceneModels map[string]string `json:"scene_models" yaml:"scene_models"`
// key is tool name, eg: claude_code, codex, gemini
AgentTools map[string]*AgentToolInfo `json:"agent_tools" yaml:"agent_tools"`
// Claude-code 专用的提供者列表
CcProviders map[string]*CCProviderConfig `json:"cc_providers" yaml:"cc_providers"`
}
Config holds the configuration for the AI service
func (*Config) CCProviderConfig ¶
func (c *Config) CCProviderConfig(name string) (*CCProviderConfig, error)
CCProviderConfig holds the configuration for a single CC provider
func (*Config) CCProviderNames ¶
CCProviderNames returns a list of all available CC provider names
func (*Config) IsCCProvider ¶
IsCCProvider checks if a given name is a valid CC provider
func (*Config) IsProvider ¶
IsProvider checks if a given name is a valid provider
func (*Config) ProviderConfig ¶
func (c *Config) ProviderConfig(name string) (*ProviderConfig, error)
ProviderConfig holds the configuration for a single AI provider
func (*Config) ProviderName ¶
ProviderName returns the real name of a provider
func (*Config) ProviderNames ¶
ProviderNames returns a list of all available provider names
type ProviderConfig ¶
type ProviderConfig struct {
Name string `json:"name" yaml:"name"`
BaseURL string `json:"base_url" yaml:"base_url"`
APIKey string `json:"api_key" yaml:"api_key"` // api key, api token
Description string `json:"description" yaml:"description"`
Aliases []string `json:"aliases" yaml:"aliases"`
// 可用模型列表
Models []string `json:"models" yaml:"models"`
DocsURL string `json:"docs_url" yaml:"docs_url"`
Homepage string `json:"homepage" yaml:"homepage"`
}
ProviderConfig holds the configuration for a single AI provider