Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -170,29 +170,30 @@ async def save_ai_conclusion(request: AiConclusionRequest, db: Session = Depends
|
|||||||
|
|
||||||
# Отправляем webhook в Calls_WEB_Client_main для анализа
|
# Отправляем webhook в Calls_WEB_Client_main для анализа
|
||||||
try:
|
try:
|
||||||
logger.info(f"📤 Отправка webhook в Calls_WEB_Client_main для {request.filename}")
|
if (audio.sourse or "").lower() != "external":
|
||||||
|
logger.info(f"📤 Отправка webhook в Calls_WEB_Client_main для {request.filename}")
|
||||||
|
|
||||||
webhook_payload = {
|
webhook_payload = {
|
||||||
"audio_id": str(audio.id),
|
"audio_id": str(audio.id),
|
||||||
"filename": request.filename,
|
"filename": request.filename,
|
||||||
"transcription": request.transcription,
|
"transcription": request.transcription,
|
||||||
"corrected_transcription": request.corrected_transcription,
|
"corrected_transcription": request.corrected_transcription,
|
||||||
"segments": request.segments,
|
"segments": request.segments,
|
||||||
"processing_time_seconds": request.processing_time_seconds
|
"processing_time_seconds": request.processing_time_seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
webhook_response = requests.post(
|
webhook_response = requests.post(
|
||||||
WEBHOOK_ENDPOINT,
|
WEBHOOK_ENDPOINT,
|
||||||
json=webhook_payload,
|
json=webhook_payload,
|
||||||
headers={"X-Webhook-Key": WEBHOOK_API_KEY},
|
headers={"X-Webhook-Key": WEBHOOK_API_KEY},
|
||||||
timeout=30
|
timeout=30
|
||||||
)
|
)
|
||||||
|
|
||||||
if webhook_response.status_code == 200:
|
if webhook_response.status_code == 200:
|
||||||
logger.info(f"✅ Webhook успешно отправлен для {request.filename}")
|
logger.info(f"✅ Webhook успешно отправлен для {request.filename}")
|
||||||
else:
|
else:
|
||||||
logger.warning(f"⚠️ Webhook вернул статус {webhook_response.status_code}")
|
logger.warning(f"⚠️ Webhook вернул статус {webhook_response.status_code}")
|
||||||
logger.warning(f"Response: {webhook_response.text}")
|
logger.warning(f"Response: {webhook_response.text}")
|
||||||
|
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
logger.error(f"❌ Не удалось подключиться к Calls_WEB_Client_main webhook: {WEBHOOK_ENDPOINT}")
|
logger.error(f"❌ Не удалось подключиться к Calls_WEB_Client_main webhook: {WEBHOOK_ENDPOINT}")
|
||||||
|
|||||||
Reference in New Issue
Block a user