Sabbah13 commited on
Commit
a93f32d
1 Parent(s): 94e5d15

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -3
main.py CHANGED
@@ -43,6 +43,7 @@ note_taker_url_transcript_my_video = os.getenv('NOTE_TAKER_URL_TRANSCRIPT_MY_VID
43
  base_promt = os.getenv('BASE_PROMT')
44
  django_authorization_token = os.getenv('DJANGO_AUTHORIZATION_TOKEN')
45
  base_url = os.getenv('BASE_URL')
 
46
 
47
  class MeetingURL(BaseModel):
48
  meeting_url: str
@@ -86,6 +87,7 @@ async def connect_bot(meeting_data: MeetingURL, token: str = Depends(verify_toke
86
  "transcription_options": { "provider": "meeting_captions" },
87
  "metadata": {
88
  "final_django_url": final_django_url,
 
89
  },
90
  }
91
 
@@ -228,9 +230,12 @@ async def handle_webhook(request: Request, token: str = Depends(verify_token), b
228
  responseRetrieve = requests.get(urlRetrieve, headers=headersRetrieve).json()
229
  responseRetrieve['bot_id'] = bot_id
230
 
231
- # Запуск фоновых задач для отправки на сервер Django и на транскрибацию
232
- background_tasks.add_task(send_video_to_django, responseRetrieve)
233
- background_tasks.add_task(send_webhook_for_transcription, responseRetrieve)
 
 
 
234
 
235
  else:
236
  logger.info(f"Current status: {status}")
@@ -458,6 +463,7 @@ async def connect_bot(meeting_data: MeetingEvent, token: str = Depends(verify_to
458
  "user_id": user_id,
459
  "event_id": event_id,
460
  "final_django_url": final_django_url,
 
461
  },
462
  }
463
 
 
43
  base_promt = os.getenv('BASE_PROMT')
44
  django_authorization_token = os.getenv('DJANGO_AUTHORIZATION_TOKEN')
45
  base_url = os.getenv('BASE_URL')
46
+ deploy_env = os.getenv('DEPLOY_ENV')
47
 
48
  class MeetingURL(BaseModel):
49
  meeting_url: str
 
87
  "transcription_options": { "provider": "meeting_captions" },
88
  "metadata": {
89
  "final_django_url": final_django_url,
90
+ "deploy_env": deploy_env,
91
  },
92
  }
93
 
 
230
  responseRetrieve = requests.get(urlRetrieve, headers=headersRetrieve).json()
231
  responseRetrieve['bot_id'] = bot_id
232
 
233
+ # Проверяем окружение
234
+ response_deploy_env = responseRetrieve.get('metadata', {}).get('deploy_env', None)
235
+ if (response_deploy_env == deploy_env):
236
+ # Запуск фоновых задач для отправки на сервер Django и на транскрибацию
237
+ background_tasks.add_task(send_video_to_django, responseRetrieve)
238
+ background_tasks.add_task(send_webhook_for_transcription, responseRetrieve)
239
 
240
  else:
241
  logger.info(f"Current status: {status}")
 
463
  "user_id": user_id,
464
  "event_id": event_id,
465
  "final_django_url": final_django_url,
466
+ "deploy_env": deploy_env,
467
  },
468
  }
469