| | |
| | | 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 |
| | |
| | | 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)) |