Documentation
¶
Index ¶
- Constants
- func APIKeys(value string) []string
- func ModelList(value string) []string
- func ParseAPIKeyAccounts(value string, apiKeys string) (map[string][]string, error)
- func ParseFirstEventHedge(value string) (bool, time.Duration, error)
- func ParseModelChannels(value string) (map[string]string, error)
- func ProxyList(value string) []string
- func ValidateProxy(value string) error
- type Config
- type InvalidValue
- type ModelAlias
Constants ¶
const DefaultContinuationPrompt = "Continue the assistant response after the following prefix. Return only the continuation, without repeating the prefix."
DefaultContinuationPrompt 是 CONTINUATION_PROMPT 未设置时改写末尾 assistant 轮所用的续写提示词
const DefaultFirstEventHedgeModels = "gemini-4-argon"
DefaultFirstEventHedgeModels 是 FIRST_EVENT_HEDGE_MODELS 的默认值
const FirstEventHedgeAuto = "auto"
FirstEventHedgeAuto 表示按模型与通道近期原请求首事件等待的 p95 发起备用请求
const FirstEventHedgeOff = "off"
FirstEventHedgeOff 表示首事件超时不发起备用请求
const LogFileMB = 10
LogFileMB 是单个日志文件的轮转大小
const MediaOutputInline = "inline"
MediaOutputInline 表示 Chat 与 Messages 正文以 data URI 内联生成的媒体
const MediaOutputURL = "url"
MediaOutputURL 表示生成的媒体保存到本地,Chat 与 Messages 正文以 URL 引用
const WAABackendCamoufox = "camoufox"
WAABackendCamoufox 表示由 Camoufox 页面承担 WAA 生命周期
const WAABackendSpiderMonkey = "spidermonkey"
WAABackendSpiderMonkey 表示由进程内的 SpiderMonkey 承担 WAA 生命周期
Variables ¶
This section is empty.
Functions ¶
func ParseAPIKeyAccounts ¶ added in v0.2.19
ParseAPIKeyAccounts 解析逗号分隔的 API key:账户|账户,以最后一个冒号分隔,跳过不在 apiKeys 中的 key
func ParseFirstEventHedge ¶ added in v0.2.17
ParseFirstEventHedge 解析 FIRST_EVENT_HEDGE,返回是否按近期 p95 自适应与自定义的等待时长,off 时都为零值
func ParseModelChannels ¶ added in v0.2.14
ParseModelChannels 解析逗号分隔的 模型 ID:通道,返回每个模型限定使用的通道
Types ¶
type Config ¶
type Config struct {
AutoStart bool
RequestBodyLog bool
LogFile bool
LogMaxTotalMB int
AdminAuthEnabled bool
AdminUsername string
AdminPassword string
BuildNativeNonstream bool
NonstreamKeepalive bool
FakeStream bool
YouTubeLinks bool
StripThoughtSignatures bool
SearchModelAliases bool
GoogleSearch bool
FirstEventHedge string
FirstEventHedgeModels string
ContinuationRewrite bool
ContinuationPrompt string
AuthStates string
ListenAddr string
PreviewListenAddr string
ProxyAPIKey string
APIKeyAccounts string
Proxy string
InitTimeout time.Duration
RequestTimeout time.Duration
WarmWorkerLimit int
MaxActiveWorkers int
WarmStartupConcurrency int
PerAccountConcurrency int
RoutingStrategy string
UpstreamChannels []string
ModelMapping string
ModelChannels string
WAABackend string
MediaOutput string
MediaBaseURL string
// Invalid 是加载时取值无效、改用默认值的配置项
Invalid []InvalidValue
// Environment 是取自进程环境变量、覆盖 .env 的配置键
Environment []string
}
Config 保存服务的全局配置
func (Config) KeepEnvironment ¶ added in v0.2.19
KeepEnvironment 返回把进程环境变量决定的项及其无效记录取 saved 中的值后的配置
type InvalidValue ¶ added in v0.2.19
InvalidValue 是加载时取值无效、改用默认值的配置项
type ModelAlias ¶ added in v0.2.11
ModelAlias 表示客户端模型名到目录模型 ID 的一项映射
func ParseModelMapping ¶ added in v0.2.11
func ParseModelMapping(value string) ([]ModelAlias, error)
ParseModelMapping 解析逗号分隔的 别名:模型 ID,别名可含冒号,以最后一个冒号分隔