relay-vertex.go 483 B

12345678910111213141516171819202122
  1. package vertex
  2. import "github.com/QuantumNous/new-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. if v, ok := m["default"]; ok {
  14. return v.(string)
  15. }
  16. return "global"
  17. }
  18. }
  19. return other
  20. }