feat: brain detail sheet — screenshot for links, editable notes, spelling fix

- Link detail: shows screenshot image (clickable to open URL), URL, summary, tags
- Note detail: click note text to edit, save/cancel buttons
- Notes: AI now fixes spelling/grammar instead of rewriting
- AI returns corrected_text field for notes, worker replaces raw_content
- Removed verbose meta grid (folder/confidence/status/saved)
- Folder shown as a pill badge in meta line

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yusuf Suleman
2026-04-01 18:27:27 -05:00
parent 6694795726
commit 2c3f0d263b
3 changed files with 44 additions and 12 deletions

View File

@@ -15,13 +15,16 @@ Given an item (URL, note, document, or file), you must return structured JSON wi
- folder: exactly 1 from this list: {json.dumps(FOLDERS)}
- tags: exactly 2 or 3 from this list: {json.dumps(TAGS)}
- title: a concise, normalized title (max 80 chars)
- summary: a 1-2 sentence summary of the content
- summary: a 1-2 sentence summary of the content (for links/documents only)
- corrected_text: for NOTES ONLY — return the original note text with spelling/grammar fixed. Keep the original meaning, tone, and structure. Only fix typos and obvious errors. Return empty string for non-notes.
- confidence: a float 0.0-1.0 indicating how confident you are
Rules:
- NEVER invent folders or tags not in the lists above
- NEVER skip classification
- NEVER return freeform text outside the schema
- For notes: do NOT summarize. Keep the original text. Only fix spelling.
- For notes: the summary field should be a very short 5-10 word description, not a rewrite.
- Always return valid JSON matching the schema exactly"""
RESPONSE_SCHEMA = {
@@ -41,9 +44,10 @@ RESPONSE_SCHEMA = {
},
"title": {"type": "string"},
"summary": {"type": "string"},
"corrected_text": {"type": "string"},
"confidence": {"type": "number"},
},
"required": ["folder", "tags", "title", "summary", "confidence"],
"required": ["folder", "tags", "title", "summary", "corrected_text", "confidence"],
"additionalProperties": False,
},
},

View File

@@ -111,6 +111,11 @@ async def _process_item(item_id: str):
item.title = classification.get("title") or title or "Untitled"
item.folder = classification.get("folder", "Knowledge")
item.tags = classification.get("tags", ["reference", "read-later"])
# For notes: replace raw_content with spell-corrected version
corrected = classification.get("corrected_text", "")
if item.type == "note" and corrected and corrected.strip():
item.raw_content = corrected
item.summary = classification.get("summary")
item.confidence = classification.get("confidence", 0.0)
item.extracted_text = extracted_text