Spaces:
Sleeping
Sleeping
Update app/backend.py
Browse files- app/backend.py +5 -1
app/backend.py
CHANGED
|
@@ -149,6 +149,7 @@ Format responses with:
|
|
| 149 |
- Use **bold** to highlight important terms.
|
| 150 |
- Do not include raw <br> or HTML—just Markdown syntax.
|
| 151 |
- give proper equations using LaTeX syntax ($...$ or $$...$$)
|
|
|
|
| 152 |
|
| 153 |
|
| 154 |
Respond in Markdown format.
|
|
@@ -166,7 +167,10 @@ Respond in Markdown format.
|
|
| 166 |
{query}
|
| 167 |
</question>
|
| 168 |
"""
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
| 170 |
# Try all available API keys
|
| 171 |
while attempts < total_keys * 2: # Max: 2 full loops
|
| 172 |
idx = (current_api_index + attempts) % total_keys
|
|
|
|
| 149 |
- Use **bold** to highlight important terms.
|
| 150 |
- Do not include raw <br> or HTML—just Markdown syntax.
|
| 151 |
- give proper equations using LaTeX syntax ($...$ or $$...$$)
|
| 152 |
+
- give calculations properly in the format so that i dont get math error.
|
| 153 |
|
| 154 |
|
| 155 |
Respond in Markdown format.
|
|
|
|
| 167 |
{query}
|
| 168 |
</question>
|
| 169 |
"""
|
| 170 |
+
# Step 4: Retry all keys — loop through circularly
|
| 171 |
+
tried_keys = set()
|
| 172 |
+
attempts = 0
|
| 173 |
+
total_keys = len(openrouter_keys)
|
| 174 |
# Try all available API keys
|
| 175 |
while attempts < total_keys * 2: # Max: 2 full loops
|
| 176 |
idx = (current_api_index + attempts) % total_keys
|