Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ RESULTS_PER_PAGE = 10
|
|
20 |
TOTAL_RESULTS = 30 # Generate 30 results to allow pagination
|
21 |
|
22 |
def fetch_search_results(query):
|
23 |
-
"""Fetch search results from the LLM without streaming
|
24 |
if not query.strip():
|
25 |
return None, "Please enter a search query."
|
26 |
|
@@ -82,7 +82,7 @@ def check_url():
|
|
82 |
favicon_url = favicon_tag['href'] if favicon_tag and 'href' in favicon_tag.attrs else None
|
83 |
if favicon_url and not favicon_url.startswith('http'):
|
84 |
favicon_url = urljoin(url, favicon_url) # Resolve relative URLs
|
85 |
-
return jsonify({'broken': False, 'favicon': favicon_url or '
|
86 |
else:
|
87 |
return jsonify({'broken': True, 'favicon': None})
|
88 |
except requests.RequestException:
|
@@ -361,6 +361,7 @@ def search_page():
|
|
361 |
.search-result a:hover {{ text-decoration: underline; }}
|
362 |
.search-result a.broken {{ color: #d93025; }}
|
363 |
.search-result .favicon {{ width: 16px; height: 16px; margin-right: 8px; vertical-align: middle; }}
|
|
|
364 |
.search-result .url {{ color: #006621; font-size: 14px; line-height: 20px; }}
|
365 |
.search-result p {{ color: #4d5156; font-size: 14px; line-height: 22px; margin: 0; }}
|
366 |
.pagination {{ text-align: center; margin: 40px 0; }}
|
@@ -395,12 +396,19 @@ def search_page():
|
|
395 |
if (data.broken) {{
|
396 |
link.textContent += ' [Broken Link]';
|
397 |
link.classList.add('broken');
|
398 |
-
}} else
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
}}
|
405 |
}} catch (error) {{
|
406 |
link.textContent += ' [Broken Link]';
|
|
|
20 |
TOTAL_RESULTS = 30 # Generate 30 results to allow pagination
|
21 |
|
22 |
def fetch_search_results(query):
|
23 |
+
"""Fetch search results from the LLM without streaming."""
|
24 |
if not query.strip():
|
25 |
return None, "Please enter a search query."
|
26 |
|
|
|
82 |
favicon_url = favicon_tag['href'] if favicon_tag and 'href' in favicon_tag.attrs else None
|
83 |
if favicon_url and not favicon_url.startswith('http'):
|
84 |
favicon_url = urljoin(url, favicon_url) # Resolve relative URLs
|
85 |
+
return jsonify({'broken': False, 'favicon': favicon_url or 'π'}) # Use emoji as default
|
86 |
else:
|
87 |
return jsonify({'broken': True, 'favicon': None})
|
88 |
except requests.RequestException:
|
|
|
361 |
.search-result a:hover {{ text-decoration: underline; }}
|
362 |
.search-result a.broken {{ color: #d93025; }}
|
363 |
.search-result .favicon {{ width: 16px; height: 16px; margin-right: 8px; vertical-align: middle; }}
|
364 |
+
.search-result .emoji {{ margin-right: 8px; font-size: 16px; vertical-align: middle; }}
|
365 |
.search-result .url {{ color: #006621; font-size: 14px; line-height: 20px; }}
|
366 |
.search-result p {{ color: #4d5156; font-size: 14px; line-height: 22px; margin: 0; }}
|
367 |
.pagination {{ text-align: center; margin: 40px 0; }}
|
|
|
396 |
if (data.broken) {{
|
397 |
link.textContent += ' [Broken Link]';
|
398 |
link.classList.add('broken');
|
399 |
+
}} else {{
|
400 |
+
if (data.favicon === 'π') {{
|
401 |
+
const emojiSpan = document.createElement('span');
|
402 |
+
emojiSpan.textContent = 'π';
|
403 |
+
emojiSpan.className = 'emoji';
|
404 |
+
link.insertBefore(emojiSpan, link.firstChild);
|
405 |
+
}} else if (data.favicon) {{
|
406 |
+
const img = document.createElement('img');
|
407 |
+
img.src = data.favicon;
|
408 |
+
img.className = 'favicon';
|
409 |
+
img.alt = 'Favicon';
|
410 |
+
link.insertBefore(img, link.firstChild);
|
411 |
+
}}
|
412 |
}}
|
413 |
}} catch (error) {{
|
414 |
link.textContent += ' [Broken Link]';
|