This commit is contained in:
2026-03-25 19:46:14 -03:00
parent 9d5413a522
commit 26f61077b8
13 changed files with 382 additions and 187 deletions

View File

@@ -1,7 +1,7 @@
import { defineConfig } from 'drizzle-kit';
import * as dotenv from 'dotenv';
dotenv.config();
dotenv.config({ path: ['.env.local', '.env'] });
export default defineConfig({
schema: './src/db/schema.ts',

View File

@@ -1,6 +1,6 @@
import OpenAI from 'openai';
import * as dotenv from 'dotenv';
dotenv.config();
dotenv.config({ path: ['.env.local', '.env'] });
export const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,

View File

@@ -2,7 +2,7 @@ import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import * as dotenv from 'dotenv';
dotenv.config();
dotenv.config({ path: ['.env.local', '.env'] });
const connectionString = process.env.DATABASE_URL || 'postgres://user:password@iris.haven:5432/recommender';
export const client = postgres(connectionString);

View File

@@ -3,10 +3,10 @@ import * as dotenv from 'dotenv';
import recommendationsRoute from './routes/recommendations.js';
import feedbackRoute from './routes/feedback.js';
// Load .env first, then .env.local
// env vars set on the container take precedence over both files
dotenv.config();
dotenv.config({ path: '.env.local', override: true });
// Load .env.local first, then .env.
// dotenv 17+ supports array of paths, where the first path has the highest priority.
// Env vars set on the container (system) will take precedence over both.
dotenv.config({ path: ['.env.local', '.env'] });
const fastify = Fastify({ logger: true });

View File

@@ -7,6 +7,13 @@ import { runRanking } from '../agents/ranking.js';
import { runCurator } from '../agents/curator.js';
import type { CuratorOutput, SSEEvent } from '../types/agents.js';
/* -- Agent pipeline --
[1] Interpreter -> gets user input, transforms into structured data
[2] Retrieval -> gets shows from OpenAI (high temperature)
[3] Ranking -> ranks shows based on user input
[4] Curator -> curates shows based on user input
*/
type RecommendationRecord = typeof recommendations.$inferSelect;
function log(recId: string, msg: string, data?: unknown) {