qwen.go 1023 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package model_setting
  2. import (
  3. "strings"
  4. "github.com/QuantumNous/new-api/setting/config"
  5. )
  6. // QwenSettings defines Qwen model configuration. 注意bool要以enabled结尾才可以生效编辑
  7. type QwenSettings struct {
  8. SyncImageModels []string `json:"sync_image_models"`
  9. }
  10. // 默认配置
  11. var defaultQwenSettings = QwenSettings{
  12. SyncImageModels: []string{
  13. "z-image",
  14. "qwen-image",
  15. "wan2.6",
  16. "qwen-image-edit",
  17. "qwen-image-edit-max",
  18. "qwen-image-edit-max-2026-01-16",
  19. "qwen-image-edit-plus",
  20. "qwen-image-edit-plus-2025-12-15",
  21. "qwen-image-edit-plus-2025-10-30",
  22. },
  23. }
  24. // 全局实例
  25. var qwenSettings = defaultQwenSettings
  26. func init() {
  27. // 注册到全局配置管理器
  28. config.GlobalConfig.Register("qwen", &qwenSettings)
  29. }
  30. // GetQwenSettings
  31. func GetQwenSettings() *QwenSettings {
  32. return &qwenSettings
  33. }
  34. // IsSyncImageModel
  35. func IsSyncImageModel(model string) bool {
  36. for _, m := range qwenSettings.SyncImageModels {
  37. if strings.Contains(model, m) {
  38. return true
  39. }
  40. }
  41. return false
  42. }