Skip to content

Conversation

@ulivz
Copy link
Member

@ulivz ulivz commented Sep 17, 2025

Summary

Adds /v1/file/upload endpoint to @tarko/agent-server and integrates it with @tarko/agent-ui ChatInput component for server-side file processing:

Backend (@tarko/agent-server):

  • Images: Converted to base64 and returned as ChatCompletionContentPart with image_url type
  • Other files: Saved to workspace with timestamp-based unique naming and returned as ChatCompletionContentPart with text type containing file path

Frontend (@tarko/agent-ui):

  • Modified ChatInput component to use server upload API instead of client-side processing
  • Supports both file picker and paste operations
  • Added upload progress indicators
  • Now accepts all file types, not just images

Response format aligns with /api/v1/sessions/query/stream query interface using ChatCompletionContentPart[].

Implementation details:

  • Uses multer for multipart file handling
  • 20MB file size limit
  • Supports up to 10 files per request
  • Files saved to session workspace with format: {filename}-{timestamp}.{ext}
  • Unified file handling for both drag-drop and paste operations

Checklist

  • Added or updated necessary tests (Optional).
  • Updated documentation to align with changes (Optional).
  • Verified no breaking changes, or prepared solutions for any occurring breaking changes (Optional).
  • My change does not involve the above items.

@netlify
Copy link

netlify bot commented Sep 17, 2025

Deploy Preview for agent-tars-docs ready!

Name Link
🔨 Latest commit 322b7d3
🔍 Latest deploy log https://app.netlify.com/projects/agent-tars-docs/deploys/68cec637cc5eb10008afbd16
😎 Deploy Preview https://deploy-preview-1557--agent-tars-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

}

// Write file to workspace
fs.writeFileSync(filePath, file.buffer);

Check warning

Code scanning / CodeQL

Network data written to file Medium

Write to file system depends on
Untrusted data
.
@ulivz ulivz changed the title feat(tarko-agent-server): add file upload API feat(tarko-agent-server): add file upload api to handle multimodal files Sep 17, 2025
@ulivz ulivz changed the title feat(tarko-agent-server): add file upload api to handle multimodal files WIP: feat(tarko-agent-server): add file upload api to handle multimodal files Sep 17, 2025
@netlify
Copy link

netlify bot commented Sep 20, 2025

Deploy Preview for tarko ready!

Name Link
🔨 Latest commit 322b7d3
🔍 Latest deploy log https://app.netlify.com/projects/tarko/deploys/68cec637e95c3700081ff2cb
😎 Deploy Preview https://deploy-preview-1557--tarko.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ulivz ulivz force-pushed the feat/file-upload-api branch from ccc01e2 to 322b7d3 Compare September 20, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants