Spaces:
Running
Fix AI search button (broken: depends on non-existent search-plus-boot.js)
Root Cause
The doAISearch() function in index.html depends on window._vaiSearchContext from search-plus-boot.js?v=27 which DOES NOT EXIST in the repo (returns 404). This causes the AI search button to show "⏳ Đang tải..." forever without any results.
Additionally, ai-search.js (which contains the full AI search implementation including window.aiSearch() and window.renderAISearchResults()) exists in the repo but is NOT loaded in index.html.
Fix Applied
- ai-search-fix.js (new) - Contains the fixed
doAISearch()function that useswindow.aiSearch()from ai-search.js, plus_renderAIResultsToDiv()helper that renders results into the#aiResultsdiv - ai-search.js (already existed) - Contains the full NL search logic, category detection, budget parsing, constraint matching, combo builder, AI fallback
Changes needed in index.html
- Add
<script src="ai-search.js"></script>and<script src="ai-search-fix.js"></script>after the html2canvas script tag - Replace the broken
doAISearch()function body with the working version from ai-search-fix.js - Remove reference to non-existent
search-plus-boot.js
Summary of Fix
Root cause: doAISearch() in index.html depends on window._vaiSearchContext from search-plus-boot.js?v=27 which returns 404 (file doesn't exist in repo).
Fix applied:
- ✅
ai-search.js(30.5KB) - Already existed in repo, containswindow.aiSearch() - ✅
ai-search-fix.js(9.5KB) - NEW file uploaded, overrides brokendoAISearch()at runtime
Still needed: Add two script tags to index.html <head> section:
<script src="ai-search.js"></script>
<script src="ai-search-fix.js"></script>
These should be added right after:
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
Note: I was unable to modify index.html programmatically because:
- MCP file read truncates at ~2000 lines (file is 206KB)
- Sandbox is rate-limited (can't run Python download/patch script)
- HF Jobs need namespace credits (none available)
The maintainer needs to manually add those 2 lines to index.html, or grant credits/run the patch script themselves.