MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / toInt

Function toInt

agent/app/service/agents_utils.go:1535–1552  ·  view source on GitHub ↗
(value interface{})

Source from the content-addressed store, hash-verified

1533}
1534
1535func toInt(value interface{}) int {
1536 switch v := value.(type) {
1537 case int:
1538 return v
1539 case int64:
1540 return int(v)
1541 case float64:
1542 return int(v)
1543 case string:
1544 if v == "" {
1545 return 0
1546 }
1547 parsed, _ := strconv.Atoi(v)
1548 return parsed
1549 default:
1550 return 0
1551 }
1552}
1553
1554func normalizeCustomModel(modelName string) string {
1555 trim := strings.TrimSpace(modelName)

Callers 1

buildAgentItemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected