Merge branch 'int'
This commit is contained in:
commit
4e33cc26dd
1 changed files with 4 additions and 6 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue