Skip to content

cerebral-valley/copilot-sdk-python-chatapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Copilot Chat App (Streamlit)

A minimal yet production-ready folder structure for building a web chat experience powered by the GitHub Copilot Python SDK and Streamlit.

Features

  • Streamlit chat UI with persistent conversation state per browser session
  • Service layer that formats conversation context before forwarding it to GitHub Copilot
  • Configurable model/system prompt via environment variables

Folder Structure

F:\Dev\gh-copilot-chat-app
├── README.md
├── requirements.txt
├── .streamlit
│   └── config.toml          # Streamlit theme + page defaults
└── src
    ├── __init__.py
    ├── app.py               # Streamlit entrypoint (streamlit run src/app.py)
    ├── config.py            # Settings + environment helpers
    ├── copilot
    │   ├── __init__.py
    │   └── client.py        # Thin wrapper around CopilotClient
    └── services
        ├── __init__.py
        └── chat_service.py  # Conversation orchestration & prompt prep

Prerequisites

  1. Python 3.10+
  2. GitHub Copilot CLI installed and authenticated: npm i -g @githubnext/cyclic && copilot login
  3. A valid GitHub Copilot subscription tied to the signed-in account

The app auto-discovers the Copilot CLI path (using where copilot on Windows), but you can override it by setting COPILOT_CLI_PATH if the executable lives elsewhere.

Setup

cd F:\Dev\gh-copilot-chat-app
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt

Optional environment variables:

COPILOT_MODEL=gpt-4o-mini
COPILOT_SYSTEM_PROMPT="You are a friendly AI pair programmer..."

Run the app

streamlit run src/app.py

Then open the URL shown in the console (defaults to http://localhost:8551/).

How it works

  1. The Streamlit UI collects chat messages and stores them in st.session_state.
  2. ChatService assembles a trimmed conversation transcript plus the latest user message.
  3. CopilotChatClient spins up the GitHub Copilot CLI via the Python SDK, sends the prompt, waits for the assistant response, and returns it to the UI.

Tweak config.py or add new services/components to evolve this scaffold into a richer Copilot-powered experience.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages