open-notebook/api/routers
Luis Novo d8006ff5cb
feat: content-type aware chunking and unified embedding (#444)
* feat: content-type aware chunking and unified embedding

- Add chunking.py with HTML, Markdown, and plain text detection
- Add embedding.py with mean pooling for large content
- Create dedicated commands: embed_note, embed_insight, embed_source
- Use fire-and-forget pattern for embedding via submit_command()
- Refactor rebuild_embeddings_command to delegate to individual commands
- Remove legacy commands and needs_embedding() methods
- Reduce chunk size to 1500 chars for Ollama compatibility
- Update CLAUDE.md documentation for new architecture

Fixes #350, #142

* fix: address code review issues

- Note.save() now returns command_id for tracking embedding jobs
- Add length check after generate_embeddings() to fail fast on mismatch
- Add numpy as explicit dependency (was transitive)
- Remove hardcoded chunk sizes from docstrings

* docs: address code review comments

- Rename "SYNC PATH" to "DOMAIN MODEL PATH" in embedding router
- Add test_chunking.py and test_embedding.py to Testing Strategy
- Clarify auto-embedding behavior for each domain model

* fix: clean thinking tags from prompt graph output

Adds clean_thinking_content() to prompt.py to handle extended thinking
models that return <think>...</think> tags. This fixes empty titles
when saving notes from chat.

* chore: remove local docker-compose from git

* fix(frontend): handle null parent_id in search results

Add defensive check for null parent_id in search results to prevent
"Cannot read properties of null (reading 'split')" error. This can
happen with orphaned records in the database.

* fix: cascade delete embeddings and insights when source is deleted

When deleting a Source, now also deletes associated:
- source_embedding records
- source_insight records

This prevents orphaned records that cause null parent_id errors
in vector search results.

* fix: add cleanup for orphan embedding/insight records in migration 10

Deletes source_embedding and source_insight records where the
linked source no longer exists (source.id = NONE).

* chore: bump esperanto to 2.16

Increases ctx_num for Ollama models to accommodate larger notebook
context windows. See: https://github.com/lfnovo/esperanto/pull/69
2026-01-21 23:49:08 -03:00
..
__init__.py Api podcast migration (#93) 2025-07-17 08:36:11 -03:00
auth.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
chat.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
commands.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
config.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
context.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
embedding.py feat: content-type aware chunking and unified embedding (#444) 2026-01-21 23:49:08 -03:00
embedding_rebuild.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
episode_profiles.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
insights.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
models.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
notebooks.py feat: add ability to link existing sources to notebooks (OSS-311) (#177) 2025-10-19 17:52:14 -03:00
notes.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
podcasts.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
search.py refactor: reorganize folder structure for better maintainability 2026-01-03 14:04:27 -03:00
settings.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
source_chat.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
sources.py fix(api): correct embedded flag check in source listing (#439) 2026-01-16 09:33:01 -03:00
speaker_profiles.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00
transformations.py Feat/localization tests docker (#371) 2026-01-15 13:51:05 -03:00