feat: add stock database with prisma for portfolio persistence
- Initialize Prisma with SQLite and Stock model - Create database service layer with singleton client - Add API routes for stock CRUD operations - Integrate database with analyze page to persist ticker entries - Add Playwright tests for stock database functionality
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
declare global {
|
||||
var prisma: PrismaClient | undefined;
|
||||
}
|
||||
|
||||
const prismaClientSingleton = () => {
|
||||
return new PrismaClient();
|
||||
};
|
||||
|
||||
export const db = global.prisma || prismaClientSingleton();
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
global.prisma = db;
|
||||
}
|
||||
+11
-10
@@ -9,20 +9,21 @@ type OpenRouterConfig = {
|
||||
};
|
||||
|
||||
export class OpenRouterClient {
|
||||
private apiKey: string;
|
||||
private baseURL: string;
|
||||
private defaultModel: string;
|
||||
private freeModels = [
|
||||
"google/gemini-2.0-flash-exp:free",
|
||||
"deepseek/deepseek-chat:free",
|
||||
"meta/llama-3.3-70b-instruct:free",
|
||||
];
|
||||
private providers = ["openai", "google", "anthropic", "deepseek", "meta", "xai"];
|
||||
private apiKey: string;
|
||||
private baseURL: string;
|
||||
private defaultModel: string;
|
||||
private freeModels = [
|
||||
"openai/gpt-oss-120b:free",
|
||||
"openrouter/free",
|
||||
"deepseek/deepseek-chat:free",
|
||||
"meta/llama-3.3-70b-instruct:free",
|
||||
];
|
||||
private providers = ["openai", "google", "anthropic", "deepseek", "meta", "xai"];
|
||||
|
||||
constructor(apiKey: string, config?: OpenRouterConfig) {
|
||||
this.apiKey = apiKey;
|
||||
this.baseURL = config?.baseURL ?? "https://openrouter.ai/api/v1";
|
||||
this.defaultModel = config?.defaultModel ?? "google/gemini-2.0-flash-exp:free";
|
||||
this.defaultModel = config?.defaultModel ?? "openai/gpt-oss-120b:free";
|
||||
}
|
||||
|
||||
getFreeModels(): string[] {
|
||||
|
||||
Reference in New Issue
Block a user