Spaces:
Runtime error
Runtime error
File size: 2,731 Bytes
410242f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #!/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!")
|