Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ client = OpenAI(
|
|
17 |
|
18 |
# Define constants for pagination
|
19 |
RESULTS_PER_PAGE = 10
|
20 |
-
TOTAL_RESULTS =
|
21 |
|
22 |
def fetch_search_results(query):
|
23 |
"""Fetch search results from the LLM without streaming, minimizing hallucinations."""
|
@@ -25,7 +25,8 @@ def fetch_search_results(query):
|
|
25 |
return None, "Please enter a search query."
|
26 |
|
27 |
prompt = f"""
|
28 |
-
You are a highly accurate search engine designed to provide reliable, factual, and verifiable results. For the given query '{query}',
|
|
|
29 |
- 'title': A concise, accurate title directly relevant to the query, reflecting real-world content.
|
30 |
- 'snippet': A short, factual summary (2-3 sentences) based strictly on real-world knowledge, avoiding any speculation.
|
31 |
- 'url': A valid, existing URL from well-known, real websites or domains that you are certain exist based on your training data (e.g., wikipedia.org, python.org, nytimes.com, stackoverflow.com). Strictly prohibit any fictional, random, or fabricated URLs; only include URLs you can verify as real and accessible. Absolutely no made-up domains or paths are allowed—use only URLs tied to actual entities or resources.
|
@@ -393,7 +394,6 @@ def search_page():
|
|
393 |
const response = await fetch('/check-url?url=' + url);
|
394 |
const data = await response.json();
|
395 |
if (data.broken) {{
|
396 |
-
link.textContent += ' [Broken Link]';
|
397 |
link.classList.add('broken');
|
398 |
}} else {{
|
399 |
if (data.favicon === '🌐') {{
|
@@ -410,7 +410,6 @@ def search_page():
|
|
410 |
}}
|
411 |
}}
|
412 |
}} catch (error) {{
|
413 |
-
link.textContent += ' [Broken Link]';
|
414 |
link.classList.add('broken');
|
415 |
}}
|
416 |
}});
|
|
|
17 |
|
18 |
# Define constants for pagination
|
19 |
RESULTS_PER_PAGE = 10
|
20 |
+
TOTAL_RESULTS = 40 # Increased to 40 for 4 pages
|
21 |
|
22 |
def fetch_search_results(query):
|
23 |
"""Fetch search results from the LLM without streaming, minimizing hallucinations."""
|
|
|
25 |
return None, "Please enter a search query."
|
26 |
|
27 |
prompt = f"""
|
28 |
+
You are a highly accurate search engine designed to provide reliable, factual, and verifiable results. For the given query '{query}',
|
29 |
+
generate {TOTAL_RESULTS} search results. Each result must include:
|
30 |
- 'title': A concise, accurate title directly relevant to the query, reflecting real-world content.
|
31 |
- 'snippet': A short, factual summary (2-3 sentences) based strictly on real-world knowledge, avoiding any speculation.
|
32 |
- 'url': A valid, existing URL from well-known, real websites or domains that you are certain exist based on your training data (e.g., wikipedia.org, python.org, nytimes.com, stackoverflow.com). Strictly prohibit any fictional, random, or fabricated URLs; only include URLs you can verify as real and accessible. Absolutely no made-up domains or paths are allowed—use only URLs tied to actual entities or resources.
|
|
|
394 |
const response = await fetch('/check-url?url=' + url);
|
395 |
const data = await response.json();
|
396 |
if (data.broken) {{
|
|
|
397 |
link.classList.add('broken');
|
398 |
}} else {{
|
399 |
if (data.favicon === '🌐') {{
|
|
|
410 |
}}
|
411 |
}}
|
412 |
}} catch (error) {{
|
|
|
413 |
link.classList.add('broken');
|
414 |
}}
|
415 |
}});
|