Skip to content

Commit

Permalink
Fixes n3d1117#336
Browse files Browse the repository at this point in the history
  • Loading branch information
n3d1117 committed Jun 14, 2023
1 parent 4760ff1 commit fdd76ee
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions bot/telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ async def handle_callback_inline_query(self, update: Update, context: CallbackCo
stream_response = self.openai.get_chat_response_stream(chat_id=user_id, query=query)
i = 0
prev = ''
sent_message = None
backoff = 0
async for content, tokens in stream_response:
if len(content.strip()) == 0:
Expand All @@ -600,11 +599,10 @@ async def handle_callback_inline_query(self, update: Update, context: CallbackCo

if i == 0:
try:
if sent_message is not None:
await edit_message_with_retry(context, chat_id=None,
message_id=inline_message_id,
text=f'{query}\n\n{answer_tr}:\n{content}',
is_inline=True)
await edit_message_with_retry(context, chat_id=None,
message_id=inline_message_id,
text=f'{query}\n\n{answer_tr}:\n{content}',
is_inline=True)
except:
continue

Expand Down

0 comments on commit fdd76ee

Please sign in to comment.