akhaliq HF Staff commited on
Commit
a8915ad
·
1 Parent(s): 7d497a8

add new qwen model

Browse files
backend_api.py CHANGED
@@ -100,7 +100,8 @@ def get_cached_client(model_id: str, provider: str = "auto"):
100
 
101
  # Define models and languages here to avoid importing Gradio UI
102
  AVAILABLE_MODELS = [
103
- {"name": "MiniMax-M2.5 🤖", "id": "MiniMaxAI/MiniMax-M2.5", "description": "MiniMax-M2.5 - Latest powerful coder model via HuggingFace Router with fastest provider (Default)", "supports_images": False},
 
104
  {"name": "GLM-5 🧠", "id": "zai-org/GLM-5", "description": "GLM-5 - New powerful reasoning model via HuggingFace Router", "supports_images": False},
105
  {"name": "Qwen3-Coder-Next 🤖", "id": "Qwen/Qwen3-Coder-Next", "description": "Qwen3-Coder-Next - Latest powerful coder model via HuggingFace Router with Novita provider", "supports_images": False},
106
  {"name": "Kimi-K2.5 🧠", "id": "moonshotai/Kimi-K2.5", "description": "Kimi-K2.5 - New powerful reasoning model via HuggingFace Router with Novita provider", "supports_images": True},
@@ -199,7 +200,7 @@ async def startup_event():
199
  class CodeGenerationRequest(BaseModel):
200
  query: str
201
  language: str = "html"
202
- model_id: str = "MiniMaxAI/MiniMax-M2.5"
203
  provider: str = "auto"
204
  history: List[List[str]] = []
205
  agent_mode: bool = False
 
100
 
101
  # Define models and languages here to avoid importing Gradio UI
102
  AVAILABLE_MODELS = [
103
+ {"name": "Qwen3.5-397B 🤖", "id": "Qwen/Qwen3.5-397B-A17B", "description": "Qwen3.5-397B-A17B - Latest powerful model via HuggingFace Router (Default)", "supports_images": True},
104
+ {"name": "MiniMax-M2.5 🤖", "id": "MiniMaxAI/MiniMax-M2.5", "description": "MiniMax-M2.5 - Latest powerful coder model via HuggingFace Router with fastest provider", "supports_images": False},
105
  {"name": "GLM-5 🧠", "id": "zai-org/GLM-5", "description": "GLM-5 - New powerful reasoning model via HuggingFace Router", "supports_images": False},
106
  {"name": "Qwen3-Coder-Next 🤖", "id": "Qwen/Qwen3-Coder-Next", "description": "Qwen3-Coder-Next - Latest powerful coder model via HuggingFace Router with Novita provider", "supports_images": False},
107
  {"name": "Kimi-K2.5 🧠", "id": "moonshotai/Kimi-K2.5", "description": "Kimi-K2.5 - New powerful reasoning model via HuggingFace Router with Novita provider", "supports_images": True},
 
200
  class CodeGenerationRequest(BaseModel):
201
  query: str
202
  language: str = "html"
203
+ model_id: str = "Qwen/Qwen3.5-397B-A17B"
204
  provider: str = "auto"
205
  history: List[List[str]] = []
206
  agent_mode: bool = False
backend_models.py CHANGED
@@ -69,6 +69,14 @@ def get_inference_client(model_id: str, provider: str = "auto"):
69
  default_headers={"X-HF-Bill-To": "huggingface"}
70
  )
71
 
 
 
 
 
 
 
 
 
72
  else:
73
  # Unknown model - try HuggingFace Inference API
74
  return OpenAI(
@@ -127,6 +135,10 @@ def get_real_model_id(model_id: str) -> str:
127
  # Qwen3-Coder-Next needs Novita provider
128
  return "Qwen/Qwen3-Coder-Next:novita"
129
 
 
 
 
 
130
  return model_id
131
 
132
 
 
69
  default_headers={"X-HF-Bill-To": "huggingface"}
70
  )
71
 
72
+ elif model_id.startswith("Qwen/Qwen3.5"):
73
+ # Qwen 3.5 models via HuggingFace Router
74
+ return OpenAI(
75
+ base_url="https://router.huggingface.co/v1",
76
+ api_key=os.getenv("HF_TOKEN"),
77
+ default_headers={"X-HF-Bill-To": "huggingface"}
78
+ )
79
+
80
  else:
81
  # Unknown model - try HuggingFace Inference API
82
  return OpenAI(
 
135
  # Qwen3-Coder-Next needs Novita provider
136
  return "Qwen/Qwen3-Coder-Next:novita"
137
 
138
+ elif model_id == "Qwen/Qwen3.5-397B-A17B":
139
+ # Qwen3.5-397B-A17B needs fastest provider
140
+ return "Qwen/Qwen3.5-397B-A17B:fastest"
141
+
142
  return model_id
143
 
144
 
frontend/src/app/page.tsx CHANGED
@@ -17,7 +17,7 @@ export default function Home() {
17
 
18
  const [generatedCode, setGeneratedCode] = useState('');
19
  const [selectedLanguage, setSelectedLanguage] = useState<Language>('html');
20
- const [selectedModel, setSelectedModel] = useState('MiniMaxAI/MiniMax-M2.5');
21
  const [models, setModels] = useState<Model[]>([]);
22
  const [isGenerating, setIsGenerating] = useState(false);
23
  const [isAuthenticated, setIsAuthenticated] = useState(false);
 
17
 
18
  const [generatedCode, setGeneratedCode] = useState('');
19
  const [selectedLanguage, setSelectedLanguage] = useState<Language>('html');
20
+ const [selectedModel, setSelectedModel] = useState('Qwen/Qwen3.5-397B-A17B');
21
  const [models, setModels] = useState<Model[]>([]);
22
  const [isGenerating, setIsGenerating] = useState(false);
23
  const [isAuthenticated, setIsAuthenticated] = useState(false);
frontend/src/components/ControlPanel.tsx CHANGED
@@ -197,7 +197,7 @@ export default function ControlPanel({
197
  >
198
  <div className="flex items-center justify-between gap-2">
199
  <span className="text-sm text-[#f5f5f7]">{model.name}</span>
200
- {['MiniMaxAI/MiniMax-M2.5'].includes(model.id) && (
201
  <span className="px-1.5 py-0.5 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[9px] font-bold rounded uppercase flex-shrink-0">
202
  NEW
203
  </span>
 
197
  >
198
  <div className="flex items-center justify-between gap-2">
199
  <span className="text-sm text-[#f5f5f7]">{model.name}</span>
200
+ {['Qwen/Qwen3.5-397B-A17B', 'MiniMaxAI/MiniMax-M2.5'].includes(model.id) && (
201
  <span className="px-1.5 py-0.5 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[9px] font-bold rounded uppercase flex-shrink-0">
202
  NEW
203
  </span>
frontend/src/components/LandingPage.tsx CHANGED
@@ -31,7 +31,7 @@ export default function LandingPage({
31
  onImport,
32
  isAuthenticated,
33
  initialLanguage = 'html',
34
- initialModel = 'MiniMaxAI/MiniMax-M2.5',
35
  onAuthChange,
36
  setPendingPR,
37
  pendingPRRef
@@ -514,8 +514,8 @@ ${isGradio ? '\n\nIMPORTANT: Only output app.py with the redesigned UI (themes,
514
  if (onStart) {
515
  // Pass duplicated space ID so auto-deploy updates it
516
  console.log('[Redesign] Calling onStart with duplicated repo ID:', duplicatedRepoId);
517
- console.log('[Redesign] Using MiniMaxAI/MiniMax-M2.5 for redesign');
518
- onStart(redesignPrompt, result.language || 'html', 'MiniMaxAI/MiniMax-M2.5', undefined, duplicatedRepoId);
519
  }
520
  }, 100);
521
 
@@ -559,8 +559,8 @@ Note: After generating the redesign, I will create a Pull Request on the origina
559
 
560
  if (onStart) {
561
  console.log('[Redesign] Will create PR - not passing repo ID');
562
- console.log('[Redesign] Using MiniMaxAI/MiniMax-M2.5 for redesign');
563
- onStart(redesignPrompt, result.language || 'html', 'MiniMaxAI/MiniMax-M2.5', undefined, repoId, true); // Pass true for shouldCreatePR
564
  }
565
 
566
  console.log('[Redesign] Will create PR after code generation completes');
 
31
  onImport,
32
  isAuthenticated,
33
  initialLanguage = 'html',
34
+ initialModel = 'Qwen/Qwen3.5-397B-A17B',
35
  onAuthChange,
36
  setPendingPR,
37
  pendingPRRef
 
514
  if (onStart) {
515
  // Pass duplicated space ID so auto-deploy updates it
516
  console.log('[Redesign] Calling onStart with duplicated repo ID:', duplicatedRepoId);
517
+ console.log('[Redesign] Using Qwen/Qwen3.5-397B-A17B for redesign');
518
+ onStart(redesignPrompt, result.language || 'html', 'Qwen/Qwen3.5-397B-A17B', undefined, duplicatedRepoId);
519
  }
520
  }, 100);
521
 
 
559
 
560
  if (onStart) {
561
  console.log('[Redesign] Will create PR - not passing repo ID');
562
+ console.log('[Redesign] Using Qwen/Qwen3.5-397B-A17B for redesign');
563
+ onStart(redesignPrompt, result.language || 'html', 'Qwen/Qwen3.5-397B-A17B', undefined, repoId, true); // Pass true for shouldCreatePR
564
  }
565
 
566
  console.log('[Redesign] Will create PR after code generation completes');