Spaces:
Running
Running
add glm flash model
Browse files- backend_api.py +3 -2
- backend_models.py +4 -0
- frontend/src/app/page.tsx +1 -1
- frontend/src/components/ControlPanel.tsx +1 -1
- frontend/src/components/LandingPage.tsx +5 -5
backend_api.py
CHANGED
|
@@ -98,7 +98,8 @@ def get_cached_client(model_id: str, provider: str = "auto"):
|
|
| 98 |
|
| 99 |
# Define models and languages here to avoid importing Gradio UI
|
| 100 |
AVAILABLE_MODELS = [
|
| 101 |
-
{"name": "GLM-4.7", "id": "zai-org/GLM-4.7", "description": "GLM-4.7 -
|
|
|
|
| 102 |
{"name": "MiniMax M2.1", "id": "MiniMaxAI/MiniMax-M2.1", "description": "MiniMax M2.1 - Enhanced model via HuggingFace Router", "supports_images": False},
|
| 103 |
{"name": "GLM-4.6", "id": "zai-org/GLM-4.6", "description": "GLM-4.6 model via HuggingFace with Cerebras provider", "supports_images": False},
|
| 104 |
{"name": "GLM-4.6V 👁️", "id": "zai-org/GLM-4.6V:zai-org", "description": "GLM-4.6V vision model - supports image uploads for visual understanding", "supports_images": True},
|
|
@@ -192,7 +193,7 @@ async def startup_event():
|
|
| 192 |
class CodeGenerationRequest(BaseModel):
|
| 193 |
query: str
|
| 194 |
language: str = "html"
|
| 195 |
-
model_id: str = "zai-org/GLM-4.7"
|
| 196 |
provider: str = "auto"
|
| 197 |
history: List[List[str]] = []
|
| 198 |
agent_mode: bool = False
|
|
|
|
| 98 |
|
| 99 |
# Define models and languages here to avoid importing Gradio UI
|
| 100 |
AVAILABLE_MODELS = [
|
| 101 |
+
{"name": "GLM-4.7-Flash ⚡", "id": "zai-org/GLM-4.7-Flash", "description": "GLM-4.7-Flash - Ultra-fast GLM model via HuggingFace Router (Default)", "supports_images": False},
|
| 102 |
+
{"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},
|
| 103 |
{"name": "MiniMax M2.1", "id": "MiniMaxAI/MiniMax-M2.1", "description": "MiniMax M2.1 - Enhanced model via HuggingFace Router", "supports_images": False},
|
| 104 |
{"name": "GLM-4.6", "id": "zai-org/GLM-4.6", "description": "GLM-4.6 model via HuggingFace with Cerebras provider", "supports_images": False},
|
| 105 |
{"name": "GLM-4.6V 👁️", "id": "zai-org/GLM-4.6V:zai-org", "description": "GLM-4.6V vision model - supports image uploads for visual understanding", "supports_images": True},
|
|
|
|
| 193 |
class CodeGenerationRequest(BaseModel):
|
| 194 |
query: str
|
| 195 |
language: str = "html"
|
| 196 |
+
model_id: str = "zai-org/GLM-4.7-Flash"
|
| 197 |
provider: str = "auto"
|
| 198 |
history: List[List[str]] = []
|
| 199 |
agent_mode: bool = False
|
backend_models.py
CHANGED
|
@@ -99,6 +99,10 @@ def get_real_model_id(model_id: str) -> str:
|
|
| 99 |
# GLM-4.7 needs cerebras provider suffix
|
| 100 |
return "zai-org/GLM-4.7:cerebras"
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
return model_id
|
| 103 |
|
| 104 |
|
|
|
|
| 99 |
# GLM-4.7 needs cerebras provider suffix
|
| 100 |
return "zai-org/GLM-4.7:cerebras"
|
| 101 |
|
| 102 |
+
elif model_id == "zai-org/GLM-4.7-Flash":
|
| 103 |
+
# GLM-4.7-Flash via HuggingFace Router
|
| 104 |
+
return "zai-org/GLM-4.7-Flash"
|
| 105 |
+
|
| 106 |
return model_id
|
| 107 |
|
| 108 |
|
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('zai-org/GLM-4.7');
|
| 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('zai-org/GLM-4.7-Flash');
|
| 21 |
const [models, setModels] = useState<Model[]>([]);
|
| 22 |
const [isGenerating, setIsGenerating] = useState(false);
|
| 23 |
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
frontend/src/components/ControlPanel.tsx
CHANGED
|
@@ -196,7 +196,7 @@ export default function ControlPanel({
|
|
| 196 |
>
|
| 197 |
<div className="flex items-center justify-between gap-2">
|
| 198 |
<span className="text-sm text-[#f5f5f7]">{model.name}</span>
|
| 199 |
-
{
|
| 200 |
<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">
|
| 201 |
NEW
|
| 202 |
</span>
|
|
|
|
| 196 |
>
|
| 197 |
<div className="flex items-center justify-between gap-2">
|
| 198 |
<span className="text-sm text-[#f5f5f7]">{model.name}</span>
|
| 199 |
+
{['zai-org/GLM-4.7', 'zai-org/GLM-4.7-Flash'].includes(model.id) && (
|
| 200 |
<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">
|
| 201 |
NEW
|
| 202 |
</span>
|
frontend/src/components/LandingPage.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export default function LandingPage({
|
|
| 31 |
onImport,
|
| 32 |
isAuthenticated,
|
| 33 |
initialLanguage = 'html',
|
| 34 |
-
initialModel = 'zai-org/GLM-4.7',
|
| 35 |
onAuthChange,
|
| 36 |
setPendingPR,
|
| 37 |
pendingPRRef
|
|
@@ -513,8 +513,8 @@ ${isGradio ? '\n\nIMPORTANT: Only output app.py with the redesigned UI (themes,
|
|
| 513 |
if (onStart) {
|
| 514 |
// Pass duplicated space ID so auto-deploy updates it
|
| 515 |
console.log('[Redesign] Calling onStart with duplicated repo ID:', duplicatedRepoId);
|
| 516 |
-
console.log('[Redesign] Using GLM-4.7 for redesign');
|
| 517 |
-
onStart(redesignPrompt, result.language || 'html', 'zai-org/GLM-4.7', undefined, duplicatedRepoId);
|
| 518 |
}
|
| 519 |
}, 100);
|
| 520 |
|
|
@@ -558,8 +558,8 @@ Note: After generating the redesign, I will create a Pull Request on the origina
|
|
| 558 |
|
| 559 |
if (onStart) {
|
| 560 |
console.log('[Redesign] Will create PR - not passing repo ID');
|
| 561 |
-
console.log('[Redesign] Using GLM-4.7 for redesign');
|
| 562 |
-
onStart(redesignPrompt, result.language || 'html', 'zai-org/GLM-4.7', undefined, repoId, true); // Pass true for shouldCreatePR
|
| 563 |
}
|
| 564 |
|
| 565 |
console.log('[Redesign] Will create PR after code generation completes');
|
|
|
|
| 31 |
onImport,
|
| 32 |
isAuthenticated,
|
| 33 |
initialLanguage = 'html',
|
| 34 |
+
initialModel = 'zai-org/GLM-4.7-Flash',
|
| 35 |
onAuthChange,
|
| 36 |
setPendingPR,
|
| 37 |
pendingPRRef
|
|
|
|
| 513 |
if (onStart) {
|
| 514 |
// Pass duplicated space ID so auto-deploy updates it
|
| 515 |
console.log('[Redesign] Calling onStart with duplicated repo ID:', duplicatedRepoId);
|
| 516 |
+
console.log('[Redesign] Using GLM-4.7-Flash for redesign');
|
| 517 |
+
onStart(redesignPrompt, result.language || 'html', 'zai-org/GLM-4.7-Flash', undefined, duplicatedRepoId);
|
| 518 |
}
|
| 519 |
}, 100);
|
| 520 |
|
|
|
|
| 558 |
|
| 559 |
if (onStart) {
|
| 560 |
console.log('[Redesign] Will create PR - not passing repo ID');
|
| 561 |
+
console.log('[Redesign] Using GLM-4.7-Flash for redesign');
|
| 562 |
+
onStart(redesignPrompt, result.language || 'html', 'zai-org/GLM-4.7-Flash', undefined, repoId, true); // Pass true for shouldCreatePR
|
| 563 |
}
|
| 564 |
|
| 565 |
console.log('[Redesign] Will create PR after code generation completes');
|