Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -128,20 +128,20 @@ async def handle_chat(user_input):
|
|
| 128 |
context = extract_text_from_html(url)
|
| 129 |
user_input = processed_query
|
| 130 |
else:
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
else: # Search task
|
| 137 |
-
search_start_time = time.time()
|
| 138 |
-
results = await brave_search(user_input)
|
| 139 |
-
search_end_time = time.time()
|
| 140 |
-
|
| 141 |
-
documents = [desc.replace('<strong>', '').replace('</strong>', '') for _, desc, _ in results]
|
| 142 |
-
|
| 143 |
-
context = "\n".join(documents)
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
generation_start_time = time.time()
|
| 146 |
response = await query_teapot(prompt, context, user_input)
|
| 147 |
|
|
|
|
| 128 |
context = extract_text_from_html(url)
|
| 129 |
user_input = processed_query
|
| 130 |
else:
|
| 131 |
+
# Custom prompt shims
|
| 132 |
+
if "translate" in user_input:
|
| 133 |
+
context=""
|
| 134 |
+
prompt=""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
+
else: # Search task
|
| 137 |
+
search_start_time = time.time()
|
| 138 |
+
results = await brave_search(user_input)
|
| 139 |
+
search_end_time = time.time()
|
| 140 |
+
|
| 141 |
+
documents = [desc.replace('<strong>', '').replace('</strong>', '') for _, desc, _ in results]
|
| 142 |
+
|
| 143 |
+
context = "\n".join(documents)
|
| 144 |
+
|
| 145 |
generation_start_time = time.time()
|
| 146 |
response = await query_teapot(prompt, context, user_input)
|
| 147 |
|