浏览代码

fix: audio file upload response issue

Timothy Jaeryang Baek 5 月之前
父节点
当前提交
cbe2056587
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 3 1
      backend/open_webui/routers/files.py
  2. 1 1
      backend/open_webui/routers/retrieval.py

+ 3 - 1
backend/open_webui/routers/files.py

@@ -122,6 +122,7 @@ def upload_file(
                 ]:
                 ]:
                     file_path = Storage.get_file(file_path)
                     file_path = Storage.get_file(file_path)
                     result = transcribe(request, file_path)
                     result = transcribe(request, file_path)
+
                     process_file(
                     process_file(
                         request,
                         request,
                         ProcessFileForm(file_id=id, content=result.get("text", "")),
                         ProcessFileForm(file_id=id, content=result.get("text", "")),
@@ -129,7 +130,8 @@ def upload_file(
                     )
                     )
                 elif file.content_type not in ["image/png", "image/jpeg", "image/gif"]:
                 elif file.content_type not in ["image/png", "image/jpeg", "image/gif"]:
                     process_file(request, ProcessFileForm(file_id=id), user=user)
                     process_file(request, ProcessFileForm(file_id=id), user=user)
-                    file_item = Files.get_file_by_id(id=id)
+
+                file_item = Files.get_file_by_id(id=id)
             except Exception as e:
             except Exception as e:
                 log.exception(e)
                 log.exception(e)
                 log.error(f"Error processing file: {file_item.id}")
                 log.error(f"Error processing file: {file_item.id}")

+ 1 - 1
backend/open_webui/routers/retrieval.py

@@ -958,7 +958,7 @@ def process_file(
 
 
         if form_data.content:
         if form_data.content:
             # Update the content in the file
             # Update the content in the file
-            # Usage: /files/{file_id}/data/content/update
+            # Usage: /files/{file_id}/data/content/update, /files/ (audio file upload pipeline)
 
 
             try:
             try:
                 # /files/{file_id}/data/content/update
                 # /files/{file_id}/data/content/update