From 992d91359f4e4437ddba9843173254441c896918 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期四, 02 一月 2025 18:03:28 +0800
Subject: [PATCH] 报告生成文档清洗

---
 app/api/files.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/app/api/files.py b/app/api/files.py
index a5c2fd1..92ee599 100644
--- a/app/api/files.py
+++ b/app/api/files.py
@@ -18,6 +18,7 @@
 from app.service.bisheng import BishengService
 from app.service.common.api_token import DfTokenDao
 from app.service.difyService import DifyService
+from app.service.files import read_file
 from app.service.ragflow import RagflowService
 from app.service.service_token import get_ragflow_token, get_bisheng_token
 import urllib.parse
@@ -124,7 +125,11 @@
                 except Exception as e:
                     return Response(code=400, msg=str(e))
                 try:
-                    file_upload = await dify_service.upload(token, f.filename, file_content, current_user.id)
+                    filename = f.filename
+                    file_upload = await dify_service.upload(token, filename, file_content, current_user.id)
+                    print(file_upload)
+                    tokens = await read_file(file_content, filename, f.content_type)
+                    file_upload["tokens"] = tokens
                     result.append(file_upload)
                 except Exception as e:
                     raise HTTPException(status_code=500, detail=str(e))

--
Gitblit v1.8.0