config

package
v0.0.0-...-1b48a8e Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliyunConfig

type AliyunConfig struct {
	PublicOSS  AliyunOSSConfig `mapstructure:"public_oss"`
	PrivateOSS AliyunOSSConfig `mapstructure:"private_oss"`
}

AliyunConfig mirrors mcai-backend's config.AliyunConfig.

type AliyunOSSConfig

type AliyunOSSConfig struct {
	AvatarPrefix    string `mapstructure:"avatar_prefix"`
	SpecPrefix      string `mapstructure:"spec_prefix"`
	RepoPrefix      string `mapstructure:"repo_prefix"`
	TempPrefix      string `mapstructure:"temp_prefix"`
	Endpoint        string `mapstructure:"endpoint"`
	AccessEndpoint  string `mapstructure:"access_endpoint"`
	AccessKey       string `mapstructure:"access_key"`
	AccessKeySecret string `mapstructure:"access_key_secret"`
	Bucket          string `mapstructure:"bucket"`
	Region          string `mapstructure:"region"`
	MaxSize         int64  `mapstructure:"max_size"`
}

AliyunOSSConfig is structurally identical to mcai-backend's config.OSSConfig so the same aliyun.public_oss yaml block can be pasted into mcai-gh/backend deploys. Only Endpoint / Bucket / AccessKey / AccessKeySecret / Region are read by the agent-resources Resolver; the *Prefix fields are accepted for shape parity but unused on this side.

type AtomgitConfig

type AtomgitConfig struct {
	// OpenAPI 域名(默认 https://api.atomgit.com)
	BaseURL string `mapstructure:"base_url"`
	Enabled bool   `mapstructure:"enabled"`
}

AtomgitConfig atomgit (https://atomgit.com) 配置

当前实现仅支持 PAT 模式; OAuth authorize/callback 链路待补 (token endpoint 已在文档中: POST https://api.atomgit.com/login/oauth/access_token, refresh_token 也走该地址)。

type Attachment

type Attachment struct {
	AllowedURLPrefixes []string `mapstructure:"allowed_url_prefixes"`
}

type ClickHouse

type ClickHouse struct {
	Addr            string `mapstructure:"addr"`
	Database        string `mapstructure:"database"`
	Table           string `mapstructure:"table"`
	ModelUsageTable string `mapstructure:"model_usage_table"`
	InitEnabled     bool   `mapstructure:"init_enabled"`
	Username        string `mapstructure:"username"`
	Password        string `mapstructure:"password"`
	ReadUsername    string `mapstructure:"read_username"`
	ReadPassword    string `mapstructure:"read_password"`
	MaxOpenConns    int    `mapstructure:"max_open_conns"`
	MaxIdleConns    int    `mapstructure:"max_idle_conns"`
	ConnMaxLifetime int    `mapstructure:"conn_max_lifetime"`
}

type CnbConfig

type CnbConfig struct {
	// OpenAPI 域名(默认 https://api.cnb.cool)
	BaseURL string `mapstructure:"base_url"`
	// Web 域名(默认 https://cnb.cool,OAuth authorize / token endpoint 走这个)
	WebBaseURL string         `mapstructure:"web_base_url"`
	Enabled    bool           `mapstructure:"enabled"`
	OAuth      CnbOAuthConfig `mapstructure:"oauth"`
}

CnbConfig 腾讯 CNB (cnb.cool) 配置

type CnbOAuthConfig

type CnbOAuthConfig struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	RedirectURL  string `mapstructure:"redirect_url"`
	// Scope 默认 "repo-basic-info repo-code account-profile"
	Scope string `mapstructure:"scope"`
}

CnbOAuthConfig CNB OAuth2 配置(标准授权码模式 + refresh_token)

type CodeupConfig

type CodeupConfig struct {
	// OpenAPI 域名(默认 https://openapi-rdc.aliyuncs.com,专有云可覆盖)
	BaseURL string            `mapstructure:"base_url"`
	Enabled bool              `mapstructure:"enabled"`
	OAuth   CodeupOAuthConfig `mapstructure:"oauth"`
}

CodeupConfig 阿里云云效 Codeup 配置

type CodeupOAuthConfig

type CodeupOAuthConfig struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	RedirectURL  string `mapstructure:"redirect_url"`
	// TokenURL 阿里云 OAuth2 token endpoint,默认 https://account.aliyun.com/oauth2/v1/token
	TokenURL string `mapstructure:"token_url"`
	// AuthorizeURL 阿里云 OAuth2 authorize endpoint,默认 https://account.aliyun.com/oauth2/v1/auth
	AuthorizeURL string `mapstructure:"authorize_url"`
}

CodeupOAuthConfig Codeup OAuth 配置(走阿里云账号 OAuth2)

⚠️ 暂未启用:云效 OAuth(POST /login/oauth/create)官方仍在内测,且响应不返回 refresh_token / expires_in,与现有 OAuth2 刷新模型不兼容。当前 codeup 一律走 PAT 模式(identity.AccessToken 存用户填写的 PAT)。等云效放开公网接入并补齐响应字段后, 再补 Authorize/Callback handler 和 token 持久化逻辑。

type Config

type Config struct {
	Debug bool `mapstructure:"debug"`

	Server struct {
		Addr    string `mapstructure:"addr"`
		BaseURL string `mapstructure:"base_url"`
	} `mapstructure:"server"`

	Database Database `mapstructure:"database"`

	Redis struct {
		Host string `mapstructure:"host"`
		Port int    `mapstructure:"port"`
		Pass string `mapstructure:"pass"`
		DB   int    `mapstructure:"db"`
	} `mapstructure:"redis"`

	Session Session `mapstructure:"session"`
	SMTP    SMTP    `mapstructure:"smtp"`

	LLMProxy struct {
		Addr                 string `mapstructure:"addr"`
		BaseURL              string `mapstructure:"base_url"`
		Timeout              string `mapstructure:"timeout"`
		KeepAlive            string `mapstructure:"keep_alive"`
		ClientPoolSize       int    `mapstructure:"client_pool_size"`
		StreamClientPoolSize int    `mapstructure:"stream_client_pool_size"`
		RequestLogPath       string `mapstructure:"request_log_path"`
	} `mapstructure:"llm_proxy"`

	RootPath   string           `mapstructure:"root_path"`
	Logger     logger.Config    `mapstructure:"logger"`
	Telemetry  telemetry.Config `mapstructure:"telemetry"`
	AdminToken string           `mapstructure:"admin_token"`
	Proxies    []string         `mapstructure:"proxies"`

	TaskFlow      TaskFlow            `mapstructure:"taskflow"`
	MCPHub        MCPHub              `mapstructure:"mcp_hub"`
	PublicHost    PublicHost          `mapstructure:"public_host"`
	Task          Task                `mapstructure:"task"`
	TaskSummary   TaskSummary         `mapstructure:"task_summary"`
	Loki          Loki                `mapstructure:"loki"`
	ClickHouse    ClickHouse          `mapstructure:"clickhouse"`
	LLM           LLM                 `mapstructure:"llm"`
	Notify        Notify              `mapstructure:"notify"`
	VMIdle        VMIdle              `mapstructure:"vm_idle"`
	Attachment    Attachment          `mapstructure:"attachment"`
	ObjectStorage ObjectStorageConfig `mapstructure:"object_storage"`
	// Aliyun mirrors mcai-backend's aliyun.public_oss block so the agent-
	// resources Resolver can fall back to that bucket when ObjectStorage is
	// disabled (the same OSS that admin-new writes assets into). Optional.
	Aliyun        AliyunConfig      `mapstructure:"aliyun"`
	StaticFiles   StaticFilesConfig `mapstructure:"static_files"`
	HostInstaller HostInstaller     `mapstructure:"host_installer"`

	// Context7 API 配置
	Context7ApiKey string `mapstructure:"context7_api_key"`

	// Git 平台配置
	Github  GithubConfig  `mapstructure:"github"`
	Gitlab  GitlabConfig  `mapstructure:"gitlab"`
	Gitea   GiteaConfig   `mapstructure:"gitea"`
	Gitee   GiteeConfig   `mapstructure:"gitee"`
	Codeup  CodeupConfig  `mapstructure:"codeup"`
	Cnb     CnbConfig     `mapstructure:"cnb"`
	Atomgit AtomgitConfig `mapstructure:"atomgit"`

	// 微信配置(开放平台 OAuth 登录 + 公众号消息推送)
	Wechat WechatConfig `mapstructure:"wechat"`

	OAuthLogin OAuthLoginConfig `mapstructure:"oauth_login"`

	InitTeam InitTeam `mapstructure:"init_team"`

	// 语音识别配置(阿里云 NLS,用于一段录音 POST 接口)
	NLS NLS `mapstructure:"nls"`

	// 流式语音识别配置(豆包 SAUC bigmodel,用于 WS 实时流式接口)
	Doubao Doubao `mapstructure:"doubao"`

	ReviewAgent ReviewAgent `mapstructure:"review_agent"`
	Security    Security    `mapstructure:"security"`
}

