Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python | |
| """Check if HTML file input structure is correct""" | |
| from fastapi.testclient import TestClient | |
| from main import app | |
| c = TestClient(app) | |
| print("Checking HTML file input structure...") | |
| print() | |
| r = c.get('/dashboard') | |
| html = r.text | |
| # Check 1: File input exists and is correct | |
| print("1. Profile photo input HTML:") | |
| if 'id="profileAvatarInput"' in html: | |
| start = html.find('id="profileAvatarInput"') | |
| snippet = html[max(0, start-100):start+150] | |
| print(" β Found profileAvatarInput") | |
| print(f" Snippet: ...{snippet}...") | |
| else: | |
| print(" β profileAvatarInput NOT found!") | |
| print() | |
| # Check 2: File upload input | |
| print("2. File upload input HTML:") | |
| if 'id="fileInput"' in html: | |
| start = html.find('id="fileInput"') | |
| snippet = html[max(0, start-100):start+150] | |
| print(" β Found fileInput") | |
| print(f" Snippet: ...{snippet}...") | |
| else: | |
| print(" β fileInput NOT found!") | |
| print() | |
| # Check 3: Upload button | |
| print("3. Upload button:") | |
| if 'onclick="document.getElementById(\'fileInput\').click()"' in html: | |
| print(" β Button click handler is correct") | |
| else: | |
| print(" β Button click handler might be wrong") | |
| print() | |
| # Check 4: uploadFile function | |
| print("4. uploadFile function:") | |
| if 'async function uploadFile(event)' in html: | |
| print(" β uploadFile function defined") | |
| # Find where it starts | |
| start = html.find('async function uploadFile(event)') | |
| if start > 0: | |
| snippet = html[start:start+500] | |
| print(f" First 200 chars: {snippet[:200]}") | |
| else: | |
| print(" β uploadFile function NOT found!") | |
| print() | |
| # Check 5: onProfilePhotoChange function | |
| print("5. onProfilePhotoChange function:") | |
| if 'function onProfilePhotoChange(event)' in html: | |
| print(" β onProfilePhotoChange function defined") | |
| else: | |
| print(" β onProfilePhotoChange function NOT found!") | |
| print() | |
| # Check 6: loadUserPreferences (needs to load avatar on init) | |
| print("6. loadUserPreferences function:") | |
| if 'function loadUserPreferences()' in html: | |
| print(" β loadUserPreferences function defined") | |
| start = html.find('function loadUserPreferences()') | |
| if start > 0: | |
| snippet = html[start:start+300] | |
| print(f" Contains avatar logic: {'docintel_profile_avatar' in snippet}") | |
| else: | |
| print(" β loadUserPreferences function NOT found!") | |
| print() | |
| # Check 7: renderStats call | |
| print("7. Initial page setup:") | |
| if 'renderStats()' in html: | |
| print(" β renderStats() called") | |
| if 'loadUserPreferences()' in html: | |
| print(" β loadUserPreferences() called") | |
| if 'renderRunHistory()' in html: | |
| print(" β renderRunHistory() called") | |
| print() | |
| print("β All HTML elements and functions are present in the dashboard!") | |