Update app.py
Browse files
app.py
CHANGED
@@ -303,7 +303,25 @@ def search_web(query):
|
|
303 |
link = result.get("link", "No Link")
|
304 |
snippet = result.get("snippet", "No Snippet")
|
305 |
raw_output += f"Title: {title}\nLink: {link}\nSnippet: {snippet}\n\n"
|
306 |
-
prompt = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
summarized = _general_chat(prompt)
|
308 |
return summarized if summarized else raw_output.strip()
|
309 |
else:
|
@@ -633,6 +651,8 @@ Avoid being overly confident — never say "Yes, it will..." or "Definitely." In
|
|
633 |
|
634 |
Also, after answering the question, include a short weather summary and a useful suggestion (e.g., bring an umbrella, wear sunscreen, avoid outdoor activities).
|
635 |
|
|
|
|
|
636 |
--- Weather Data ---
|
637 |
Location: {location}
|
638 |
Time: {target_dt.strftime('%Y-%m-%d')} at {hour_str}
|
@@ -753,6 +773,8 @@ Avoid being overly confident — never say "Yes, it will..." or "Definitely." In
|
|
753 |
|
754 |
Also, after answering the question, include a short weather summary and a useful suggestion (e.g., bring an umbrella, wear sunscreen, avoid outdoor activities).
|
755 |
|
|
|
|
|
756 |
--- Weather Data ---
|
757 |
Location: {location}
|
758 |
Time: {target_dt.strftime('%Y-%m-%d')} at {hour_str}
|
|
|
303 |
link = result.get("link", "No Link")
|
304 |
snippet = result.get("snippet", "No Snippet")
|
305 |
raw_output += f"Title: {title}\nLink: {link}\nSnippet: {snippet}\n\n"
|
306 |
+
prompt = f"""
|
307 |
+
You are a helpful assistant. Given the following web search results and the user's question:
|
308 |
+
|
309 |
+
1. First, identify **only** the most relevant entries.
|
310 |
+
2. Then, summarise the key insights using fluent, **British English**.
|
311 |
+
3. If the user's question asks for trends, categories, or multiple items, you may present key points in a non-markdown bullet-point style (e.g. use "•" instead of "-", avoid using "**" for bold).
|
312 |
+
4. Otherwise, reply in a short, natural paragraph.
|
313 |
+
5. Do **not** use any markdown formatting such as `**`, `##`, or list syntax.
|
314 |
+
6. Keep your answer concise and professional, as if explaining to a colleague.
|
315 |
+
7. If no relevant info is found, say: "Sorry, I couldn't find a reliable answer from the current results."
|
316 |
+
|
317 |
+
--- Web Search Results ---
|
318 |
+
{raw_output}
|
319 |
+
|
320 |
+
--- User's Question ---
|
321 |
+
"{query}"
|
322 |
+
|
323 |
+
Answer:
|
324 |
+
"""
|
325 |
summarized = _general_chat(prompt)
|
326 |
return summarized if summarized else raw_output.strip()
|
327 |
else:
|
|
|
651 |
|
652 |
Also, after answering the question, include a short weather summary and a useful suggestion (e.g., bring an umbrella, wear sunscreen, avoid outdoor activities).
|
653 |
|
654 |
+
**Do not use markdown formatting such as `*`, `**`, or list symbols.**
|
655 |
+
|
656 |
--- Weather Data ---
|
657 |
Location: {location}
|
658 |
Time: {target_dt.strftime('%Y-%m-%d')} at {hour_str}
|
|
|
773 |
|
774 |
Also, after answering the question, include a short weather summary and a useful suggestion (e.g., bring an umbrella, wear sunscreen, avoid outdoor activities).
|
775 |
|
776 |
+
**Do not use markdown formatting such as `*`, `**`, or list symbols.**
|
777 |
+
|
778 |
--- Weather Data ---
|
779 |
Location: {location}
|
780 |
Time: {target_dt.strftime('%Y-%m-%d')} at {hour_str}
|