func Init

func Init(dir string) (*Config, error)

func (*Config) GetAtomgitBaseURL

func (c *Config) GetAtomgitBaseURL() string

GetAtomgitBaseURL 获取 atomgit OpenAPI 域名(默认 https://api.atomgit.com)

func (*Config) GetCnbBaseURL

func (c *Config) GetCnbBaseURL() string

GetCnbBaseURL 获取 CNB OpenAPI 域名(默认 https://api.cnb.cool)

func (*Config) GetCnbOAuthClientID

func (c *Config) GetCnbOAuthClientID() string

GetCnbOAuthClientID 获取 CNB OAuth Client ID

func (*Config) GetCnbOAuthClientSecret

func (c *Config) GetCnbOAuthClientSecret() string

GetCnbOAuthClientSecret 获取 CNB OAuth Client Secret

func (*Config) GetCnbOAuthRedirectURL

func (c *Config) GetCnbOAuthRedirectURL() string

GetCnbOAuthRedirectURL 获取 CNB OAuth Redirect URL

func (*Config) GetCnbOAuthScope

func (c *Config) GetCnbOAuthScope() string

GetCnbOAuthScope 获取 CNB OAuth scope(多 scope 空格分隔)

func (*Config) GetCnbWebBaseURL

func (c *Config) GetCnbWebBaseURL() string

GetCnbWebBaseURL 获取 CNB Web 域名(OAuth authorize/token 走此域名)

func (*Config) GetCodeupBaseURL

func (c *Config) GetCodeupBaseURL() string

GetCodeupBaseURL 获取 Codeup OpenAPI 域名(默认公共站)

func (*Config) GetCodeupOAuthAuthorizeURL

func (c *Config) GetCodeupOAuthAuthorizeURL() string

GetCodeupOAuthAuthorizeURL 获取 Codeup OAuth authorize endpoint

func (*Config) GetCodeupOAuthClientID

func (c *Config) GetCodeupOAuthClientID() string

GetCodeupOAuthClientID 获取 Codeup OAuth Client ID

func (*Config) GetCodeupOAuthClientSecret

func (c *Config) GetCodeupOAuthClientSecret() string

GetCodeupOAuthClientSecret 获取 Codeup OAuth Client Secret

func (*Config) GetCodeupOAuthRedirectURL

func (c *Config) GetCodeupOAuthRedirectURL() string

GetCodeupOAuthRedirectURL 获取 Codeup OAuth Redirect URL

func (*Config) GetCodeupOAuthTokenURL

func (c *Config) GetCodeupOAuthTokenURL() string

GetCodeupOAuthTokenURL 获取 Codeup OAuth token endpoint(默认阿里云账号通用网关)

func (*Config) GetGiteaBaseURL

func (c *Config) GetGiteaBaseURL() string

GetGiteaBaseURL 获取 Gitea Base URL

func (*Config) GetGiteaOAuthClientID

func (c *Config) GetGiteaOAuthClientID() string

GetGiteaOAuthClientID 获取 Gitea OAuth Client ID

func (*Config) GetGiteaOAuthClientSecret

func (c *Config) GetGiteaOAuthClientSecret() string

GetGiteaOAuthClientSecret 获取 Gitea OAuth Client Secret

func (*Config) GetGiteaOAuthRedirectURL

func (c *Config) GetGiteaOAuthRedirectURL() string

GetGiteaOAuthRedirectURL 获取 Gitea OAuth Redirect URL

func (*Config) GetGiteaToken

func (c *Config) GetGiteaToken() string

GetGiteaToken 获取 Gitea token

func (*Config) GetGiteeBaseURL

func (c *Config) GetGiteeBaseURL() string

GetGiteeBaseURL 获取 Gitee Base URL

func (*Config) GetGiteeOAuthClientID

func (c *Config) GetGiteeOAuthClientID() string

GetGiteeOAuthClientID 获取 Gitee OAuth Client ID

func (*Config) GetGiteeOAuthClientSecret

func (c *Config) GetGiteeOAuthClientSecret() string

GetGiteeOAuthClientSecret 获取 Gitee OAuth Client Secret

func (*Config) GetGiteeOAuthRedirectURL

func (c *Config) GetGiteeOAuthRedirectURL() string

GetGiteeOAuthRedirectURL 获取 Gitee OAuth Redirect URL

func (*Config) GetGiteeToken

func (c *Config) GetGiteeToken() string

GetGiteeToken 获取 Gitee token

func (*Config) GetGitlabBaseURL

func (c *Config) GetGitlabBaseURL(instanceName string) string

GetGitlabBaseURL 获取指定 GitLab 实例的 Base URL

func (*Config) GetGitlabOAuthClientID

func (c *Config) GetGitlabOAuthClientID(instanceName string) string

GetGitlabOAuthClientID 获取指定 GitLab 实例的 OAuth Client ID

func (*Config) GetGitlabOAuthClientSecret

func (c *Config) GetGitlabOAuthClientSecret(instanceName string) string

GetGitlabOAuthClientSecret 获取指定 GitLab 实例的 OAuth Client Secret

func (*Config) GetGitlabOAuthRedirectURL

func (c *Config) GetGitlabOAuthRedirectURL(instanceName string) string

GetGitlabOAuthRedirectURL 获取指定 GitLab 实例的 OAuth Redirect URL

func (*Config) GetGitlabOAuthScope

func (c *Config) GetGitlabOAuthScope(instanceName string) string

GetGitlabOAuthScope 获取指定 GitLab 实例的 OAuth Scope

func (*Config) GetGitlabToken

func (c *Config) GetGitlabToken(instanceName string) string

GetGitlabToken 获取 GitLab token

func (*Config) IsAtomgitEnabled

func (c *Config) IsAtomgitEnabled() bool

IsAtomgitEnabled 检查 atomgit 是否启用

func (*Config) IsCnbEnabled

func (c *Config) IsCnbEnabled() bool

IsCnbEnabled 检查 CNB 是否启用

func (*Config) IsCodeupEnabled

func (c *Config) IsCodeupEnabled() bool

IsCodeupEnabled 检查 Codeup 是否启用

func (*Config) IsGiteaEnabled

func (c *Config) IsGiteaEnabled() bool

IsGiteaEnabled 检查 Gitea 是否启用

func (*Config) IsGiteeEnabled

func (c *Config) IsGiteeEnabled() bool

IsGiteeEnabled 检查 Gitee 是否启用

func (*Config) IsGithubEnabled

func (c *Config) IsGithubEnabled() bool

IsGithubEnabled 检查 GitHub 是否启用

func (*Config) IsGitlabInstanceEnabled

func (c *Config) IsGitlabInstanceEnabled(instanceName string) bool

IsGitlabInstanceEnabled 检查指定 GitLab 实例是否启用

type Database

type Database struct {
	Master          string `mapstructure:"master"`
	Slave           string `mapstructure:"slave"`
	MaxOpenConns    int    `mapstructure:"max_open_conns"`
	MaxIdleConns    int    `mapstructure:"max_idle_conns"`
	ConnMaxLifetime int    `mapstructure:"conn_max_lifetime"`
}

type Doubao

type Doubao struct {
	// 火山控制台获取的 App Key,作为 X-Api-Key header 发送
	AppKey string `mapstructure:"app_key"`
	// 资源 ID;ASR 2.0 取值: volc.seedasr.sauc.duration (按时长) 或 volc.seedasr.sauc.concurrent (按并发)
	ResourceID string `mapstructure:"resource_id"`
	// WebSocket URL,默认 wss://openspeech.bytedance.com/api/v3/sauc/bigmodel_async
	URL string `mapstructure:"url"`
	// 自学习平台上预建的热词词表 ID (单表最多 5000 个热词)。
	// BoostingTableID 与 BoostingTableName 二选一即可,同时配置时豆包优先用 ID。
	BoostingTableID string `mapstructure:"boosting_table_id"`
	// 自学习平台上预建的热词词表名称,可替代 BoostingTableID 使用 (改名会失效,推荐用 ID)
	BoostingTableName string `mapstructure:"boosting_table_name"`
}

Doubao 豆包流式语音识别 2.0 配置 (火山引擎 SAUC bigmodel)。 新版控制台:只需 AppKey 一个鉴权字段 (作为 X-Api-Key header)。

type GiteaConfig

type GiteaConfig struct {
	BaseURL string           `mapstructure:"base_url"`
	Token   string           `mapstructure:"token"`
	Enabled bool             `mapstructure:"enabled"`
	OAuth   GiteaOAuthConfig `mapstructure:"oauth"`
}

GiteaConfig Gitea 配置

type GiteaOAuthConfig

type GiteaOAuthConfig struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	RedirectURL  string `mapstructure:"redirect_url"`
}

GiteaOAuthConfig Gitea OAuth 配置

type GiteeConfig

type GiteeConfig struct {
	BaseURL string           `mapstructure:"base_url"`
	Token   string           `mapstructure:"token"`
	Enabled bool             `mapstructure:"enabled"`
	OAuth   GiteeOAuthConfig `mapstructure:"oauth"`
}

GiteeConfig Gitee 配置

type GiteeOAuthConfig

type GiteeOAuthConfig struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	RedirectURL  string `mapstructure:"redirect_url"`
}

GiteeOAuthConfig Gitee OAuth 配置

type GithubAppConfig

type GithubAppConfig struct {
	ID            int64  `mapstructure:"id"`
	WebhookSecret string `mapstructure:"webhook_secret"`
	PrivateKey    string `mapstructure:"private_key"`
	RedirectURL   string `mapstructure:"redirect_url"` // 安装完 GitHub App 后的跳转地址
}

type GithubConfig

type GithubConfig struct {
	Token   string            `mapstructure:"token"`
	Enabled bool              `mapstructure:"enabled"`
	App     GithubAppConfig   `mapstructure:"app"`
	OAuth   GithubOAuthConfig `mapstructure:"oauth"`
}

GithubConfig GitHub 配置

type GithubOAuthConfig

type GithubOAuthConfig struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	RedirectURL  string `mapstructure:"redirect_url"`
}

GithubOAuthConfig GitHub OAuth 配置

type GitlabConfig

type GitlabConfig struct {
	Default        string                    `mapstructure:"default"`
	Instances      map[string]GitlabInstance `mapstructure:"instances"`
	WebhookSecret  string                    `mapstructure:"webhook_secret"`
	AllowedDomains []string                  `mapstructure:"allowed_domains"`
}

GitlabConfig GitLab 配置

type GitlabInstance

type GitlabInstance struct {
	Token   string            `mapstructure:"token"`
	BaseURL string            `mapstructure:"base_url"`
	Enabled bool              `mapstructure:"enabled"`
	OAuth   GitlabOAuthConfig `mapstructure:"oauth"`
}

GitlabInstance GitLab 实例配置

type GitlabOAuthConfig

type GitlabOAuthConfig struct {
	ClientID     string   `mapstructure:"client_id"`
	ClientSecret string   `mapstructure:"client_secret"`
	RedirectURL  string   `mapstructure:"redirect_url"`
	Scope        []string `mapstructure:"scope"`
}

GitlabOAuthConfig GitLab OAuth 配置

type HostInstaller

type HostInstaller struct {
	Mode       string `mapstructure:"mode"`
	BundlePath string `mapstructure:"bundle_path"`
}

type InitTeam

type InitTeam struct {
	Email               string `mapstructure:"email"`
	Password            string `mapstructure:"password"`
	Name                string `mapstructure:"name"`
	Image               string `mapstructure:"image"`
	ExtensionPackageDir string `mapstructure:"extension_package_dir"`
}

type LLM

type LLM struct {
	BaseURL       string `mapstructure:"base_url"`
	APIKey        string `mapstructure:"api_key"`
	Model         string `mapstructure:"model"`
	InterfaceType string `mapstructure:"interface_type"` // openai_chat, openai_responses, anthropic
}

