इसे छोड़कर कंटेंट पर जाएं

Files & Media

अपने app code से फ़ाइलें अपलोड और मैनेज करें। हर फ़ाइल को एक permanent public URL मिलता है।

Proyecta, आपके app code से programmatic file management के लिए SDK के ज़रिए एक Files API प्रदान करता है।

Chat इनपुट सीधे images स्वीकार करता है — कोई screenshot पेस्ट करें या इनपुट पर कोई image file drag करें। समर्थित formats: PNG, JPEG, WebP, GIF, AVIF। अधिकतम साइज़: प्रति image 10 MB

Chat अटैचमेंट message का हिस्सा होते हैं, आपकी file library का नहीं। Persistent storage के लिए 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 ID
const 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 URL
const { 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 URL
await fetch(upload_url, {
method: 'PUT',
body: fileBytes,
headers: { 'Content-Type': 'image/png' },
});
// Step 3: finalize to get the permanent file record
const uploaded = await proyecta.files.finalize({ fileId });
console.log(uploaded.url); // permanent public URL, now populated

हर फ़ाइल में ये fields होते हैं:

Fieldविवरण
idUnique identifier (numeric snowflake string)
urlPermanent public URL (finalize step के बाद populate होता है)
filenameअपलोड के समय का original filename
mime_typeimage/jpeg, application/pdf, आदि।
sizebytes में साइज़
pathOptional folder path (जैसे /images/blog)
content_hashफ़ाइल की contents का SHA-256
metadataArbitrary key/value metadata
createdISO 8601 creation timestamp
updatedISO 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 किया जा सके