| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package service
- import "strings"
- func optionalTrimmedStringPtr(raw string) *string {
- trimmed := strings.TrimSpace(raw)
- if trimmed == "" {
- return nil
- }
- return &trimmed
- }
- func optionalStringValue(value *string) string {
- if value == nil {
- return ""
- }
- return strings.TrimSpace(*value)
- }
- // coalesceRequestedReasoningEffort prefers the client-requested value and falls
- // back to the effective/forwarded effort for historical or unmapped rows.
- func coalesceRequestedReasoningEffort(requested, forwarded *string) *string {
- if trimmed := optionalStringValue(requested); trimmed != "" {
- return &trimmed
- }
- if trimmed := optionalStringValue(forwarded); trimmed != "" {
- return &trimmed
- }
- return nil
- }
- 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
- }
|