Documentation
¶
Index ¶
- Constants
- func GetGeminiSafetySetting(key string) string
- func GetGeminiVersionSetting(key string) string
- func IsGeminiModelSupportImagine(model string) bool
- func IsSyncImageModel(model string) bool
- func ShouldPreserveThinkingSuffix(modelName string) bool
- func ValidateClaudeDefaultMaxTokens(value string) error
- func ValidateClaudeThinkingAdapterBudgetTokensPercentage(value float64) error
- func ValidateGeminiSafetySettings(value string) error
- func ValidateGeminiThinkingAdapterBudgetTokensPercentage(value float64) error
- type ChatCompletionsToResponsesPolicy
- type ClaudeSettings
- type GeminiSettings
- type GlobalSettings
- type GrokSettings
- type QwenSettings
Constants ¶
const ClaudeDefaultMaxTokens = 8192
ClaudeDefaultMaxTokens is supplied to request snapshots when the persisted configuration has no default entry. It is never written back implicitly.
const ClaudeMaxTokensLimit = math.MaxInt32 / 2
ClaudeMaxTokensLimit matches the request-side billing bound. Defaults are injected after request validation, so they need the same upper limit.
Variables ¶
This section is empty.
Functions ¶
func GetGeminiSafetySetting ¶
GetGeminiSafetySetting 获取安全设置
func GetGeminiVersionSetting ¶
GetGeminiVersionSetting 获取版本设置
func ShouldPreserveThinkingSuffix ¶
ShouldPreserveThinkingSuffix 判断模型是否配置为保留 thinking/-nothinking/-low/-high/-medium 后缀
func ValidateClaudeDefaultMaxTokens ¶
ValidateClaudeDefaultMaxTokens validates the JSON persisted by the option API. Zero stays allowed — the current Messages API accepts max_tokens: 0 as cache pre-warming — but negative values are rejected because they would wrap into huge unsigned values during request conversion.
func ValidateClaudeThinkingAdapterBudgetTokensPercentage ¶
ValidateClaudeThinkingAdapterBudgetTokensPercentage validates the fraction used to derive thinking budget_tokens. Restricting it to (0,1] keeps the derived budget finite, non-negative, and no larger than max_tokens.
func ValidateGeminiSafetySettings ¶
ValidateGeminiSafetySettings validates the JSON persisted by the option API. Empty values remain valid because read-time fallback returns the default.
func ValidateGeminiThinkingAdapterBudgetTokensPercentage ¶
ValidateGeminiThinkingAdapterBudgetTokensPercentage keeps the derived thinking budget finite and within the range accepted by the settings UI.
Types ¶
type ChatCompletionsToResponsesPolicy ¶
type ChatCompletionsToResponsesPolicy struct {
Enabled bool `json:"enabled"`
AllChannels bool `json:"all_channels"`
ChannelIDs []int `json:"channel_ids,omitempty"`
ChannelTypes []int `json:"channel_types,omitempty"`
ModelPatterns []string `json:"model_patterns,omitempty"`
}
func (ChatCompletionsToResponsesPolicy) IsChannelEnabled ¶
func (p ChatCompletionsToResponsesPolicy) IsChannelEnabled(channelID int, channelType int) bool
type ClaudeSettings ¶
type ClaudeSettings struct {
HeadersSettings map[string]map[string][]string `json:"model_headers_settings"`
DefaultMaxTokens map[string]int `json:"default_max_tokens"`
ThinkingAdapterEnabled bool `json:"thinking_adapter_enabled"`
ThinkingAdapterBudgetTokensPercentage float64 `json:"thinking_adapter_budget_tokens_percentage"`
}
ClaudeSettings 定义Claude模型的配置
func (*ClaudeSettings) GetDefaultMaxTokens ¶
func (c *ClaudeSettings) GetDefaultMaxTokens(model string) int
func (*ClaudeSettings) WriteHeaders ¶
func (c *ClaudeSettings) WriteHeaders(originModel string, httpHeader *http.Header)
type GeminiSettings ¶
type GeminiSettings struct {
SafetySettings map[string]string `json:"safety_settings"`
VersionSettings map[string]string `json:"version_settings"`
SupportedImagineModels []string `json:"supported_imagine_models"`
ThinkingAdapterEnabled bool `json:"thinking_adapter_enabled"`
ThinkingAdapterBudgetTokensPercentage float64 `json:"thinking_adapter_budget_tokens_percentage"`
FunctionCallThoughtSignatureEnabled bool `json:"function_call_thought_signature_enabled"`
RemoveFunctionResponseIdEnabled bool `json:"remove_function_response_id_enabled"`
}
GeminiSettings defines Gemini model configuration. 注意bool要以enabled结尾才可以生效编辑
func (GeminiSettings) SafetySetting ¶
func (settings GeminiSettings) SafetySetting(key string) string
SafetySetting returns the effective safety threshold from this settings snapshot. Empty exact/default values retain the legacy fallback to OFF.
func (GeminiSettings) SupportsImagine ¶
func (settings GeminiSettings) SupportsImagine(model string) bool
SupportsImagine reports whether this settings snapshot enables the model's image capability using the legacy exact-match rule.
type GlobalSettings ¶
type GlobalSettings struct {
PassThroughRequestEnabled bool `json:"pass_through_request_enabled"`
ThinkingModelBlacklist []string `json:"thinking_model_blacklist"`
ChatCompletionsToResponsesPolicy ChatCompletionsToResponsesPolicy `json:"chat_completions_to_responses_policy"`
}
func GetGlobalSettings ¶
func GetGlobalSettings() *GlobalSettings
func (GlobalSettings) ShouldPreserveThinkingSuffix ¶
func (settings GlobalSettings) ShouldPreserveThinkingSuffix(modelName string) bool
ShouldPreserveThinkingSuffix reports whether this settings snapshot keeps the model's thinking suffix using the existing exact-match rule.
type GrokSettings ¶
type GrokSettings struct {
ViolationDeductionEnabled bool `json:"violation_deduction_enabled"`
ViolationDeductionAmount float64 `json:"violation_deduction_amount"`
}
GrokSettings defines Grok model configuration.
func GetGrokSettings ¶
func GetGrokSettings() *GrokSettings
type QwenSettings ¶
type QwenSettings struct {
SyncImageModels []string `json:"sync_image_models"`
}
QwenSettings defines Qwen model configuration. 注意bool要以enabled结尾才可以生效编辑