relay-vertex.go 412 B

12345678910111213141516171819
  1. package vertex
  2. import "one-api/common"
  3. func GetModelRegion(other string, localModelName string) string {
  4. // if other is json string
  5. if common.IsJsonObject(other) {
  6. m, err := common.StrToMap(other)
  7. if err != nil {
  8. return other // return original if parsing fails
  9. }
  10. if m[localModelName] != nil {
  11. return m[localModelName].(string)
  12. } else {
  13. return m["default"].(string)
  14. }
  15. }
  16. return other
  17. }