LLM 大语言模型配置

type Loki

type Loki struct {
	Addr string `mapstructure:"addr"` // Loki 服务地址
}

Loki Loki 日志配置

type MCPHub

type MCPHub struct {
	Enabled         bool   `mapstructure:"enabled"`
	URL             string `mapstructure:"url"`
	Token           string `mapstructure:"token"`
	UpstreamTimeout string `mapstructure:"upstream_timeout"`
}

func (MCPHub) UpstreamTimeoutDuration

func (c MCPHub) UpstreamTimeoutDuration() time.Duration

type NLS

type NLS struct {
	AppKey string `mapstructure:"app_key"`
	AkID   string `mapstructure:"ak_id"`
	AkKey  string `mapstructure:"ak_key"`
}

NLS 阿里云语音识别配置

type Notify

type Notify struct {
	VMExpireWarningMinutes int `mapstructure:"vm_expire_warning_minutes"` // VM 过期预警时间(分钟)
}

Notify 通知配置

type OAuthLoginConfig

type OAuthLoginConfig struct {
	Google OAuthLoginProviderConfig `mapstructure:"google"`
	Github OAuthLoginProviderConfig `mapstructure:"github"`
}

type OAuthLoginProviderConfig

type OAuthLoginProviderConfig struct {
	Enabled      bool   `mapstructure:"enabled"`
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	RedirectURL  string `mapstructure:"redirect_url"`
}

type ObjectStorageConfig

type ObjectStorageConfig struct {
	Enabled         bool   `mapstructure:"enabled"`
	Provider        string `mapstructure:"provider"`
	ForcePathStyle  bool   `mapstructure:"force_path_style"`
	InitBucket      bool   `mapstructure:"init_bucket"`
	PresignExpires  string `mapstructure:"presign_expires"`
	Endpoint        string `mapstructure:"endpoint"`
	AccessEndpoint  string `mapstructure:"access_endpoint"`
	AccessKey       string `mapstructure:"access_key"`
	AccessKeySecret string `mapstructure:"access_key_secret"`
	Bucket          string `mapstructure:"bucket"`
	Region          string `mapstructure:"region"`
	MaxSize         int64  `mapstructure:"max_size"`
	AvatarPrefix    string `mapstructure:"avatar_prefix"`
	SpecPrefix      string `mapstructure:"spec_prefix"`
	RepoPrefix      string `mapstructure:"repo_prefix"`
	TempPrefix      string `mapstructure:"temp_prefix"`
}

type PublicHost

type PublicHost struct {
	CountLimit int   `mapstructure:"count_limit"` // 每用户公共主机 VM 数量限制,0 表示不限制
	TTLLimit   int64 `mapstructure:"ttl_limit"`   // 公共主机 VM 续期上限(秒),0 表示不限制
}

PublicHost 公共主机配置(可选,内部项目通过 WithPublicHost 注入时生效)

type ReviewAgent

type ReviewAgent struct {
	ModelID string `mapstructure:"model_id"`
	Image   string `mapstructure:"image"`
}

type SMTP

type SMTP struct {
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	From     string `mapstructure:"from"`
	TLS      bool   `mapstructure:"tls"`
}

type Security

type Security struct {
	BlockPrivateNetwork bool `mapstructure:"block_private_network"`
	CaptchaEnabled      bool `mapstructure:"captcha_enabled"`
}

type Session

type Session struct {
	ExpireDay int `mapstructure:"expire_day"`
}

type StaticFilesConfig

type StaticFilesConfig struct {
	Enabled     bool   `mapstructure:"enabled"`
	Dir         string `mapstructure:"dir"`
	RoutePrefix string `mapstructure:"route_prefix"`
}

type Task

