Skip to content

Ai enhancements#495

Draft
alexander-sei wants to merge 7 commits intomainfrom
ai-enhancements
Draft

Ai enhancements#495
alexander-sei wants to merge 7 commits intomainfrom
ai-enhancements

Conversation

@alexander-sei
Copy link
Collaborator

What is the purpose of the change?

Describe the changes to the documentation

Notes

@vercel
Copy link

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sei-docs Ready Ready Preview, Comment Mar 19, 2026 10:41pm

Request Review

Convert the docs search implementation to use synchronous file I/O and simplify token handling. loadSections() is now synchronous and uses readdirSync/readFileSync; DocSection no longer stores a tokens array and DF computation uses tokenFreq keys. Miscellaneous cleanups include compacting the STOP_WORDS list, inlining section object construction, tightening the BM25 term calculation, simplifying snippet extraction, and small control-flow consolidations. Also updated next.config.mjs to add outputFileTracingIncludes for the /api/chat and /api/mcp routes so the scraped docs are included in tracing.
Add a build script to generate a precomputed search index (scripts/build-search-index.js -> lib/search-index.json) and switch search code to load that JSON at runtime. This removes runtime scraping of public/_scraped-docs, converts tokenFreq to plain records, adds an index cache, refactors BM25/snippet logic, and improves performance and tracing. Also: update next.config to include lib/search-index.json in outputFileTracingIncludes, add lib/search-index.json to .gitignore, and invoke the index build in postbuild.
Improve resilience of search index loading and building. - lib/search-docs.ts: add EMPTY_INDEX and wrap loadIndex in try/catch with validation to return an empty index on missing/invalid search-index.json. - scripts/build-search-index.js: add CONTENT_DIR and helpers (stripMdxNoise, parseYamlScalar, parseSourceMdx, relPathToDocsUrl, walkContentMdxFiles) to parse content/*.mdx, strip MDX import/export noise, and extract frontmatter. Split section building into scraped and content flows, log counts, and fall back to content MDX when scraped docs are absent (avoids Vercel build failures). Add better error handling and messages when no sections are found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant