Brings the working codebase (Next.js app, auth system, Stripe billing, Docker/deploy config, tests, docs) into version control on top of the placeholder initial commit, and adds account self-deletion (Danger Zone in Settings, password + typed-email confirmation, cascading DB cleanup, Stripe cancellation) per GDPR right-to-erasure. Excludes local build caches, node_modules, and internal agent scratch files; .gitignore hardened to keep those out going forward. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import fs from "fs";
|
|
import { extractReceiptData } from "../src/lib/ai/extractor";
|
|
|
|
const content = fs.readFileSync(".env.local", "utf8");
|
|
for (const l of content.split("\n")) {
|
|
const trimmed = l.trim();
|
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
const idx = trimmed.indexOf("=");
|
|
if (idx !== -1) {
|
|
process.env[trimmed.slice(0, idx).trim()] = trimmed.slice(idx + 1).trim();
|
|
}
|
|
}
|
|
|
|
async function test() {
|
|
console.log("Model:", process.env.OPENROUTER_MODEL);
|
|
console.log("Key prefix:", process.env.OPENROUTER_API_KEY?.substring(0, 10));
|
|
|
|
// Test demo fallback
|
|
const start = Date.now();
|
|
try {
|
|
const dummyBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";
|
|
const res = await extractReceiptData({ base64DataUrl: dummyBase64, fileName: "01_aral_tankbeleg.jpg" });
|
|
console.log("Result in " + (Date.now() - start) + "ms:", res.merchant.name, res.totalAmount.value);
|
|
} catch (e) {
|
|
console.error("Test error:", e);
|
|
}
|
|
}
|
|
|
|
test();
|