Compare commits

..

No commits in common. "4e33cc26dde40ffcd8cbadfd937ad0eb9a485bd7" and "9b674027a0ef05576b34c6e0e2068a245b8262e0" have entirely different histories.

View file

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