Now give my galaxy a brain β I want to type a question and get an answer from MY notes.
β Create config.json in the project root (NOT inside viewer/ β it must never be accessible through the browser) with placeholders: {"api_key": "PUT-YOUR-KEY-HERE", "model": "YOUR-MODEL"}. I'll paste my API key into this file myself β don't ask me for it. β Add a POST /chat endpoint in server.py: score each note against my question by keyword overlap (title matches count extra), take the top 6, and call the messages API for the model configured in config.json with a system prompt that says: answer ONLY based on these notes, in 2β3 sentences, and admit when the notes don't cover the subject. β The endpoint returns {"answer": "...", "nodes": [indices of notes used]}. β Keep a short conversation history per session on the server so follow-up questions work. β Add a polished input bar at the bottom of the viewer that displays the answer on screen. β The API key must never appear in the browser, HTML, or any file served by the server. β When you're done, restart the server and give me 3 sample questions to test based on my actual notes.
Next: paste your API key into config.json, hard-reload Chrome, and interrogate your own brain. No API key? Tell the assistant: "instead of an API key, make /chat use headless mode (claude -p) with my subscription." Slower, but free.