Files
nibiru-framework.com/application/settings/config/database/201-ai_rag_chunk.sql
stephan 48c839d927 Initial public push: docs cosmos v4 + AI module + framework groundwork
This is the snapshot the production landing site (nibiru-framework.com) is
deployed from. Brings together the recent splash + docs migration to the v4
"Cosmos" design system, the new in-framework AI module, and the framework
groundwork that backs the framework-reference extraction.

What lands:
- docs/: Astro + Starlight site with the v4 dark cosmic palette, GalaxyHero
  canvas constellation, Mission Control chat (wired to /api/oracle →
  api.neuronetz.ai via providers.mjs Ollama), 5-panel MMVC stage
  (Model · AI · Module · Controller · View), translated EN/DE/JA/ES/FR
  content, PWA + sitemap + llms.txt + Umami analytics.
- docs/design-system/: canonical mockup bundle (source/index-v2.html for
  splash, source/docs-system.html + preview/ for docs, SPEC.md, tokens).
- docs/scripts/extraction/framework-reference-v2.md: deep framework
  reference (~1.6k lines, file:line citations, every public factory and
  idiom — basis for the LoRA training corpus.
- application/module/ai/: AI module with chat / embed / RAG / agent
  plugins, plus pdoQuery / httpGet / fileRead tools and Modelfile +
  smoke-test in training/.
- application/module/users/: user / ACL / form-factory traits used as the
  reference plugin pattern for the framework docs.
- application/settings/config/database/: schema + seed migrations
  including the AI module tables (200–203).
- Form factory + autogenerator changes the framework-reference-v2 covers.

Production secrets stay out: docs/.env, settings.production.ini and
ai.production.ini are all gitignored (.example files are in tree).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 15:22:18 +02:00

29 lines
1.6 KiB
SQL

-- =============================================================================
-- ai_rag_chunk
--
-- One row per text chunk in a RAG collection. The embedding column stores
-- the vector as a base64-packed Float32Array (4 bytes/dim). Cosine search
-- is done in PHP after fetching all chunks for the collection — fine up
-- to ~10k chunks per collection. For larger sets, drop in a vector index
-- extension (pgvector, MySQL HeatWave LakeHouse vector) and update
-- Rag::search() accordingly.
-- =============================================================================
CREATE TABLE IF NOT EXISTS ai_rag_chunk (
ai_rag_chunk_id INT(11) NOT NULL AUTO_INCREMENT,
ai_rag_chunk_collection_id INT(11) NOT NULL,
ai_rag_chunk_text MEDIUMTEXT NOT NULL,
ai_rag_chunk_metadata JSON NULL,
ai_rag_chunk_embedding LONGTEXT NOT NULL, -- base64-packed Float32Array
ai_rag_chunk_token_count INT(11) NOT NULL DEFAULT 0,
ai_rag_chunk_source VARCHAR(512) NULL, -- denormalised from metadata for indexing
ai_rag_chunk_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (ai_rag_chunk_id),
KEY ai_rag_chunk_collection_idx (ai_rag_chunk_collection_id),
KEY ai_rag_chunk_source_idx (ai_rag_chunk_source),
CONSTRAINT ai_rag_chunk_collection_fk
FOREIGN KEY (ai_rag_chunk_collection_id)
REFERENCES ai_rag_collection (ai_rag_collection_id)
ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;