Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/christogoodrich_dahonghua-jizhang.json

1 line
7.0 KiB
JSON

{"repo": "christogoodrich/dahonghua-jizhang", "files": {".env.example": {"6d7888e736dd218c3ccb01587fed1d749e818444": {"t": 1785595226.1220007, "n": 716, "h": "10b0bc3a752accea", "c": "# Copy to .env and fill in from Supabase → Project Settings → API.\n# Leaving these unset keeps the app in pure offline/local mode.\nEXPO_PUBLIC_SUPABASE_URL=\nEXPO_PUBLIC_SUPABASE_ANON_KEY=\n\n# AI quick-entry (see AI_SETUP.md). Unset both = the ✨ AI bar is hidden.\n# Option 1 (secure): a proxy server that holds the LLM key.\nEXPO_PUBLIC_AI_PROXY_URL=\n# Option 2 (personal builds only — key ships in the app bundle): Xiaomi MiMo direct.\n# Put the real key in .env.local (gitignored), not here.\nEXPO_PUBLIC_MIMO_API_KEY=\n# EXPO_PUBLIC_MIMO_BASE_URL=https://api.xiaomimimo.com/v1\n# EXPO_PUBLIC_MIMO_MODEL=mimo-v2.5-pro\n\n# Sentry crash reporting (https://sentry.io — Project Settings → Client Keys)\nEXPO_PUBLIC_SENTRY_DSN=\n"}}, "AI_SETUP.md": {"6d7888e736dd218c3ccb01587fed1d749e818444": {"t": 1785674304.6057239, "n": 2866, "h": "592f764d64db4b78", "c": "# AI 记账 setup (natural-language quick entry)\n\nType a sentence like **“午饭35”** or **“coffee 4.5”** in the record sheet and tap ✨ —\nClaude extracts the amount, category, income/expense, and a note, and fills the form.\n\nThe app **never holds the Anthropic API key**. It calls a small server proxy you\ndeploy; the proxy calls Claude. When the proxy isn't configured the AI bar is\nhidden and the app works exactly as before (fully offline, manual entry).\n\n## 1. Deploy the proxy (Supabase Edge Function)\n\nThe reference proxy lives at `supabase/functions/ai-parse/index.ts`. It uses the\nofficial Anthropic SDK and `claude-opus-4-8` with structured outputs, so it returns\nstrictly-shaped JSON.\n\n```bash\n# from dahonghua-app/\nsupabase functions deploy ai-parse --no-verify-jwt\nsupabase secrets set ANTHROPIC_API_KEY=sk-ant-... # your key, server-side only\n```\n\nThe function URL is `https://<project-ref>.supabase.co/functions/v1/ai-parse`.\n\n> Any HTTPS endpoint that accepts `POST {text, lang, categories:{exp[],inc[]}}` and\n> returns `{io,amount,category,note}` works — a Cloudflare Worker, a Vercel function,\n> your own Node/Deno server. Just keep the API key on the server.\n\n## 2. Point the app at it\n\nIn `.env` (see `.env.example`):\n\n```\nEXPO_PUBLIC_AI_PROXY_URL=https://<project-ref>.supabase.co/functions/v1/ai-parse\n```\n\nRebuild / restart Expo so the env var is picked up.\n\n## How it works\n\n- `src/ai/parse.ts` — pure prompt building + result normalization (resolves the\n model's category label to one of your category keys; rounds/clamps the amount).\n Fully unit-tested, no network.\n- `src/ai/client.ts` — `aiConfigured()` + `parseEntryText()`; no-op returning\n `null` when neither `EXPO_PUBLIC_AI_PROXY_URL` nor `EXPO_PUBLIC_MIMO_API_KEY` is\n set. Proxy takes priority; otherwise it calls MiMo's `/chat/completions` directly.\n- `supabase/functions/ai-parse/index.ts` — the reference server-side proxy call.\n\n## Option B — Xiaomi MiMo direct (personal builds only)\n\nSkip the proxy and call Xiaomi **MiMo**'s OpenAI-compatible API straight from the\napp. Simplest to set up, but the key is **embedded in the app bundle** and can be\nextracted by anyone who installs the build — use this only for a personal app you\nrun yourself, never a published/store build.\n\nPut the key in **`.env.local`** (gitignored — never `.env` or source):\n\n```\nEXPO_PUBLIC_MIMO_API_KEY=sk-...\n# optional overrides (defaults shown):\n# EXPO_PUBLIC_MIMO_BASE_URL=https://api.xiaomimimo.com/v1\n# EXPO_PUBLIC_MIMO_MODEL=mimo-v2.5-pro\n```\n\nThe MiMo account needs an active balance / token plan — an empty account returns\n`402 insufficient_balance`. Get a key + top up at the MiMo console (mimo.mi.com).\n\n## Cost & privacy\n\nEach parse is one short Claude request (a few hundred tokens). Only the sentence you\ntype and your category names are sent to the proxy; nothing is sent until you tap ✨.\n"}, "429f5466a0f2ab96ac68ec3d9ef8462febecc862": {"t": 1785846874.1435466, "n": 2866, "h": "592f764d64db4b78", "c": "# AI 记账 setup (natural-language quick entry)\n\nType a sentence like **“午饭35”** or **“coffee 4.5”** in the record sheet and tap ✨ —\nClaude extracts the amount, category, income/expense, and a note, and fills the form.\n\nThe app **never holds the Anthropic API key**. It calls a small server proxy you\ndeploy; the proxy calls Claude. When the proxy isn't configured the AI bar is\nhidden and the app works exactly as before (fully offline, manual entry).\n\n## 1. Deploy the proxy (Supabase Edge Function)\n\nThe reference proxy lives at `supabase/functions/ai-parse/index.ts`. It uses the\nofficial Anthropic SDK and `claude-opus-4-8` with structured outputs, so it returns\nstrictly-shaped JSON.\n\n```bash\n# from dahonghua-app/\nsupabase functions deploy ai-parse --no-verify-jwt\nsupabase secrets set ANTHROPIC_API_KEY=sk-ant-... # your key, server-side only\n```\n\nThe function URL is `https://<project-ref>.supabase.co/functions/v1/ai-parse`.\n\n> Any HTTPS endpoint that accepts `POST {text, lang, categories:{exp[],inc[]}}` and\n> returns `{io,amount,category,note}` works — a Cloudflare Worker, a Vercel function,\n> your own Node/Deno server. Just keep the API key on the server.\n\n## 2. Point the app at it\n\nIn `.env` (see `.env.example`):\n\n```\nEXPO_PUBLIC_AI_PROXY_URL=https://<project-ref>.supabase.co/functions/v1/ai-parse\n```\n\nRebuild / restart Expo so the env var is picked up.\n\n## How it works\n\n- `src/ai/parse.ts` — pure prompt building + result normalization (resolves the\n model's category label to one of your category keys; rounds/clamps the amount).\n Fully unit-tested, no network.\n- `src/ai/client.ts` — `aiConfigured()` + `parseEntryText()`; no-op returning\n `null` when neither `EXPO_PUBLIC_AI_PROXY_URL` nor `EXPO_PUBLIC_MIMO_API_KEY` is\n set. Proxy takes priority; otherwise it calls MiMo's `/chat/completions` directly.\n- `supabase/functions/ai-parse/index.ts` — the reference server-side proxy call.\n\n## Option B — Xiaomi MiMo direct (personal builds only)\n\nSkip the proxy and call Xiaomi **MiMo**'s OpenAI-compatible API straight from the\napp. Simplest to set up, but the key is **embedded in the app bundle** and can be\nextracted by anyone who installs the build — use this only for a personal app you\nrun yourself, never a published/store build.\n\nPut the key in **`.env.local`** (gitignored — never `.env` or source):\n\n```\nEXPO_PUBLIC_MIMO_API_KEY=sk-...\n# optional overrides (defaults shown):\n# EXPO_PUBLIC_MIMO_BASE_URL=https://api.xiaomimimo.com/v1\n# EXPO_PUBLIC_MIMO_MODEL=mimo-v2.5-pro\n```\n\nThe MiMo account needs an active balance / token plan — an empty account returns\n`402 insufficient_balance`. Get a key + top up at the MiMo console (mimo.mi.com).\n\n## Cost & privacy\n\nEach parse is one short Claude request (a few hundred tokens). Only the sentence you\ntype and your category names are sent to the proxy; nothing is sent until you tap ✨.\n"}}}}