Update Modules/Web_Search.py
Browse files- Modules/Web_Search.py +8 -1
Modules/Web_Search.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
from typing import Annotated, List
|
|
|
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
from ddgs import DDGS
|
|
@@ -419,10 +420,16 @@ def Web_Search(
|
|
| 419 |
search_label = original_search_type.title()
|
| 420 |
if used_fallback:
|
| 421 |
search_label += " → Text (Smart Fallback)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
pagination_info = f"Page {calculated_page}"
|
| 423 |
if offset > 0:
|
| 424 |
pagination_info = f"Offset {actual_offset} (≈ {pagination_info})"
|
| 425 |
-
lines = [f"{search_label} search results for: {query}"]
|
| 426 |
if used_fallback:
|
| 427 |
lines.append("📍 Note: News search returned no results, automatically searched general web content instead")
|
| 428 |
lines.append(f"{pagination_info} (results {start_num}-{end_num} of ~{total_available}+ available)\n")
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
from typing import Annotated, List
|
| 4 |
+
from datetime import datetime
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
from ddgs import DDGS
|
|
|
|
| 420 |
search_label = original_search_type.title()
|
| 421 |
if used_fallback:
|
| 422 |
search_label += " → Text (Smart Fallback)"
|
| 423 |
+
|
| 424 |
+
now_dt = datetime.now().astimezone()
|
| 425 |
+
date_str = now_dt.strftime("%A, %B %d, %Y %I:%M %p %Z").strip()
|
| 426 |
+
if not date_str:
|
| 427 |
+
date_str = now_dt.isoformat()
|
| 428 |
+
|
| 429 |
pagination_info = f"Page {calculated_page}"
|
| 430 |
if offset > 0:
|
| 431 |
pagination_info = f"Offset {actual_offset} (≈ {pagination_info})"
|
| 432 |
+
lines = [f"Current Date: {date_str}", f"{search_label} search results for: {query}"]
|
| 433 |
if used_fallback:
|
| 434 |
lines.append("📍 Note: News search returned no results, automatically searched general web content instead")
|
| 435 |
lines.append(f"{pagination_info} (results {start_num}-{end_num} of ~{total_available}+ available)\n")
|