fix data connector readfile
All checks were successful
Deploy Plattform-Core (Int) / test (push) Successful in 1m2s
Deploy Plattform-Core (Int) / deploy (push) Successful in 8s

This commit is contained in:
ValueOn AG 2026-06-04 23:20:28 +02:00
parent f766219d4b
commit 76753f6037

View file

@ -61,13 +61,11 @@ def _registerConnectionTools(registry: ToolRegistry, services):
)
adapter = await resolver.resolveService(connectionId, service)
chatService = services.chat
fileContent = chatService.getFileContent(fileId)
if not fileContent:
fileData = chatService.getFileData(fileId)
if not fileData:
return ToolResult(toolCallId="", toolName="uploadToExternal", success=False, error="File not found")
fileData = fileContent.get("data", b"") if isinstance(fileContent, dict) else b""
if isinstance(fileData, str):
fileData = fileData.encode("utf-8")
fileName = fileContent.get("fileName", "file") if isinstance(fileContent, dict) else "file"
fileInfo = chatService.getFileInfo(fileId)
fileName = (fileInfo or {}).get("fileName", "file")
result = await adapter.upload(path, fileData, fileName)
return ToolResult(toolCallId="", toolName="uploadToExternal", success=True, data=str(result))
except Exception as e: