Freezmo: self-hosted notes-to-activities study app
Next.js 15 app that turns photos, PDFs, DOCX/PPTX and text into a swipeable feed of AI-generated activities (flashcards, multiple choice, true/false, fill-in-the-blank, matching, ordering, short answer) using the user's own Ollama models. Highlights: - All AI calls run in server route handlers; the browser never talks to Ollama. - Bring-your-own-key mode (default): the key lives only in the browser and is sent per-request; server, local-daemon and shared-key modes also supported. - Client-side document extraction (pdf.js, mammoth, jszip) with scanned-PDF page rendering for the vision model; notes stay in their original language. - ChatGPT-style shell: collapsible sidebar / mobile drawer, neutral token-based light + dark themes, folder organisation, PWA (manifest, SW, offline page). - Strict JSON validation with zod + auto-repair, rate limiting, and request guards (cross-origin, body-size, API-key sanitising). - setup.sh bootstraps deps, .env.local and a production build. Gitignore excludes .env*, the generated pdf.js worker and local scratch files.
This commit is contained in:
parent
3baa0fa8ce
commit
3ea2cea100
83 changed files with 10909 additions and 165 deletions
53
components/ApiKeyBanner.tsx
Normal file
53
components/ApiKeyBanner.tsx
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
"use client";
|
||||
|
||||
import { useHealth } from "@/lib/use-health";
|
||||
import { openSettings } from "@/lib/ui-events";
|
||||
import { Button } from "@/components/ui";
|
||||
|
||||
/**
|
||||
* Tells the user when they need to add (or fix) their own Ollama API key.
|
||||
* Renders nothing in local-daemon / server-key setups.
|
||||
*/
|
||||
export function ApiKeyBanner() {
|
||||
const { health, loading } = useHealth();
|
||||
if (!health || loading) return null;
|
||||
if (health.authMode !== "user-key") return null;
|
||||
|
||||
const rejected = health.keyAccepted === false;
|
||||
if (!health.needsKey && !rejected) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
role="status"
|
||||
className={
|
||||
rejected
|
||||
? "glass-panel animate-rise flex flex-wrap items-center gap-3 rounded-[1.35rem] p-4 text-sm text-rose-900 dark:text-rose-100"
|
||||
: "glass-panel animate-rise flex flex-wrap items-center gap-3 rounded-[1.35rem] p-4 text-sm text-frost-900 dark:text-frost-50"
|
||||
}
|
||||
>
|
||||
<span aria-hidden className="text-xl">
|
||||
🔑
|
||||
</span>
|
||||
<p className="min-w-48 flex-1">
|
||||
<span className="font-bold">
|
||||
{rejected ? "Your Ollama API key was rejected." : "Add your Ollama API key to generate decks."}
|
||||
</span>{" "}
|
||||
<span className="font-normal">
|
||||
Create one at{" "}
|
||||
<a
|
||||
className="font-semibold underline underline-offset-2"
|
||||
href="https://ollama.com/settings/keys"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
ollama.com/settings/keys
|
||||
</a>{" "}
|
||||
and paste it in settings. It stays in this browser — the server never stores it.
|
||||
</span>
|
||||
</p>
|
||||
<Button size="sm" onClick={openSettings}>
|
||||
Add API key
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue