Skip to content

Commit

Permalink
Add Multi-tenancy (support multiple agencies) (#2)
Browse files Browse the repository at this point in the history
- Refactor **main.py** and **agency_manager.py** to support config persistence (given correct agency_id) and multi-tenancy (can handle multiple configs);
- Refactor **config.py** to support abstract config loading and saving by agency_id;
-  Add tools: 
  - built-in: CodeInterpreter, Retrieval (not tested yet);
  - custom: BuildDirectoryTree, PrintAllFilesInDirectory + add tests.
- Remove Frontend code from this repo (will be in a separate repo).
  • Loading branch information
bonk1t authored Dec 9, 2023
1 parent b7f8d07 commit 046f281
Show file tree
Hide file tree
Showing 56 changed files with 997 additions and 5,200 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish to Google Artifact Registry

on:
release:
types:
- created

env:
PROJECT_ID: XXX
SERVICE_ACCOUNT: XXX
WORKLOAD_IDENTITY_PROVIDER: XXX
REPOSITORY_URL: XXX

jobs:
# Build the python package file and push to Google Artifacts Repository
push-package:
name: Build and publish the Docker image
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'poetry'
- run: poetry install
- name: Build Package
run: poetry build
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: ${{ env.PROJECT_ID }}
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Upload to Artifact Registry
run: |
python -m pip install keyrings.google-artifactregistry-auth
python -m pip install twine
python -m twine upload --repository-url $REPOSITORY_URL dist/*
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
fail-fast: false

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- run: poetry install
- run: poetry run pytest
File renamed without changes.
2 changes: 1 addition & 1 deletion backend/README.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
1. **Start the FastAPI Server**

```sh
uvicorn backend.main:app --reload
uvicorn nalgonda.main:app --reload
```

The API will be available at `http://localhost:8000`.
Expand Down
Empty file removed backend/base_agency/__init__.py
Empty file.
43 changes: 0 additions & 43 deletions backend/base_agency/agency_manager.py

This file was deleted.

84 changes: 0 additions & 84 deletions backend/base_agency/config.py

This file was deleted.

36 changes: 0 additions & 36 deletions backend/constants.py

This file was deleted.

12 changes: 0 additions & 12 deletions backend/custom_tools/__init__.py

This file was deleted.

27 changes: 0 additions & 27 deletions backend/custom_tools/build_tree.sh

This file was deleted.

35 changes: 0 additions & 35 deletions backend/custom_tools/execute_command.py

This file was deleted.

11 changes: 0 additions & 11 deletions backend/custom_tools/print_files.sh

This file was deleted.

Loading

0 comments on commit 046f281

Please sign in to comment.