diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 64a556d..9bd567c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -35,10 +35,10 @@ jobs: id: git_sha run: echo "GIT_SHA=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV - - name: Build and Push Docker Backend Image + - name: Build and Push Docker AI API Image run: | - docker build -t ghcr.io/kartai/ntnu-kpro-ai-assistant-backend:${{ env.GIT_SHA }} ./backend - docker push ghcr.io/kartai/ntnu-kpro-ai-assistant-backend:${{ env.GIT_SHA }} + docker build -t ghcr.io/kartai/ntnu-kpro-ai-assistant-api:${{ env.GIT_SHA }} ./api + docker push ghcr.io/kartai/ntnu-kpro-ai-assistant-api:${{ env.GIT_SHA }} - name: Build and Push Docker Webapp Image run: | diff --git a/README.md b/README.md index 7bfdfea..7de1a7b 100644 --- a/README.md +++ b/README.md @@ -99,17 +99,17 @@ Before you start, make sure the following tools are installed on your system: ## Setup -Start by going into the `/webapp` folder, making a copy of the `.env.example` file and renaming it to `.env`. This file contains the environment variables that the application needs to run. Open the `.env` file and update the environment variables according to your local or production setup. +Start by going into the `/webapp` and `/api` folder, making a copy of the `.env.example` file and renaming it to `.env`. This file contains the environment variables that the application needs to run. Open the `.env` file and update the environment variables according to your local or production setup. ## Usage To run the project, you can use the following commands: ```bash -docker compose --env-file ./webapp/.env --env-file ./backend/.env up --build -d +docker compose --env-file ./webapp/.env --env-file ./api/.env up --build -d ``` -This command will build the Docker images (if necessary) and run the containers in the background. You can access the clientside code at [http://localhost:3000](http://localhost:3000) and the API at [http://localhost:8000](http://localhost:8000). +This command will build the Docker images (if necessary) and run the containers in the background. You can access the client side code at [http://localhost:3000](http://localhost:3000) and the API at [http://localhost:8000](http://localhost:8000). The Swagger documentation for the API is available at [http://localhost:8000/docs](http://localhost:8000/docs). To stop the containers, you can use the following command: diff --git a/backend/.env.example b/api/.env.example similarity index 100% rename from backend/.env.example rename to api/.env.example diff --git a/backend/.flake8 b/api/.flake8 similarity index 100% rename from backend/.flake8 rename to api/.flake8 diff --git a/backend/.mypy.ini b/api/.mypy.ini similarity index 100% rename from backend/.mypy.ini rename to api/.mypy.ini diff --git a/backend/Dockerfile b/api/Dockerfile similarity index 100% rename from backend/Dockerfile rename to api/Dockerfile diff --git a/backend/law_context.txt b/api/law_context.txt similarity index 100% rename from backend/law_context.txt rename to api/law_context.txt diff --git a/backend/requirements.txt b/api/requirements.txt similarity index 100% rename from backend/requirements.txt rename to api/requirements.txt diff --git a/backend/src/__init__.py b/api/src/__init__.py similarity index 100% rename from backend/src/__init__.py rename to api/src/__init__.py diff --git a/backend/src/configuration.py b/api/src/configuration.py similarity index 100% rename from backend/src/configuration.py rename to api/src/configuration.py diff --git a/backend/src/main.py b/api/src/main.py similarity index 100% rename from backend/src/main.py rename to api/src/main.py diff --git a/backend/src/services/__init__.py b/api/src/services/__init__.py similarity index 100% rename from backend/src/services/__init__.py rename to api/src/services/__init__.py diff --git a/backend/src/services/agent.py b/api/src/services/agent.py similarity index 100% rename from backend/src/services/agent.py rename to api/src/services/agent.py diff --git a/backend/src/services/agent_parts/checklist_api.py b/api/src/services/agent_parts/checklist_api.py similarity index 100% rename from backend/src/services/agent_parts/checklist_api.py rename to api/src/services/agent_parts/checklist_api.py diff --git a/backend/src/services/agent_parts/crag.py b/api/src/services/agent_parts/crag.py similarity index 100% rename from backend/src/services/agent_parts/crag.py rename to api/src/services/agent_parts/crag.py diff --git a/backend/src/services/agent_parts/generator.py b/api/src/services/agent_parts/generator.py similarity index 100% rename from backend/src/services/agent_parts/generator.py rename to api/src/services/agent_parts/generator.py diff --git a/backend/src/services/external_ai_models.py b/api/src/services/external_ai_models.py similarity index 100% rename from backend/src/services/external_ai_models.py rename to api/src/services/external_ai_models.py diff --git a/backend/src/services/reader.py b/api/src/services/reader.py similarity index 100% rename from backend/src/services/reader.py rename to api/src/services/reader.py diff --git a/backend/src/services/readers/__init__.py b/api/src/services/readers/__init__.py similarity index 100% rename from backend/src/services/readers/__init__.py rename to api/src/services/readers/__init__.py diff --git a/backend/src/services/readers/digital_pdf_reader.py b/api/src/services/readers/digital_pdf_reader.py similarity index 100% rename from backend/src/services/readers/digital_pdf_reader.py rename to api/src/services/readers/digital_pdf_reader.py diff --git a/backend/src/services/readers/factory.py b/api/src/services/readers/factory.py similarity index 100% rename from backend/src/services/readers/factory.py rename to api/src/services/readers/factory.py diff --git a/backend/src/services/readers/ocr_reader.py b/api/src/services/readers/ocr_reader.py similarity index 100% rename from backend/src/services/readers/ocr_reader.py rename to api/src/services/readers/ocr_reader.py diff --git a/backend/src/services/readers/xml_reader.py b/api/src/services/readers/xml_reader.py similarity index 100% rename from backend/src/services/readers/xml_reader.py rename to api/src/services/readers/xml_reader.py diff --git a/backend/src/services/tools/visulization.py b/api/src/services/tools/visulization.py similarity index 100% rename from backend/src/services/tools/visulization.py rename to api/src/services/tools/visulization.py diff --git a/backend/src/types.py b/api/src/types.py similarity index 100% rename from backend/src/types.py rename to api/src/types.py diff --git a/backend/tests/__init__.py b/api/tests/__init__.py similarity index 100% rename from backend/tests/__init__.py rename to api/tests/__init__.py diff --git a/backend/tests/agent_test.py b/api/tests/agent_test.py similarity index 100% rename from backend/tests/agent_test.py rename to api/tests/agent_test.py diff --git a/backend/tests/files/byggesak_1.xml b/api/tests/files/byggesak_1.xml similarity index 100% rename from backend/tests/files/byggesak_1.xml rename to api/tests/files/byggesak_1.xml diff --git a/backend/tests/files/byggesak_2.xml b/api/tests/files/byggesak_2.xml similarity index 100% rename from backend/tests/files/byggesak_2.xml rename to api/tests/files/byggesak_2.xml diff --git a/backend/tests/files/byggesak_3.xml b/api/tests/files/byggesak_3.xml similarity index 100% rename from backend/tests/files/byggesak_3.xml rename to api/tests/files/byggesak_3.xml diff --git a/backend/tests/files/byggesak_4.xml b/api/tests/files/byggesak_4.xml similarity index 100% rename from backend/tests/files/byggesak_4.xml rename to api/tests/files/byggesak_4.xml diff --git a/backend/tests/files/corrupted.pdf b/api/tests/files/corrupted.pdf similarity index 100% rename from backend/tests/files/corrupted.pdf rename to api/tests/files/corrupted.pdf diff --git a/backend/tests/files/empty.pdf b/api/tests/files/empty.pdf similarity index 100% rename from backend/tests/files/empty.pdf rename to api/tests/files/empty.pdf diff --git a/backend/tests/files/invalid.txt b/api/tests/files/invalid.txt similarity index 100% rename from backend/tests/files/invalid.txt rename to api/tests/files/invalid.txt diff --git a/backend/tests/files/large.pdf b/api/tests/files/large.pdf similarity index 100% rename from backend/tests/files/large.pdf rename to api/tests/files/large.pdf diff --git a/backend/tests/files/malware.exe b/api/tests/files/malware.exe similarity index 100% rename from backend/tests/files/malware.exe rename to api/tests/files/malware.exe diff --git a/backend/tests/files/ocr_test_image_1.jpg b/api/tests/files/ocr_test_image_1.jpg similarity index 100% rename from backend/tests/files/ocr_test_image_1.jpg rename to api/tests/files/ocr_test_image_1.jpg diff --git a/backend/tests/files/ocr_test_image_2.png b/api/tests/files/ocr_test_image_2.png similarity index 100% rename from backend/tests/files/ocr_test_image_2.png rename to api/tests/files/ocr_test_image_2.png diff --git a/backend/tests/files/structured.pdf b/api/tests/files/structured.pdf similarity index 100% rename from backend/tests/files/structured.pdf rename to api/tests/files/structured.pdf diff --git a/backend/tests/files/unstructured.pdf b/api/tests/files/unstructured.pdf similarity index 100% rename from backend/tests/files/unstructured.pdf rename to api/tests/files/unstructured.pdf diff --git a/backend/tests/integrations_test.py b/api/tests/integrations_test.py similarity index 100% rename from backend/tests/integrations_test.py rename to api/tests/integrations_test.py diff --git a/docker-compose.yml b/docker-compose.yml index aa182d2..408f54b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,12 +21,12 @@ services: api: platform: "linux/amd64" build: - context: ./backend + context: ./api dockerfile: Dockerfile ports: - "8000:8000" volumes: - - ./backend:/code + - ./api:/code environment: - AZURE_OPENAI_API_KEY=${AZURE_OPENAI_API_KEY} - AZURE_OPENAI_API_BASE=${AZURE_OPENAI_API_BASE} diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh index 68aa717..26774eb 100755 --- a/scripts/pre-commit.sh +++ b/scripts/pre-commit.sh @@ -1,9 +1,8 @@ #!/bin/sh # Run linter on staged JavaScript, TypeScript files -cd webapp -npm run lint --fix -cd backend + +cd api black . # mypy