mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-14 23:00:27 +00:00
feat: Handle errors, validate model names, and calculate quota usage (#978)
- Improved error handling in various modules for better stability and responsiveness. - Optimized code in several files for improved efficiency and readability. - Enhanced user experience by providing more detailed error responses in the controller. - Strengthened security by ignoring sensitive files in `.gitignore`.
This commit is contained in:
@@ -107,13 +107,13 @@ func Seconds2Time(num int) (time string) {
|
||||
}
|
||||
|
||||
func Interface2String(inter interface{}) string {
|
||||
switch inter.(type) {
|
||||
switch inter := inter.(type) {
|
||||
case string:
|
||||
return inter.(string)
|
||||
return inter
|
||||
case int:
|
||||
return fmt.Sprintf("%d", inter.(int))
|
||||
return fmt.Sprintf("%d", inter)
|
||||
case float64:
|
||||
return fmt.Sprintf("%f", inter.(float64))
|
||||
return fmt.Sprintf("%f", inter)
|
||||
}
|
||||
return "Not Implemented"
|
||||
}
|
||||
|
Reference in New Issue
Block a user