Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
29 lines
743 B
Go
29 lines
743 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 trimmedUpstream := strings.TrimSpace(upstreamModel); trimmedUpstream != "" {
|
|
return trimmedUpstream
|
|
}
|
|
return strings.TrimSpace(requestedModel)
|
|
}
|