Spaces:
Running
Running
fix
Browse files- backend_deploy.py +10 -1
- frontend/src/app/page.tsx +2 -2
backend_deploy.py
CHANGED
|
@@ -444,11 +444,20 @@ def extract_space_id_from_history(history: Optional[List], username: Optional[st
|
|
| 444 |
|
| 445 |
# Check assistant messages for deployment confirmations
|
| 446 |
if role == 'assistant':
|
| 447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 448 |
# Look for space URL pattern
|
| 449 |
match = re.search(r'huggingface\.co/spaces/([^/\s\)]+/[^/\s\)]+)', content)
|
| 450 |
if match:
|
| 451 |
existing_space = match.group(1)
|
|
|
|
| 452 |
break
|
| 453 |
|
| 454 |
# Check user messages for imports
|
|
|
|
| 444 |
|
| 445 |
# Check assistant messages for deployment confirmations
|
| 446 |
if role == 'assistant':
|
| 447 |
+
# Look for various deployment success patterns (case-insensitive)
|
| 448 |
+
content_lower = content.lower()
|
| 449 |
+
has_deployment_indicator = (
|
| 450 |
+
"deployed" in content_lower or
|
| 451 |
+
"updated" in content_lower or
|
| 452 |
+
"β
" in content # Check mark often indicates deployment success
|
| 453 |
+
)
|
| 454 |
+
|
| 455 |
+
if has_deployment_indicator:
|
| 456 |
# Look for space URL pattern
|
| 457 |
match = re.search(r'huggingface\.co/spaces/([^/\s\)]+/[^/\s\)]+)', content)
|
| 458 |
if match:
|
| 459 |
existing_space = match.group(1)
|
| 460 |
+
print(f"[Extract Space] Found existing space: {existing_space}")
|
| 461 |
break
|
| 462 |
|
| 463 |
# Check user messages for imports
|
frontend/src/app/page.tsx
CHANGED
|
@@ -362,12 +362,12 @@ export default function Home() {
|
|
| 362 |
setCurrentRepoId(match[1]);
|
| 363 |
}
|
| 364 |
|
| 365 |
-
// Update message with deployment success
|
| 366 |
setMessages((prev) => {
|
| 367 |
const newMessages = [...prev];
|
| 368 |
newMessages[newMessages.length - 1] = {
|
| 369 |
...assistantMessage,
|
| 370 |
-
content: `β
Code generated
|
| 371 |
};
|
| 372 |
return newMessages;
|
| 373 |
});
|
|
|
|
| 362 |
setCurrentRepoId(match[1]);
|
| 363 |
}
|
| 364 |
|
| 365 |
+
// Update message with deployment success - use backend message format for history tracking
|
| 366 |
setMessages((prev) => {
|
| 367 |
const newMessages = [...prev];
|
| 368 |
newMessages[newMessages.length - 1] = {
|
| 369 |
...assistantMessage,
|
| 370 |
+
content: `β
Code generated successfully!\n\n${message}`,
|
| 371 |
};
|
| 372 |
return newMessages;
|
| 373 |
});
|