feat: implement AI gateway phase one runtime

This commit is contained in:
2026-05-09 21:18:32 +08:00
parent a5e66e79cd
commit fdcdcd477b
46 changed files with 5678 additions and 768 deletions
+40
View File
@@ -0,0 +1,40 @@
package runner
import (
"math"
"strings"
)
func stringFromMap(values map[string]any, key string) string {
value, _ := values[key].(string)
return strings.TrimSpace(value)
}
func boolFromMap(values map[string]any, key string) bool {
value, _ := values[key].(bool)
return value
}
func intFromPolicy(values map[string]any, key string) int {
switch value := values[key].(type) {
case int:
return value
case float64:
return int(math.Round(value))
default:
return 0
}
}
func floatFromAny(value any) float64 {
switch typed := value.(type) {
case int:
return float64(typed)
case int64:
return float64(typed)
case float64:
return typed
default:
return 0
}
}