project-nomad/admin/database/migrations
just-jbc ac141a33b4
feat(rag): add subject/collection organization to knowledge base (#1063)
* feat(rag): add subject/collection organization to knowledge base

- Add nullable collection field to KbIngestState, propagated through the
  embed job, RAG service, and Qdrant point payloads (indexed for filtering)
- Add upload-time category selection and per-file collection reassignment
  in the Knowledge Base modal, with a filterable Stored Files table
- Add a 'Search in' collection filter to the chat interface, threaded
  through to searchSimilarDocuments as an optional Qdrant filter
- Fix .docx extraction: previously routed through raw-text extraction
  (garbage output for a ZIP-based XML format); adds a proper mammoth-based
  extractor and a dedicated 'docx' file-type case

* feat(rag): support dynamic KB collection creation, rename, and removal

Extends collection organization with a Manage Collections UI: collections
are created on the fly when a file is assigned to a new name, can be
renamed (bulk-updates every tagged file and Qdrant point), and can be
removed (reassigns tagged files back to Uncategorized rather than
deleting anything).

* fix(rag): use dynamic collections query in chat search filter

chat/index.tsx still imported the static KB_COLLECTIONS constant for its
'Search in' dropdown, inconsistent with KnowledgeBaseModal.tsx which already
uses the live getKnowledgeCollections() query. Renamed/added collections
via the new Manage Collections UI weren't reflected in the chat filter.

* feat(rag): broaden preset tags and add creatable collection combobox

Replaces the survival-specific preset list with general-purpose starter
tags (recipes, diy, health, technology, finance, travel, hobbies,
reference, survival, energy) so the Knowledge Base reads well for
home-lab/reference use, not just prepping.

Adds sanitizeCollectionName() (trim, lowercase, length cap) applied on
every write path server-side, and a dependency-free CollectionCombobox
component replacing the plain <select> + window.prompt pattern for
tagging — autocompletes against presets + tags already in use, with a
'+ Create' option for anything new.

* chore(rag): remove .docx fix from this branch, split into #1100

Per review feedback, the .docx extraction fix is unrelated to the
collections feature and can merge independently. Moved to a standalone
PR (Crosstalk-Solutions/project-nomad#1100) off dev.

* chore: remove unrelated diff noise (lockfile, comments, indentation)

---------

Co-authored-by: John Cortright <jcortright@zscaler.com>
2026-08-04 03:37:42 +00:00
..
1751086751801_create_services_table.ts
…
1763499145832_update_services_table.ts
…
1764912210741_create_curated_collections_table.ts
…
1764912270123_create_curated_collection_resources_table.ts
…
1768170944482_update_services_add_installation_statuses_table.ts
…
1768453747522_update_services_add_icon.ts
…
1769097600001_create_benchmark_results_table.ts
…
1769097600002_create_benchmark_settings_table.ts
…
1769300000001_add_powered_by_and_display_order_to_services.ts
…
1769300000002_update_services_friendly_names.ts
…
1769324448000_add_builder_tag_to_benchmark_results.ts
…
1769400000001_create_installed_tiers_table.ts
…
1769400000002_create_kv_store_table.ts
…
1769500000001_create_wikipedia_selection_table.ts
…
1769646771604_create_create_chat_sessions_table.ts
…
1769646798266_create_create_chat_messages_table.ts
…
1769700000001_create_zim_file_metadata_table.ts
…
1770269324176_add_unique_constraint_to_curated_collection_resources_table.ts
…
1770273423670_drop_installed_tiers_table.ts
…
1770849108030_create_create_collection_manifests_table.ts
…
1770849119787_create_create_installed_resources_table.ts
…
1770850092871_create_drop_legacy_curated_tables_table.ts
…
1771000000001_add_update_fields_to_services.ts
…
1771000000002_pin_latest_service_images.ts
…
1771100000001_migrate_kiwix_to_library_mode.ts
…
1771200000001_create_map_markers_table.ts
…
1772000000001_add_supply_depot_fields_to_services.ts
…
1772000000002_add_user_modified_to_services.ts
…
1772000000003_add_app_auto_update_fields_to_services.ts
…
1775100000001_create_custom_library_sources_table.ts
…
1776000000001_create_kb_ingest_state_table.ts
…
1776100000001_create_kb_ratio_registry_table.ts
…
1776200000001_add_content_auto_update_fields_to_installed_resources.ts
…
1776200000001_add_custom_url_to_services.ts
…
1776300000001_deprecate_legacy_kolibri.ts
…
1776400000001_add_benchmark_harness_metadata.ts
…
1776400000001_add_collection_to_kb_ingest_state.ts feat(rag): add subject/collection organization to knowledge base (#1063) 2026-08-04 03:37:42 +00:00
1776400000001_sunset_meshtastic_daemon.ts
…