Files & Media
अपने app code से फ़ाइलें अपलोड और मैनेज करें। हर फ़ाइल को एक permanent public URL मिलता है।
Proyecta, आपके app code से programmatic file management के लिए SDK के ज़रिए एक Files API प्रदान करता है।
Chat अटैचमेंट
Section titled “Chat अटैचमेंट”Chat इनपुट सीधे images स्वीकार करता है — कोई screenshot पेस्ट करें या इनपुट पर कोई image file drag करें। समर्थित formats: PNG, JPEG, WebP, GIF, AVIF। अधिकतम साइज़: प्रति image 10 MB।
Chat अटैचमेंट message का हिस्सा होते हैं, आपकी file library का नहीं। Persistent storage के लिए SDK का उपयोग करें।
Files API (SDK)
Section titled “Files API (SDK)”हर published Proyecta app को Proyecta SDK के ज़रिए एक file storage API तक पहुँच मिलती है। SDK listing, fetching, और uploading फ़ाइलों को support करता है। अपलोड की गई फ़ाइलों को एक permanent public URL मिलता है जिसे आप अपने app से reference कर सकते हैं।
import Proyecta from '@proyecta-ai/sdk';
const proyecta = new Proyecta({ apiKey: process.env.PROYECTA_API_KEY });
// List files (supports limit and starting_after for pagination)const files = await proyecta.files.list();
// Fetch a single file by IDconst file = await proyecta.files.get('1234567890123456789');console.log(file.url); // permanent public URL
// Upload a file (two-step)// Step 1: create a placeholder and get a signed upload URLconst { id: fileId, upload_url } = await proyecta.files.create({ filename: 'avatar.png', mime_type: 'image/png',});
// Step 2: PUT the file bytes directly to the signed URLawait fetch(upload_url, { method: 'PUT', body: fileBytes, headers: { 'Content-Type': 'image/png' },});
// Step 3: finalize to get the permanent file recordconst uploaded = await proyecta.files.finalize({ fileId });console.log(uploaded.url); // permanent public URL, now populatedहर फ़ाइल में ये fields होते हैं:
| Field | विवरण |
|---|---|
id | Unique identifier (numeric snowflake string) |
url | Permanent public URL (finalize step के बाद populate होता है) |
filename | अपलोड के समय का original filename |
mime_type | image/jpeg, application/pdf, आदि। |
size | bytes में साइज़ |
path | Optional folder path (जैसे /images/blog) |
content_hash | फ़ाइल की contents का SHA-256 |
metadata | Arbitrary key/value metadata |
created | ISO 8601 creation timestamp |
updated | ISO 8601 last-updated timestamp |
मेरे app में फ़ाइलें कैसे अपलोड होती हैं?
Section titled “मेरे app में फ़ाइलें कैसे अपलोड होती हैं?”File uploads AI builder के ज़रिए handle की जाती हैं। AI से आपका upload flow बनाने के लिए कहें:
"Let users upload a profile photo and store it in Proyecta Files""Add an image gallery where signed-in users can upload and view their photos""Let me attach PDF invoices to orders"
AI, SDK के two-step upload API का उपयोग करके आपके app code में upload को wire up करता है और returned public URL को reference करता है। आप files.create() / files.finalize() को अपने खुद के app code से भी सीधे call कर सकते हैं।
अक्सर पूछे जाने वाले सवाल
Section titled “अक्सर पूछे जाने वाले सवाल”क्या file URLs public हैं?
हाँ। Files API द्वारा return की गई किसी भी फ़ाइल का एक permanent public URL होता है। कोई भी ऐसी चीज़ अपलोड न करें जिसे आप expose नहीं करना चाहते।
एक फ़ाइल कितनी बड़ी हो सकती है?
Per-file की सीमाएँ आपके plan पर निर्भर करती हैं। Chat अटैचमेंट प्रति image 10 MB तक सीमित हैं।
क्या मैं URL पर images resize या crop कर सकता हूँ?
On-the-fly image transforms (resize, crop, format conversion) roadmap पर हैं।
जल्द आने वाला है
Section titled “जल्द आने वाला है”- URL parameters के ज़रिए Image transformations (resize, crop, format conversion)
- Folder organization — पैनल में folder paths बनाएँ और मैनेज करें
- किसी file row से “Add to Chat” का विकल्प, ताकि library assets को AI conversation में drop किया जा सके