mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-28 18:06:30 +02:00
Fix vercel (#241)
* use static imports for prebuilt cards * fixed s3 env variables
This commit is contained in:
parent
5efdee18eb
commit
ad7a0d313b
5 changed files with 47 additions and 53 deletions
16
apps/rowboat/app/lib/prebuilt-cards/index.ts
Normal file
16
apps/rowboat/app/lib/prebuilt-cards/index.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Static index of prebuilt workflow templates so they are bundled in Vercel
|
||||
// If you add/remove a JSON here, update this file accordingly.
|
||||
|
||||
import githubDataToSpreadsheet from './github-data-to-spreadsheet.json';
|
||||
import interviewScheduler from './interview-scheduler.json';
|
||||
import meetingPrepAssistant from './Meeting Prep Assistant.json';
|
||||
import redditOnSlack from './Reddit on Slack.json';
|
||||
|
||||
// Keep keys consistent with prior file basenames to avoid breaking links.
|
||||
export const prebuiltTemplates = {
|
||||
'github-data-to-spreadsheet': githubDataToSpreadsheet,
|
||||
'interview-scheduler': interviewScheduler,
|
||||
'Meeting Prep Assistant': meetingPrepAssistant,
|
||||
'Reddit on Slack': redditOnSlack,
|
||||
};
|
||||
|
||||
|
|
@ -1,19 +1,13 @@
|
|||
import { WorkflowTemplate } from "./types/workflow_types";
|
||||
import { z } from 'zod';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
import { prebuiltTemplates } from './prebuilt-cards';
|
||||
|
||||
const DEFAULT_MODEL = process.env.PROVIDER_DEFAULT_MODEL || "gpt-4.1";
|
||||
|
||||
// Function to load prebuilt cards from JSON files
|
||||
function loadTemplatesFromFiles(): { [key: string]: z.infer<typeof WorkflowTemplate> } {
|
||||
const templatesDir = path.join(__dirname, 'prebuilt-cards');
|
||||
// Build templates object using static imports so Vercel bundles them
|
||||
function buildTemplates(): { [key: string]: z.infer<typeof WorkflowTemplate> } {
|
||||
const templates: { [key: string]: z.infer<typeof WorkflowTemplate> } = {};
|
||||
|
||||
|
||||
// Add default template
|
||||
templates['default'] = {
|
||||
name: 'Blank Template',
|
||||
|
|
@ -51,41 +45,19 @@ function loadTemplatesFromFiles(): { [key: string]: z.infer<typeof WorkflowTempl
|
|||
},
|
||||
],
|
||||
};
|
||||
|
||||
try {
|
||||
// Check if prebuilt cards directory exists
|
||||
if (fs.existsSync(templatesDir)) {
|
||||
const files = fs.readdirSync(templatesDir);
|
||||
|
||||
// Load each JSON file
|
||||
files.forEach(file => {
|
||||
if (path.extname(file) === '.json') {
|
||||
try {
|
||||
const filePath = path.join(templatesDir, file);
|
||||
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
||||
const templateData = JSON.parse(fileContent);
|
||||
|
||||
// Use filename without extension as template key
|
||||
const templateKey = path.basename(file, '.json');
|
||||
|
||||
// Validate template structure (optional - you can add more validation)
|
||||
if (templateData.agents && Array.isArray(templateData.agents)) {
|
||||
templates[templateKey] = templateData;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`Failed to load prebuilt card ${file}:`, error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Merge static prebuilt templates
|
||||
Object.entries(prebuiltTemplates).forEach(([key, tpl]) => {
|
||||
// Basic guard to avoid bad entries
|
||||
if ((tpl as any)?.agents && Array.isArray((tpl as any).agents)) {
|
||||
templates[key] = tpl as z.infer<typeof WorkflowTemplate>;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Failed to load prebuilt cards from directory:', error);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return templates;
|
||||
}
|
||||
|
||||
export const templates: { [key: string]: z.infer<typeof WorkflowTemplate> } = loadTemplatesFromFiles();
|
||||
export const templates: { [key: string]: z.infer<typeof WorkflowTemplate> } = buildTemplates();
|
||||
|
||||
// Note: Prebuilt cards are now loaded from app/lib/prebuilt-cards/ directory
|
||||
// starting_copilot_prompts has been removed as it was unused
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import { S3Client } from "@aws-sdk/client-s3";
|
||||
|
||||
export const uploadsS3Client = new S3Client({
|
||||
region: process.env.UPLOADS_AWS_REGION || 'us-east-1',
|
||||
credentials: {
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID || '',
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || '',
|
||||
},
|
||||
});
|
||||
region: process.env.RAG_UPLOADS_S3_REGION || process.env.AWS_REGION || 'us-east-1',
|
||||
credentials: (process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY)
|
||||
? {
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
||||
}
|
||||
: undefined as any,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue