Skip to content

Sparshr04/litellm copilot integration#200

Open
Sparshr04 wants to merge 11 commits intodevelopfrom
sparshr04/litellm-copilot-integration
Open

Sparshr04/litellm copilot integration#200
Sparshr04 wants to merge 11 commits intodevelopfrom
sparshr04/litellm-copilot-integration

Conversation

@Sparshr04
Copy link
Contributor

@Sparshr04 Sparshr04 commented Mar 18, 2026

[Feature] Integrate LiteLLM and GitHub Copilot for streaming /chat

Description

This PR implements the backend architecture to route chat requests to GitHub Copilot's models (gpt-4o, text-embedding-3-small) using the litellm SDK, supporting SSE streaming and isolated user authentication.

Key Additions:

  • /chat Endpoint: Added api/handlers/v1/chat.py which accepts chat histories, handles optional RAG dataset context, and returns a Server-Sent Events (SSE) stream.
  • Async-Safe Token Injection: Refactored the LiteLLM implementation to pass the api_key explicitly via the function call rather than mutating os.environ, preventing cross-talk race conditions between concurrent users.
  • Device Flow Auth: Implemented GitHubDeviceFlowAuth to generate, poll, and store GitHub tokens securely in isolated user XDG directories (~/.extralit/data/users/{username}/...).
  • Environment Isolation: Extended LiteLLMContext to ensure any temporary files generated by the SDK are kept strictly within the authenticated user's directory.

Related Tickets & Documents

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Steps to QA

  1. Ensure the server is running and you are authenticated with an Extralit JWT.
  2. Complete the GitHub Copilot Device flow via the /auth/github/login and /poll endpoints to generate a local github_token.json.
  3. Hit the POST /api/v1/chat endpoint with {"model": "copilot", "messages": [...], "stream": true}.
  4. Verify the response streams back chunk-by-chunk in SSE format (data: ...).

Copilot AI and others added 11 commits December 7, 2025 23:21
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
- Update `BaseSimpleTable` adapter to pass the full column configuration (including editor params) instead of just name/type.
- Update `RenderTable` logic to respect custom column settings (like `editor: "list"`) by prioritizing schema config over defaults.
- Add watcher to `columnsConfig` in `RenderTable` to ensure dropdown options update reactively when new files are uploaded.
- Add missing `$emit('cell-edited')` in `RenderTable`'s tabulator handler.
- Ensures parent components are notified of changes to trigger state updates like the unmapped files counter.
@Sparshr04 Sparshr04 requested review from a team as code owners March 18, 2026 09:48
@Sparshr04 Sparshr04 mentioned this pull request Mar 18, 2026
12 tasks
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.

2 participants