Spaces:
Sleeping
Sleeping
Commit History
-
feat: add OpenAI as an AI provider option
elvigar +1: Claude Sonnet 5Requested as an alternative after hitting friction getting Hugging Face working (models need their serving provider separately enabled per-account, on top of picking an ungated model). - ai-gateway.server.ts: createOpenAIProvider(), reusing createOpenAICompatible against api.openai.com/v1 rather than adding a separate @ai-sdk/openai dependency, consistent with the existing Ollama/Hugging Face providers. Inserted into the precedence chain as Ollama -> OpenAI -> Hugging Face -> Lovable -> error. OPENAI_MODEL is required with no hardcoded default, same reasoning as HF_MODEL — OpenAI's model lineup changes over time. - DEPLOYMENT.md/CLAUDE.md/.env: document the new provider, and note explicitly that a ChatGPT Plus/Pro subscription does not include API access (common point of confusion) — also folded in the Hugging Face "provider must be enabled on your account" gotcha discovered while debugging the deployed Space. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com…3338ddc -
docs: replace gated Llama example with a verified ungated HF_MODEL
elvigar +1: Claude Sonnet 5meta-llama/Llama-3.1-8B-Instruct is real but gated (requires manual per-account approval on its model page), which surfaces as a generic "does not exist" error via the Inference Providers router rather than an access-denied error — that's what broke the deployed Space. Swapped the example everywhere to Qwen/Qwen2.5-7B-Instruct-1M, which I verified via the Hub API is ungated and live on the featherless-ai provider. Also called out the gating gotcha explicitly in DEPLOYMENT.md and the HF_MODEL error message. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>4bf5888 -
feat: Dockerize the app and add Hugging Face as an AI provider
elvigar +1: Claude Sonnet 5Enables self-hosted deployment (Docker now, Hugging Face Spaces later) and an open-weight AI backend that doesn't depend on Lovable. - ai-gateway.server.ts: add createHuggingFaceProvider(), using Hugging Face's OpenAI-compatible Inference Providers router (router.huggingface.co/v1). Provider precedence is now Ollama -> Hugging Face -> Lovable -> error; Hugging Face auto-selects when HF_TOKEN is set (or AI_PROVIDER=huggingface explicitly), HF_MODEL is required (no hardcoded default — model/provider availability changes over time). - vite.config.ts: pin the Nitro build preset to node-server instead of the wrapped config's Cloudflare Workers default, since Docker/HF Spaces need a plain Node server. Verified this produces a self-contained .output/server/index.mjs that runs with no node_modules present. - Dockerfile (new): multi-stage oven/bun build; runtime stage only copies .output (verified self-contained), runs as the image's built-in non-root `bun` user, listen…4b56b43 -
fix: address second-pass review findings on the rate limiter and shared math migration
elvigar +1: Claude Sonnet 5Follow-up from a targeted review of the previous fix commit: - Rate limiter buckets were keyed by IP only, so /api/chat (limit 10/min) and generateBudgetInsights (limit 5/min) shared the same bucket per client and interfered with each other. Added getClientKey(namespace) in rate-limit.server.ts to scope buckets per endpoint. - getRequestIP({ xForwardedFor: true }) trusted the X-Forwarded-For header unconditionally, letting a direct (non-proxied) client spoof a fresh IP per request and bypass the limiter entirely. Now gated behind a TRUST_PROXY_HEADERS env var, off by default. - checkRateLimit() pruned every key in the map on every call (O(total keys) per request). Now prunes the requested key eagerly and sweeps the full map only periodically. - /api/chat's system prompt leaked the app's internal "OTHER" sentinel as a literal currency code when a user had a custom currency selected. Suppressed for that sentinel value. - index.tsx still hand-rolled the unallocated an…3ad1a84 -
fix: resolve code review findings — AI context bugs, buffer consistency, rate limiting
elvigar +1: Claude Sonnet 5Fixes from docs/code_review.md: - AdviserChat sent stale budget context after the first message because useChat() only builds its transport once; read context from a ref inside prepareSendMessagesRequest instead (§1.1). - /api/chat crashed for every message when the user picked a custom currency, since it re-derived formatting via Intl.NumberFormat(rawCurrencyCode); now formats via the client-supplied currencySymbol like the other two AI surfaces already did (§1.2). - The reserved savings buffer was silently dropped from the PDF export, AI insights, and adviser chat, producing a different "unallocated" figure than the on-screen summary (§1.3). - Over-funded goals produced a negative "required monthly contribution" in the insights prompt (§1.4). - A goal's currentProgress of exactly 0 was dropped from the chat context by a truthy check (§1.5). Root cause: the same unallocated/goal-contribution/money-formatting logic was reimplemented slightly differently across index…b58a128 -
chore: initial commit of existing project state
elvigar +1: Claude Sonnet 5Baseline snapshot of the Budget Blueprint app before the code-review fix-up work (see docs/code_review.md). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>d9f6284