mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-20 15:06:36 +00:00
Resolved conflicts: - VERSION: set to 0.1.106.1 - wire_gen.go: keep our version with accountUsageService - antigravity_gateway_service.go: keep accountUsageService field/param - openai_gateway_service.go: keep billing model override logic - account.go: keep both affinity methods and new custom base URL methods - dto/types.go: keep both affinity fields and new custom base URL fields - CreateAccountModal.vue: keep both affinity and custom base URL logic - EditAccountModal.vue: keep both affinity and custom base URL state
36 lines
802 B
Go
36 lines
802 B
Go
package service
|
|
|
|
import "strings"
|
|
|
|
func optionalTrimmedStringPtr(raw string) *string {
|
|
trimmed := strings.TrimSpace(raw)
|
|
if trimmed == "" {
|
|
return nil
|
|
}
|
|
return &trimmed
|
|
}
|
|
|
|
// optionalNonEqualStringPtr returns a pointer to value if it is non-empty and
|
|
// differs from compare; otherwise nil. Used to store upstream_model only when
|
|
// it differs from the requested model.
|
|
func optionalNonEqualStringPtr(value, compare string) *string {
|
|
if value == "" || value == compare {
|
|
return nil
|
|
}
|
|
return &value
|
|
}
|
|
|
|
func forwardResultBillingModel(requestedModel, upstreamModel string) string {
|
|
if trimmed := strings.TrimSpace(requestedModel); trimmed != "" {
|
|
return trimmed
|
|
}
|
|
return strings.TrimSpace(upstreamModel)
|
|
}
|
|
|
|
func optionalInt64Ptr(v int64) *int64 {
|
|
if v == 0 {
|
|
return nil
|
|
}
|
|
return &v
|
|
}
|