Skip to content

feat: add dynamic Sugar docs fetcher and /refresh-docs endpoint (fixes #91)#92

Open
skypank-coder wants to merge 1 commit intosugarlabs:mainfrom
skypank-coder:feat/dynamic-rag-doc-refresh
Open

feat: add dynamic Sugar docs fetcher and /refresh-docs endpoint (fixes #91)#92
skypank-coder wants to merge 1 commit intosugarlabs:mainfrom
skypank-coder:feat/dynamic-rag-doc-refresh

Conversation

@skypank-coder
Copy link
Copy Markdown

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 docs
    from GitHub API (desktop-activity, web-activity, contributing)
  • POST /refresh-docs — admin endpoint to re-fetch docs and
    rebuild FAISS vectorstore at runtime, zero downtime
  • app/ai.py — UTF-8 encoding fix
  • app/routes/api.py — refresh-docs route added
  • .example.env — added GITHUB_TOKEN variable
  • README.md — added doc refresh documentation
  • requirements.txt — added requests library

Testing

✅ 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

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.

feat: dynamic Sugar docs fetcher + /refresh-docs endpoint for live RAG updates

1 participant