🔧 refactor(auth, channel, context): improve context setup and validation for multi-key channels
This commit is contained in:
@@ -4,8 +4,11 @@ import "one-api/common"
|
||||
|
||||
func GetModelRegion(other string, localModelName string) string {
|
||||
// if other is json string
|
||||
if common.IsJsonStr(other) {
|
||||
m := common.StrToMap(other)
|
||||
if common.IsJsonObject(other) {
|
||||
m, err := common.StrToMap(other)
|
||||
if err != nil {
|
||||
return other // return original if parsing fails
|
||||
}
|
||||
if m[localModelName] != nil {
|
||||
return m[localModelName].(string)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user