feat: add dynamic Sugar docs fetcher and /refresh-docs endpoint (fixes #91)#92
Open
skypank-coder wants to merge 1 commit intosugarlabs:mainfrom
Open
feat: add dynamic Sugar docs fetcher and /refresh-docs endpoint (fixes #91)#92skypank-coder wants to merge 1 commit intosugarlabs:mainfrom
skypank-coder wants to merge 1 commit intosugarlabs:mainfrom
Conversation
This was referenced Mar 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a dynamic document fetching system to keep the RAG
vectorstore current with the latest Sugar activity docs.
Problem
The RAG agent had no Sugar activity creation docs — questions
like "How do I create a Sugar activity?" returned poor answers.
Also, there was no way to update docs without restarting the server.
Changes
scripts/fetch_sugar_docs.py— fetches live Sugar docsfrom GitHub API (desktop-activity, web-activity, contributing)
POST /refresh-docs— admin endpoint to re-fetch docs andrebuild FAISS vectorstore at runtime, zero downtime
app/ai.py— UTF-8 encoding fixapp/routes/api.py— refresh-docs route added.example.env— added GITHUB_TOKEN variableREADME.md— added doc refresh documentationrequirements.txt— added requests libraryTesting
✅ All 3 Sugar docs fetch successfully (~35KB)
✅ /refresh-docs rebuilds vectorstore correctly
✅ /ask?question=How do I create a Sugar activity?
now returns accurate Sugar activity guidance
✅ All existing endpoints unchanged
Fixes #91