Upload latest code and optimized prompts (v6)

This commit is contained in:
tony
2025-12-14 19:52:54 +08:00
commit f5cb1042ae
42 changed files with 15302 additions and 0 deletions

31
test_upload.js Normal file
View File

@@ -0,0 +1,31 @@
require('dotenv').config();
const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3');
const client = new S3Client({
region: 'auto',
endpoint: `https://${process.env.R2_ACCOUNT_ID}.r2.cloudflarestorage.com`,
credentials: {
accessKeyId: process.env.R2_ACCESS_KEY_ID,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
},
forcePathStyle: true,
});
(async () => {
try {
console.log('Attempting upload to bucket:', process.env.R2_BUCKET_NAME);
const command = new PutObjectCommand({
Bucket: process.env.R2_BUCKET_NAME,
Key: 'test-file.txt',
Body: 'Hello R2',
ContentType: 'text/plain',
});
await client.send(command);
console.log('Upload successful!');
} catch (err) {
console.error('Upload Error Details:');
console.error('Code:', err.Code);
console.error('Message:', err.message);
console.error('Full Error:', err);
}
})();