Files
lagos-back/src/lib/openai.ts
T
mstfyldzandClaude Sonnet 5 c939dcf564 feat: iddianame-first case summary + remove hardcoded AI endpoint
- summarizeCase: if an iddianame is among the case's documents, run a
  narrow first-pass analysis on it alone (isnatEdilenSuc, iddiaOzeti,
  onemliTarihler), then feed that as context into the general
  case-wide evaluation instead of treating every document equally.
- ANALYSIS_SYSTEM_PROMPT no longer asks the AI to guess "taraflar" -
  that now comes from real UYAP data (cases.parties) instead.
- Removed the hardcoded RunPod proxy URL fallback from every call
  site (document/chat/precedent controllers + lib/openai.ts) - it was
  a real infra endpoint checked into source. New lib/aiConfig.ts
  throws if RUNPOD_API_BASE_URL isn't set rather than silently
  falling back to it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 20:00:06 +03:00

26 lines
932 B
TypeScript

import OpenAI from 'openai';
import dotenv from 'dotenv';
dotenv.config();
// --- DEEPSEEK CONFIGURATION (PASIFİZE EDİLDİ) ---
// const apiKey = process.env.DEEPSEEK_API_KEY;
// if (!apiKey) {
// console.warn('WARNING: DEEPSEEK_API_KEY is missing from environment variables.');
// }
// export const openai = new OpenAI({
// baseURL: 'https://api.deepseek.com/v1',
// apiKey: apiKey || 'dummy-key',
// });
// ----------------------------------------------
// --- MİZAN (RUNPOD) CONFIGURATION ---
// Gerçek adresi kod içinde sabit tutmuyoruz (bkz. lib/aiConfig.ts) — sadece env'den okunuyor.
const runpodBaseUrl = process.env.RUNPOD_API_BASE_URL ? `${process.env.RUNPOD_API_BASE_URL}/v1` : undefined;
const runpodApiKey = process.env.RUNPOD_API_KEY || 'dummy-key';
export const openai = runpodBaseUrl
? new OpenAI({ baseURL: runpodBaseUrl, apiKey: runpodApiKey })
: null;
// ------------------------------------