Spaces:
Running
Running
update glm 4.7
Browse files- backend_api.py +3 -2
- backend_models.py +4 -0
- backend_parsers.py +2 -2
- frontend/src/app/page.tsx +1 -1
- frontend/src/components/ControlPanel.tsx +1 -1
- frontend/src/components/LandingPage.tsx +6 -6
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.
|
|
|
|
| 102 |
{"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},
|
| 103 |
{"name": "DeepSeek V3", "id": "deepseek-ai/DeepSeek-V3", "description": "DeepSeek V3 - Fast model for code generation via HuggingFace Router with Novita provider", "supports_images": False},
|
| 104 |
{"name": "DeepSeek R1", "id": "deepseek-ai/DeepSeek-R1", "description": "DeepSeek R1 model for code generation via HuggingFace", "supports_images": False},
|
|
@@ -190,7 +191,7 @@ async def startup_event():
|
|
| 190 |
class CodeGenerationRequest(BaseModel):
|
| 191 |
query: str
|
| 192 |
language: str = "html"
|
| 193 |
-
model_id: str = "zai-org/GLM-4.
|
| 194 |
provider: str = "auto"
|
| 195 |
history: List[List[str]] = []
|
| 196 |
agent_mode: bool = False
|
|
|
|
| 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 - Latest GLM model via HuggingFace (Default)", "supports_images": False},
|
| 102 |
+
{"name": "GLM-4.6", "id": "zai-org/GLM-4.6", "description": "GLM-4.6 model via HuggingFace with Cerebras provider", "supports_images": False},
|
| 103 |
{"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},
|
| 104 |
{"name": "DeepSeek V3", "id": "deepseek-ai/DeepSeek-V3", "description": "DeepSeek V3 - Fast model for code generation via HuggingFace Router with Novita provider", "supports_images": False},
|
| 105 |
{"name": "DeepSeek R1", "id": "deepseek-ai/DeepSeek-R1", "description": "DeepSeek R1 model for code generation via HuggingFace", "supports_images": False},
|
|
|
|
| 191 |
class CodeGenerationRequest(BaseModel):
|
| 192 |
query: str
|
| 193 |
language: str = "html"
|
| 194 |
+
model_id: str = "zai-org/GLM-4.7"
|
| 195 |
provider: str = "auto"
|
| 196 |
history: List[List[str]] = []
|
| 197 |
agent_mode: bool = False
|
backend_models.py
CHANGED
|
@@ -95,6 +95,10 @@ def get_real_model_id(model_id: str) -> str:
|
|
| 95 |
# GLM-4.5 needs fireworks-ai provider
|
| 96 |
return "zai-org/GLM-4.5:fireworks-ai"
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
return model_id
|
| 99 |
|
| 100 |
|
|
|
|
| 95 |
# GLM-4.5 needs fireworks-ai provider
|
| 96 |
return "zai-org/GLM-4.5:fireworks-ai"
|
| 97 |
|
| 98 |
+
elif model_id == "zai-org/GLM-4.7":
|
| 99 |
+
# GLM-4.7 needs zai-org provider suffix
|
| 100 |
+
return "zai-org/GLM-4.7:zai-org"
|
| 101 |
+
|
| 102 |
return model_id
|
| 103 |
|
| 104 |
|
backend_parsers.py
CHANGED
|
@@ -371,8 +371,8 @@ def generate_requirements_txt_with_llm(import_statements):
|
|
| 371 |
|
| 372 |
# Use a lightweight model for this task
|
| 373 |
try:
|
| 374 |
-
client = get_inference_client("zai-org/GLM-4.
|
| 375 |
-
actual_model_id = get_real_model_id("zai-org/GLM-4.
|
| 376 |
|
| 377 |
imports_text = '\n'.join(import_statements)
|
| 378 |
|
|
|
|
| 371 |
|
| 372 |
# Use a lightweight model for this task
|
| 373 |
try:
|
| 374 |
+
client = get_inference_client("zai-org/GLM-4.7", "auto")
|
| 375 |
+
actual_model_id = get_real_model_id("zai-org/GLM-4.7")
|
| 376 |
|
| 377 |
imports_text = '\n'.join(import_statements)
|
| 378 |
|
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.
|
| 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');
|
| 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 |
-
{model.id === 'zai-org/GLM-4.
|
| 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 |
+
{model.id === 'zai-org/GLM-4.7' && (
|
| 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.
|
| 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.
|
| 517 |
-
onStart(redesignPrompt, result.language || 'html', 'zai-org/GLM-4.
|
| 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.
|
| 562 |
-
onStart(redesignPrompt, result.language || 'html', 'zai-org/GLM-4.
|
| 563 |
}
|
| 564 |
|
| 565 |
console.log('[Redesign] Will create PR after code generation completes');
|
|
@@ -833,7 +833,7 @@ Note: After generating the redesign, I will create a Pull Request on the origina
|
|
| 833 |
>
|
| 834 |
<div className="flex items-center justify-between gap-2">
|
| 835 |
<span className="text-xs font-medium text-[#f5f5f7]">{model.name}</span>
|
| 836 |
-
{model.id === 'zai-org/GLM-4.
|
| 837 |
<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">
|
| 838 |
NEW
|
| 839 |
</span>
|
|
|
|
| 31 |
onImport,
|
| 32 |
isAuthenticated,
|
| 33 |
initialLanguage = 'html',
|
| 34 |
+
initialModel = 'zai-org/GLM-4.7',
|
| 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 for redesign');
|
| 517 |
+
onStart(redesignPrompt, result.language || 'html', 'zai-org/GLM-4.7', 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 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');
|
|
|
|
| 833 |
>
|
| 834 |
<div className="flex items-center justify-between gap-2">
|
| 835 |
<span className="text-xs font-medium text-[#f5f5f7]">{model.name}</span>
|
| 836 |
+
{model.id === 'zai-org/GLM-4.7' && (
|
| 837 |
<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">
|
| 838 |
NEW
|
| 839 |
</span>
|