Welcome to Repo Assistant AI! 🎉 This GitHub App is built with Probot and integrates OpenAI to help maintainers identify and label duplicate issues automatically. Using the power of OpenAI's embeddings and Supabase's database, this app streamlines your workflow by finding similarities between issues.
Currently, Repo Assistant AI is in its initial stages and operates locally. In the future, it will be ready for server deployment and will work across various repositories. For now, follow the steps below to get started, set up your own instance, and test it on your chosen repositories.
Those are the main features that I can think of right now. If you have any other ideas, feel free to open an issue or submit a pull request!
Before you start, make sure you have:
Clone the repository to your local machine:
git clone https://github.com/your-username/repo-assistant-ai.git
cd repo-assistant-ai
Install the dependencies:
npm install
Build the TypeScript files:
npm run build
Run the bot:
npm start
Go ahead and click the Register a GitHub App button.
Next, you'll get to decide on an app name that isn't already taken. Note: if you see a message "Name is already in use" although no such app exists, it means that a GitHub organization with that name exists and cannot be used as an app name.
After registering your GitHub App, you'll be redirected to install the app on any repositories. At the same time, you can check your local .env and notice it will be populated with values GitHub sends us in the course of that redirect.
Restart the server in your terminal (press ctrl + c to stop the server)
Install the app on a test repository.
Try creating an issue on the repository you installed the app on. You should see a comment from the bot on the issue.
You're all set!
if you want to sync existing issues, you can run the following command:
npm run sync --user=<username> --repo=<repo>
Make sure to have the .env
file set up with Supabase, OpenAI, and GitHub tokens before running the command.
Create a .env
file in the root directory of your project and fill in your API keys and other environment variables:
# Supabase
SUPABASE_URL=your-supabase-url
SUPABASE_ANON_KEY=your-supabase-key
# OpenAI
OPENAI_API_KEY=your-openai-api-key
# GitHub
GITHUB_TOKEN=your-github-token
APP_ID=your-app-id
PRIVATE_KEY=your-pem-value
Set up your Supabase database by following the instructions in the Setting Up Supabase section below.
Set up your OpenAI API key by following the instructions in the Setting Up OpenAI section below.
Run the bot:
npm start
To deploy the app using Docker, follow these steps:
Build the Docker container:
docker build -t repo-assistant .
Start the container with the necessary environment variables:
docker run -e APP_ID=<app-id> -e PRIVATE_KEY=<pem-value> repo-assistant
To synchronize existing issues, you'll need a GitHub token with repository access:
Generate a GitHub token by visiting github.com/settings/tokens.
Run the sync command with your username and repository:
npm run sync --user=<username> --repo=<repo>
Make sure to have the .env
file set up with Supabase, OpenAI, and GitHub tokens before running the command.
Duplicate Issue: here Original Issue: here New Unique Issue With labels added: here
Got ideas on how to make Repo Assistant AI even better? Want to report a bug? Feel free to open an issue or submit a pull request! Check out our Contributing Guide for more information on how to get involved.
Repo Assistant AI is open source software licensed as ISC © 2024 guillermoscript.
To use Supabase, follow these steps:
Create an account at supabase.io.
Once logged in, create a new project.
Navigate to the SQL editor in your project's dashboard and run the following SQL commands to set up the necessary tables and functions:
-- Enable the pgvector extension to work with embedding vectors
create extension vector;
create table
public.documents (
id bigserial,
content text null,
metadata jsonb null,
embedding public.vector null,
created_at timestamp with time zone null default current_timestamp,
issue_number bigint null,
issue_id bigint null,
repo_id bigint null,
constraint documents_pkey primary key (id)
) tablespace pg_default;
create or replace function match_documents (
query_embedding vector(1536),
match_count int default null,
filter jsonb DEFAULT '{}',
match_threshold double precision DEFAULT NULL::double precision
) returns table (
id bigint,
content text,
metadata jsonb,
similarity float -- This column expects a float value
)
language plpgsql
as $$
begin
return query
select
documents.id,
documents.content,
documents.metadata,
1 - (documents.embedding <=> query_embedding) as similarity -- Ensure this is a float
from documents
where documents.metadata @> filter
and (match_threshold is null or (1 - (documents.embedding <=> query_embedding)) > match_threshold)
order by documents.embedding <=> query_embedding
limit match_count;
end;
$$;
.env
file as shown in the Configuration section.To set up OpenAI:
Create an account at openai.com.
Navigate to the API section and generate a new API key.
Add your OpenAI API key to the .env
file as described in the Configuration section.
We're excited to have you try out Repo Assistant AI! If you encounter any issues or have questions, don't hesitate to reach out.
To deploy the app, follow these from the probot docs here. As of now, the app is not ready for deployment as GPT is quite expensive to run. However, if you want to deploy it, you can follow the instructions in the link above.