Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: return 400 instead of 500 when file field is missing in audio-to-text endpoints (#39303) (#39322)

shakti6a338654fb0a
diff --git a/api/controllers/console/explore/trial.py b/api/controllers/console/explore/trial.py
index e974d290414..67ff9708959 100644
--- a/api/controllers/console/explore/trial.py
+++ b/api/controllers/console/explore/trial.py
@@ -645,7 +645,7 @@ class TrialChatAudioApi(TrialAppResource):
def post(self, current_user: Account, trial_app):
app_model = trial_app
- file = request.files["file"]
+ file = request.files.get("file")
try:
# Get IDs before they might be detached from session
diff --git a/api/controllers/service_api/app/audio.py b/api/controllers/service_api/app/audio.py
index 1799eb68070..44bea189553 100644
--- a/api/controllers/service_api/app/audio.py
+++ b/api/controllers/service_api/app/audio.py
@@ -101,7 +101,7 @@ class AudioApi(Resource):
Accepts an audio file upload and returns the transcribed text.
"""
- file = request.files["file"]
+ file = request.files.get("file")
try:
response = AudioService.transcript_asr(
diff --git a/api/controllers/web/audio.py b/api/controllers/web/audio.py
index 3e5c939968c..a7b4fa38916 100644
--- a/api/controllers/web/audio.py
+++ b/api/controllers/web/audio.py
@@ -76,7 +76,7 @@ class AudioApi(WebApiResource):
@web_ns.response(200, "Success", web_ns.models[AudioToTextResponse.__name__])
def post(self, app_model: App, end_user: EndUser):
"""Convert audio to text"""
- file = request.files["file"]
+ file = request.files.get("file")
try:
response = AudioService.transcript_asr(