type Task struct {
	LogLimit            int    `mapstructure:"log_limit"`              // Loki tail 日志 limit
	TaskerTTLSeconds    int    `mapstructure:"tasker_ttl_seconds"`     // Tasker 状态机 TTL(秒)
	CreateReqTTLSeconds int    `mapstructure:"create_req_ttl_seconds"` // 创建任务请求 Redis TTL(秒)
	ImageID             string `mapstructure:"image_id"`               // 默认镜像 ID
	Core                int    `mapstructure:"core"`                   // VM CPU 核数
	Memory              uint64 `mapstructure:"memory"`                 // VM 内存(字节)
}

Task 任务相关配置

type TaskFlow

type TaskFlow struct {
	GrpcHost      string `mapstructure:"grpc_host"`
	GrpcPort      int    `mapstructure:"grpc_port"`
	GrpcURL       string `mapstructure:"grpc_url"`
	CallbackToken string `mapstructure:"callback_token"`
}

type TaskSummary

type TaskSummary struct {
	Enabled       bool   `mapstructure:"enabled"`        // 是否启用
	Model         string `mapstructure:"model"`          // 摘要生成模型 ID
	BaseURL       string `mapstructure:"base_url"`       // API Base URL
	ApiKey        string `mapstructure:"api_key"`        // API Key // nolint:revive
	InterfaceType string `mapstructure:"interface_type"` // API 接口类型(openai_chat/openai_responses/anthropic)
	Delay         int    `mapstructure:"delay"`          // 延迟时间(秒),默认 3600
	MaxChars      int    `mapstructure:"max_chars"`      // 摘要最大字符数,默认 300
	MaxRounds     int    `mapstructure:"max_rounds"`     // 最近对话轮数,默认 3
	MaxWorkers    int    `mapstructure:"max_workers"`    // 最大消费者数量,默认 5
}

TaskSummary 任务摘要生成配置

type VMIdle

type VMIdle struct {
	SleepSeconds                  int   `mapstructure:"sleep_seconds"`                     // VM 空闲休眠时间(秒)
	RecycleSeconds                int   `mapstructure:"recycle_seconds"`                   // VM 空闲回收时间(秒)
	RecycleWarnWechatLeadSeconds  []int `mapstructure:"recycle_warn_wechat_lead_seconds"`  // VM 回收前,微信公众号档每个 tier 的提前预警时长(秒),可配多档;缺省 [7200, 900]
	RecycleWarnDefaultLeadSeconds int   `mapstructure:"recycle_warn_default_lead_seconds"` // VM 回收前,非微信公众号渠道(钉钉/飞书等)的提前预警时长(秒),<=0 视为禁用该档;缺省 3600
}

type WechatConfig

type WechatConfig struct {
	Open WechatOpenConfig `mapstructure:"open"`
	MP   WechatMPConfig   `mapstructure:"mp"`
}

WechatConfig 微信配置(包含开放平台和公众号两部分)

type WechatMPConfig

type WechatMPConfig struct {
	AppID          string            `mapstructure:"app_id"`
	AppSecret      string            `mapstructure:"app_secret"`
	Token          string            `mapstructure:"token"`
	EncodingAESKey string            `mapstructure:"encoding_aes_key"`
	Templates      map[string]string `mapstructure:"templates"`
	MirrorMode     bool              `mapstructure:"mirror_mode"`
	QA             WechatMPQAConfig  `mapstructure:"qa"` // 文本消息自动问答
}

WechatMPConfig 微信公众号配置 - 用于消息推送

type WechatMPQAConfig

type WechatMPQAConfig struct {
	Enabled bool   `mapstructure:"enabled"`
	BaseURL string `mapstructure:"base_url"` // 形如 https://monkeycode.docs.baizhi.cloud
	APIKey  string `mapstructure:"api_key"`  // 知识库 share token
	Model   string `mapstructure:"model"`    // 形如 deepseek-v3.2
}

WechatMPQAConfig 公众号文本消息自动问答(接 baizhi 知识库 chat/completions)

type WechatOpenConfig

type WechatOpenConfig struct {
	AppID       string `mapstructure:"app_id"`
	AppSecret   string `mapstructure:"app_secret"`
	CallbackURL string `mapstructure:"callback_url"`
	Scope       string `mapstructure:"scope"`
	Debug       bool   `mapstructure:"debug"`
}

WechatOpenConfig 微信开放平台配置 - 用于网站扫码登录

Jump to

Keyboard shortcuts

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