W n8n attention vm

This commit is contained in:
alma 2025-05-24 17:48:15 +02:00
parent 548dc7fdcf
commit 1bb2c8b17a
4 changed files with 77 additions and 46 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -38,11 +38,11 @@ export async function GET(
const minioPath = filePath.startsWith('missions/') ? filePath : `missions/${filePath}`;
console.log('Full Minio path:', {
minioPath,
bucket: process.env.MINIO_AWS_S3_UPLOAD_BUCKET_NAME || 'pages'
bucket: process.env.MINIO_AWS_S3_UPLOAD_BUCKET_NAME || 'missions'
});
const command = new GetObjectCommand({
Bucket: process.env.MINIO_AWS_S3_UPLOAD_BUCKET_NAME || 'pages',
Bucket: process.env.MINIO_AWS_S3_UPLOAD_BUCKET_NAME || 'missions',
Key: minioPath,
});
@ -52,7 +52,7 @@ export async function GET(
console.error('File not found in Minio:', {
path: filePath,
minioPath,
bucket: process.env.MINIO_AWS_S3_UPLOAD_BUCKET_NAME || 'pages',
bucket: process.env.MINIO_AWS_S3_UPLOAD_BUCKET_NAME || 'missions',
contentType: response.ContentType
});
return new NextResponse('File not found', { status: 404 });
@ -70,7 +70,7 @@ export async function GET(
error,
path: filePath,
minioPath,
bucket: process.env.MINIO_AWS_S3_UPLOAD_BUCKET_NAME || 'pages',
bucket: process.env.MINIO_AWS_S3_UPLOAD_BUCKET_NAME || 'missions',
errorType: error instanceof NoSuchKey ? 'NoSuchKey' : 'Unknown'
});
if (error instanceof NoSuchKey) {

View File

@ -149,7 +149,14 @@ export async function GET(request: Request) {
const totalCount = await prisma.mission.count({ where });
// Transform missions to include public URLs
const missionsWithUrls = missions.map(mission => ({
const missionsWithUrls = missions.map(mission => {
console.log('Processing mission logo:', {
missionId: mission.id,
logo: mission.logo,
constructedUrl: mission.logo ? `/api/missions/image/${mission.logo}` : null
});
return {
...mission,
logoUrl: mission.logo ? `/api/missions/image/${mission.logo}` : null,
logo: mission.logo,
@ -157,7 +164,8 @@ export async function GET(request: Request) {
...attachment,
publicUrl: `/api/missions/image/${attachment.filePath}`
})) || []
}));
};
});
return NextResponse.json({
missions: missionsWithUrls,

View File

@ -1,5 +1,5 @@
{
"name": "My workflow 49",
"name": "base",
"nodes": [
{
"parameters": {
@ -12,7 +12,7 @@
-1040,
600
],
"id": "31981488-6ec3-458d-bd38-a83aab699bb5"
"id": "3f2bd512-63d6-4bbe-8e41-c4ef92647562"
},
{
"parameters": {
@ -25,7 +25,7 @@
-840,
480
],
"id": "b844080e-a6e9-423b-9556-22af43234952"
"id": "d53a9001-27a7-4dec-b083-962771610fad"
},
{
"parameters": {
@ -38,7 +38,7 @@
-840,
740
],
"id": "44c8a7fd-01f6-460b-8d95-7cdb658b90f5"
"id": "338e7b89-639a-4df6-bbbd-f8ddfebaec70"
},
{
"parameters": {
@ -58,7 +58,7 @@
-620,
740
],
"id": "4320ba6c-7901-4a66-b7f8-1e58be057508"
"id": "d451be7e-c2a7-4bf8-aea0-5793933799a3"
},
{
"parameters": {
@ -71,18 +71,18 @@
-440,
680
],
"id": "e8eb3c2e-b506-48e0-9d76-f77bf599cb65"
"id": "34cd0412-01da-446d-aafd-8762358766c4"
},
{
"parameters": {
"operation": "upload",
"bucketName": "=missions",
"fileName": "={{$input.item.json.sanitizedName}}/{{$input.item.json.fileName}}",
"fileName": "={{$input.item.json.sanitizedName}}/logo.png",
"additionalFields": {
"acl": "public-read"
}
},
"id": "e06d90e2-09fc-4512-9467-03c617b7fef2",
"id": "d469dea0-f1bd-4896-a385-88194bc28b94",
"name": "S3 Upload Logo",
"type": "n8n-nodes-base.s3",
"typeVersion": 1,
@ -109,7 +109,7 @@
-720,
480
],
"id": "76f45b82-130a-45f1-98b8-eb75013e4f67"
"id": "3162b0d4-8947-4d1b-bd38-4cc0ba89dd08"
},
{
"parameters": {
@ -122,7 +122,7 @@
-320,
880
],
"id": "ea6c4d9d-e936-4f81-82c8-61a6cc50eb7d"
"id": "781e38e6-f13d-4b47-a6a7-e081a5ad6a75"
},
{
"parameters": {
@ -135,7 +135,7 @@
-60,
780
],
"id": "8696d145-82db-43b2-8119-66ee438066d4"
"id": "5f18399b-670d-4bf6-bd5c-0cde13908c1d"
},
{
"parameters": {
@ -184,7 +184,7 @@
-80,
520
],
"id": "eb6f6a28-865e-437f-8543-9af850af5ddf",
"id": "8dd4857b-f536-4acb-ab4e-b15e7f16d2ad",
"continueOnFail": true
},
{
@ -198,7 +198,7 @@
160,
680
],
"id": "08e00de9-c887-428d-b15a-b04d7c27bb32",
"id": "7bdee26f-dccb-42eb-8204-f5260577bf7b",
"continueOnFail": true
},
{
@ -212,7 +212,7 @@
160,
880
],
"id": "0669c514-4f7e-44ad-a1a3-a6b9518b3b71"
"id": "2e46ba3f-1466-4eb2-9868-126552f389bc"
},
{
"parameters": {
@ -232,7 +232,7 @@
140,
500
],
"id": "320f5719-682b-4926-ba20-f7ebc0b15967"
"id": "014e0ad5-dc21-4e21-be9f-fcc085aa0ca8"
},
{
"parameters": {
@ -289,9 +289,9 @@
460,
460
],
"id": "6b7f99e2-8dcc-48b0-8ef5-dcaaa3acf1ad",
"continueOnFail": true,
"errorMessage": "={{ $json.error?.message || 'Unknown error creating Git repository' }}"
"id": "016939d6-a0d9-4f44-9c02-1a289cd39243",
"errorMessage": "={{ $json.error?.message || 'Unknown error creating Git repository' }}",
"continueOnFail": true
},
{
"parameters": {
@ -348,7 +348,7 @@
460,
620
],
"id": "c2530d9b-4733-49de-bead-c4d3af09916d",
"id": "49e76ac2-2dbf-497a-bdce-2eefd09acabb",
"continueOnFail": true
},
{
@ -414,7 +414,7 @@
480,
940
],
"id": "77a70da5-dc7f-4c48-9836-6d1d2064be1b",
"id": "edbefc50-bdf2-4807-996d-f06c3e5d526a",
"continueOnFail": true
},
{
@ -476,7 +476,7 @@
460,
760
],
"id": "0bbfdeaa-fc6e-4f00-b85e-fe994bef1bc9",
"id": "fd2abbe2-ff12-4ab0-9308-115eb2a1da14",
"continueOnFail": true
},
{
@ -490,7 +490,7 @@
660,
600
],
"id": "dbccf675-ef1a-4b2f-babc-7e59b9e6a216",
"id": "d4be7e93-0a23-4c7b-b936-91fe88e531ae",
"continueOnFail": true
},
{
@ -587,7 +587,7 @@
820,
600
],
"id": "5b4557b7-3559-4ce4-80a2-179bc3180ac8"
"id": "dedd43e5-6b46-4dba-8eeb-008648549344"
},
{
"parameters": {
@ -600,7 +600,7 @@
1000,
600
],
"id": "88c3f621-9d42-45d0-8231-8f7ac0186f0f"
"id": "595a8f1b-c5dd-4905-a70d-676e48670495"
},
{
"parameters": {
@ -615,7 +615,7 @@
1220,
600
],
"id": "446ed359-ebc3-4954-b115-9c5dca73747c"
"id": "870509e0-39fc-44e0-81ff-cec9f41e7522"
},
{
"parameters": {
@ -633,7 +633,7 @@
-280,
680
],
"id": "8c233d82-9495-45de-9ffc-aed5faa703b8",
"id": "179cd4d0-44db-400a-b7af-044f1aff5557",
"credentials": {
"s3": {
"id": "xvSkHfsTBJxzopIj",
@ -658,15 +658,14 @@
600
],
"webhookId": "mission-created",
"id": "ded0bff4-be16-4e88-991b-47e85120de29"
"id": "de1fdb33-3e7c-43bc-86b9-aa3bdc3c36d0"
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json.skipIntegrations }}",
"value2": false
"value1": "={{ $json.skipIntegrations }}"
}
]
}
@ -678,7 +677,7 @@
140,
500
],
"id": "320f5719-682b-4926-ba20-f7ebc0b15967"
"id": "adfe1ad8-2657-4145-b97d-852a008f9643"
},
{
"parameters": {
@ -691,7 +690,20 @@
0,
600
],
"id": "merge-paths-node"
"id": "7d8692fa-9e3c-4c57-8995-36bb58a33345"
},
{
"parameters": {
"functionCode": "// Get the input from the previous node\nconst input = $input.item.json;\n\n// Log the full input for debugging\nconsole.log('Set Logo Path - Full Input:', JSON.stringify(input, null, 2));\n\n// Get sanitizedName from Process Mission Data node\nconst missionData = $node['Process Mission Data']?.json?.missionProcessed || {};\nconst sanitizedName = missionData.sanitizedName || '';\n\n// Construct the path using sanitizedName\nconst logoPath = sanitizedName ? `${sanitizedName}/logo.png` : '';\n\n// Construct the full URL using the MinIO endpoint\nconst logoUrl = logoPath ? `https://dome-api.slm-lab.net/missions/${logoPath}` : '';\n\n// Log the output for debugging\nconsole.log('Set Logo Path - Output:', { \n sanitizedName,\n logoPath, \n logoUrl,\n hasMissionData: !!missionData,\n missionDataKeys: Object.keys(missionData)\n});\n\n// Return both the path and URL\nreturn {\n logoPath,\n logoUrl,\n ...input // Preserve all other input data\n};"
},
"id": "d8c15a4c-4d2b-4a15-8538-eec70dc7e898",
"name": "Set Logo Path",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-300,
480
]
}
],
"pinData": {},
@ -730,6 +742,17 @@
]
},
"S3 Upload Logo": {
"main": [
[
{
"node": "Set Logo Path",
"type": "main",
"index": 0
}
]
]
},
"Set Logo Path": {
"main": [
[
{
@ -986,11 +1009,11 @@
"settings": {
"executionOrder": "v1"
},
"versionId": "850a95bd-fd96-4626-af02-56d489a194e5",
"versionId": "dbf86c0d-d0f8-48c4-95e3-5b6a409a9cee",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "575d8de48bd511243817deebddae0cc97d73be64c6c4737e5d4e9caddec881d8"
},
"id": "CAO29zOiTqMcscxO",
"id": "pYPCwygv5xatdCQK",
"tags": []
}