akhaliq HF Staff commited on
Commit
b56b320
·
1 Parent(s): de06d8a

add qwen 3 coder next

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": "Kimi-K2.5 🧠", "id": "moonshotai/Kimi-K2.5", "description": "Kimi-K2.5 - New powerful reasoning model via HuggingFace Router with Novita provider (Default)", "supports_images": True},
 
104
  {"name": "GLM-4.7-Flash ⚡", "id": "zai-org/GLM-4.7-Flash", "description": "GLM-4.7-Flash - Ultra-fast GLM model via HuggingFace Router with Novita provider", "supports_images": False},
105
  {"name": "GLM-4.7", "id": "zai-org/GLM-4.7", "description": "GLM-4.7 - Latest GLM model via HuggingFace Router with Cerebras provider", "supports_images": False},
106
  {"name": "MiniMax M2.1", "id": "MiniMaxAI/MiniMax-M2.1", "description": "MiniMax M2.1 - Enhanced model via HuggingFace Router", "supports_images": False},
@@ -196,7 +197,7 @@ async def startup_event():
196
  class CodeGenerationRequest(BaseModel):
197
  query: str
198
  language: str = "html"
199
- model_id: str = "moonshotai/Kimi-K2.5"
200
  provider: str = "auto"
201
  history: List[List[str]] = []
202
  agent_mode: bool = False
 
100
 
101
  # Define models and languages here to avoid importing Gradio UI
102
  AVAILABLE_MODELS = [
103
+ {"name": "Qwen3-Coder-Next 🤖", "id": "Qwen/Qwen3-Coder-Next", "description": "Qwen3-Coder-Next - Latest powerful coder model via HuggingFace Router with Novita provider (Default)", "supports_images": False},
104
+ {"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},
105
  {"name": "GLM-4.7-Flash ⚡", "id": "zai-org/GLM-4.7-Flash", "description": "GLM-4.7-Flash - Ultra-fast GLM model via HuggingFace Router with Novita provider", "supports_images": False},
106
  {"name": "GLM-4.7", "id": "zai-org/GLM-4.7", "description": "GLM-4.7 - Latest GLM model via HuggingFace Router with Cerebras provider", "supports_images": False},
107
  {"name": "MiniMax M2.1", "id": "MiniMaxAI/MiniMax-M2.1", "description": "MiniMax M2.1 - Enhanced model via HuggingFace Router", "supports_images": False},
 
197
  class CodeGenerationRequest(BaseModel):
198
  query: str
199
  language: str = "html"
200
+ model_id: str = "Qwen/Qwen3-Coder-Next"
201
  provider: str = "auto"
202
  history: List[List[str]] = []
203
  agent_mode: bool = False
backend_models.py CHANGED
@@ -61,6 +61,14 @@ def get_inference_client(model_id: str, provider: str = "auto"):
61
  default_headers={"X-HF-Bill-To": "huggingface"}
62
  )
63
 
 
 
 
 
 
 
 
 
64
  else:
65
  # Unknown model - try HuggingFace Inference API
66
  return OpenAI(
@@ -107,6 +115,10 @@ def get_real_model_id(model_id: str) -> str:
107
  # Kimi K2.5 needs Novita provider
108
  return "moonshotai/Kimi-K2.5:novita"
109
 
 
 
 
 
110
  return model_id
111
 
112
 
 
61
  default_headers={"X-HF-Bill-To": "huggingface"}
62
  )
63
 
64
+ elif model_id.startswith("Qwen/Qwen3-Coder-Next"):
65
+ # Qwen models via HuggingFace Router
66
+ return OpenAI(
67
+ base_url="https://router.huggingface.co/v1",
68
+ api_key=os.getenv("HF_TOKEN"),
69
+ default_headers={"X-HF-Bill-To": "huggingface"}
70
+ )
71
+
72
  else:
73
  # Unknown model - try HuggingFace Inference API
74
  return OpenAI(
 
115
  # Kimi K2.5 needs Novita provider
116
  return "moonshotai/Kimi-K2.5:novita"
117
 
118
+ elif model_id == "Qwen/Qwen3-Coder-Next":
119
+ # Qwen3-Coder-Next needs Novita provider
120
+ return "Qwen/Qwen3-Coder-Next:novita"
121
+
122
  return model_id
123
 
124
 
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('moonshotai/Kimi-K2.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-Coder-Next');
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
- {['moonshotai/Kimi-K2.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-Coder-Next'].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 = 'moonshotai/Kimi-K2.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 Kimi-K2.5 for redesign');
518
- onStart(redesignPrompt, result.language || 'html', 'moonshotai/Kimi-K2.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 Kimi-K2.5 for redesign');
563
- onStart(redesignPrompt, result.language || 'html', 'moonshotai/Kimi-K2.5', undefined, repoId, true); // Pass true for shouldCreatePR
564
  }
565
 
566
  console.log('[Redesign] Will create PR after code generation completes');
@@ -834,7 +834,7 @@ Note: After generating the redesign, I will create a Pull Request on the origina
834
  >
835
  <div className="flex items-center justify-between gap-2">
836
  <span className="text-xs font-medium text-[#f5f5f7]">{model.name}</span>
837
- {model.id === 'moonshotai/Kimi-K2.5' && (
838
  <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">
839
  NEW
840
  </span>
 
31
  onImport,
32
  isAuthenticated,
33
  initialLanguage = 'html',
34
+ initialModel = 'Qwen/Qwen3-Coder-Next',
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-Coder-Next for redesign');
518
+ onStart(redesignPrompt, result.language || 'html', 'Qwen/Qwen3-Coder-Next', 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-Coder-Next for redesign');
563
+ onStart(redesignPrompt, result.language || 'html', 'Qwen/Qwen3-Coder-Next', undefined, repoId, true); // Pass true for shouldCreatePR
564
  }
565
 
566
  console.log('[Redesign] Will create PR after code generation completes');
 
834
  >
835
  <div className="flex items-center justify-between gap-2">
836
  <span className="text-xs font-medium text-[#f5f5f7]">{model.name}</span>
837
+ {model.id === 'Qwen/Qwen3-Coder-Next' && (
838
  <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">
839
  NEW
840
  </span>