NightPrince commited on
Commit
c2b1c15
·
verified ·
1 Parent(s): f67f0b8

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. __pycache__/app.cpython-312.pyc +0 -0
  2. app.py +3 -2
__pycache__/app.cpython-312.pyc CHANGED
Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ
 
app.py CHANGED
@@ -92,7 +92,7 @@ LOCAL_TOOLS = [
92
  ]
93
 
94
 
95
- RETRY_DELAYS = (0.5, 1.5, 3.0) # some MCP servers need a beat after the initialize
96
  # handshake before they'll serve a real request --
97
  # without this, list_tools/call_tool can race and raise
98
  # "Session terminated" on an otherwise-healthy server.
@@ -175,7 +175,8 @@ async def call_tool(name: str, arguments: dict) -> tuple[str, str | None]:
175
  return text[:MAX_TOOL_RESULT_CHARS], None
176
  except Exception as e: # noqa: BLE001
177
  last_err = e
178
- return f"عذرًا، حدث خطأ أثناء تنفيذ الطلب: {last_err}", None
 
179
 
180
 
181
  def parse_tool_call(text: str) -> dict | None:
 
92
  ]
93
 
94
 
95
+ RETRY_DELAYS = (0.5, 1.5, 3.0, 5.0, 8.0) # some MCP servers need a beat after the initialize
96
  # handshake before they'll serve a real request --
97
  # without this, list_tools/call_tool can race and raise
98
  # "Session terminated" on an otherwise-healthy server.
 
175
  return text[:MAX_TOOL_RESULT_CHARS], None
176
  except Exception as e: # noqa: BLE001
177
  last_err = e
178
+ print(f"tool call '{name}' failed after {len(RETRY_DELAYS)} attempts: {last_err}")
179
+ return "تعذّر الوصول إلى مصدر المعلومة حالياً، يرجى المحاولة مرة أخرى بعد قليل.", None
180
 
181
 
182
  def parse_tool_call(text: str) -> dict | None: