Update app.py
Browse files
app.py
CHANGED
@@ -5,21 +5,28 @@ from src import search_on_web, search_custom_sites, search_custom_domain
|
|
5 |
|
6 |
|
7 |
def run_search_on_web(query: str):
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
11 |
|
12 |
def run_search_custom_sites(query: str, sites: str):
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
|
18 |
def run_search_custom_domains(query: str, domains: str):
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
|
24 |
with gr.Blocks() as demo:
|
25 |
gr.Markdown("# 🔎 MCP Search Panel")
|
|
|
5 |
|
6 |
|
7 |
def run_search_on_web(query: str):
|
8 |
+
try:
|
9 |
+
result = search_on_web(query)
|
10 |
+
return result.response_str, [item.model_dump() for item in result.citation]
|
11 |
+
except Exception as e:
|
12 |
+
return str(e), []
|
13 |
|
14 |
def run_search_custom_sites(query: str, sites: str):
|
15 |
+
try:
|
16 |
+
site_list = [s.strip() for s in sites.split(",") if s.strip()]
|
17 |
+
result = search_custom_sites(query, site_list)
|
18 |
+
return result.response_str, [item.model_dump() for item in result.citation]
|
19 |
+
except Exception as e:
|
20 |
+
return str(e), []
|
21 |
|
22 |
|
23 |
def run_search_custom_domains(query: str, domains: str):
|
24 |
+
try:
|
25 |
+
domain_list = [d.strip() for d in domains.split(",") if d.strip()]
|
26 |
+
result = search_custom_domain(query, domain_list)
|
27 |
+
return result.response_str, [item.model_dump() for item in result.citation]
|
28 |
+
except Exception as e:
|
29 |
+
return str(e), []
|
30 |
|
31 |
with gr.Blocks() as demo:
|
32 |
gr.Markdown("# 🔎 MCP Search Panel")
|