wip enhance name and docstring
This commit is contained in:
@@ -61,8 +61,15 @@ def post_with_retries(url, data):
|
||||
|
||||
|
||||
@celery.task(max_retries=1)
|
||||
def send_push_notification(filename: str, email: str, sub: str):
|
||||
"""Mock push notification."""
|
||||
def process_audio_transcribe_summarize(filename: str, email: str, sub: str):
|
||||
"""Process an audio file by transcribing it and generating a summary.
|
||||
|
||||
This Celery task performs the following operations:
|
||||
1. Retrieves the audio file from MinIO storage
|
||||
2. Transcribes the audio using OpenAI-compliant API's ASR model
|
||||
3. Generates a summary of the transcription using OpenAI-compliant API's LLM
|
||||
4. Sends the results via webhook
|
||||
"""
|
||||
logger.info("Notification received")
|
||||
logger.debug("filename: %s", filename)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from celery.result import AsyncResult
|
||||
from fastapi import Depends, FastAPI
|
||||
from pydantic import BaseModel
|
||||
|
||||
from .celery_worker import send_push_notification
|
||||
from .celery_worker import process_audio_transcribe_summarize
|
||||
from .security import verify_token
|
||||
|
||||
app = FastAPI()
|
||||
@@ -33,7 +33,9 @@ class NotificationRequest(BaseModel):
|
||||
@app.post("/push")
|
||||
async def notify(request: NotificationRequest, token: str = Depends(verify_token)):
|
||||
"""Push a notification."""
|
||||
task = send_push_notification.delay(request.filename, request.email, request.sub)
|
||||
task = process_audio_transcribe_summarize.delay(
|
||||
request.filename, request.email, request.sub
|
||||
)
|
||||
return {"task_id": task.id, "message": "Notification sent"}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user