rbn2008k commited on
Commit
243a528
·
verified ·
1 Parent(s): 21221a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -176,12 +176,11 @@ async def get_completion(client, event, user_id, prompt):
176
  for chunk in completion:
177
  if chunk.choices[0].delta.content is not None:
178
  message += chunk.choices[0].delta.content
179
- if message != prev_message: # Only edit if content has changed
180
  await bot_message.edit(message)
181
  prev_message = message
182
- await asyncio.sleep(0.5) # Add delay to avoid spamming edits
183
  except Exception as e:
184
- message = "Whoops!"
185
  print(e)
186
 
187
  update_chat_history(user_id, "user", prompt)
 
176
  for chunk in completion:
177
  if chunk.choices[0].delta.content is not None:
178
  message += chunk.choices[0].delta.content
179
+ if message != prev_message:
180
  await bot_message.edit(message)
181
  prev_message = message
 
182
  except Exception as e:
183
+ message = "..........."
184
  print(e)
185
 
186
  update_chat_history(user_id, "user", prompt)