tyagonzales66 commited on
Commit
50411ba
·
verified ·
1 Parent(s): bf65d16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -86,6 +86,7 @@ async def webhook(request: Request) -> Dict[str, Any]:
86
  if chunk.choices[0].delta.content is not None:
87
  continuation_text += chunk.choices[0].delta.content
88
  continuation_text = continuation_text.strip()
 
89
  if not continuation_text:
90
  raise ValueError("No text generated by NVIDIA API")
91
  except Exception as e:
@@ -106,8 +107,10 @@ async def webhook(request: Request) -> Dict[str, Any]:
106
  comment_response.raise_for_status()
107
  # Vérifier si la réponse contient "newMessage" (succès implicite)
108
  if comment_response.json().get("newMessage"):
 
109
  return {"success": True}
110
- return {"success": True} # Succès si statut 200
 
111
  except requests.exceptions.HTTPError as e:
112
  if "rate-limited" in str(e):
113
  time.sleep(2 ** attempt) # Backoff exponentiel
 
86
  if chunk.choices[0].delta.content is not None:
87
  continuation_text += chunk.choices[0].delta.content
88
  continuation_text = continuation_text.strip()
89
+ print(f"Bot response: {continuation_text}")
90
  if not continuation_text:
91
  raise ValueError("No text generated by NVIDIA API")
92
  except Exception as e:
 
107
  comment_response.raise_for_status()
108
  # Vérifier si la réponse contient "newMessage" (succès implicite)
109
  if comment_response.json().get("newMessage"):
110
+ print("Bot comment posted successfully")
111
  return {"success": True}
112
+ print("Bot comment posted successfully")
113
+ return {"success": True}
114
  except requests.exceptions.HTTPError as e:
115
  if "rate-limited" in str(e):
116
  time.sleep(2 ** attempt) # Backoff exponentiel