-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into chore/test-preview-deployment
- Loading branch information
Showing
28 changed files
with
859 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"scanSettings": { | ||
"baseBranches": [] | ||
}, | ||
"checkRunSettings": { | ||
"vulnerableCheckRunConclusionLevel": "failure", | ||
"displayMode": "diff", | ||
"useMendCheckNames": true | ||
}, | ||
"issueSettings": { | ||
"minSeverityLevel": "LOW", | ||
"issueType": "DEPENDENCY" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Intelligence Service | ||
|
||
This is a FastAPI service for interfacing with LangChain and other machine learning services. | ||
|
||
## Table of Contents | ||
|
||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Project Structure](#project-structure) | ||
- [Testing](#testing) | ||
|
||
## Installation | ||
|
||
To set up the project locally, follow these steps: | ||
|
||
1. **Install dependencies:** | ||
The project uses `poetry` for dependency management. Install the dependencies by running: | ||
```bash | ||
poetry install | ||
``` | ||
|
||
2. **Run the application:** | ||
You can start the FastAPI application with Uvicorn: | ||
```bash | ||
poetry run uvicorn src.main:app --reload | ||
``` | ||
|
||
## Usage | ||
|
||
After running the application, you can access the FastAPI API documentation at `http://127.0.0.1:8000/docs` or `http://127.0.0.1:8000/redoc`. | ||
|
||
## Project Structure | ||
|
||
The project is organized as follows: | ||
``` | ||
intelligence-service/ | ||
├── pyproject.toml | ||
├── README.md | ||
├── poetry.lock | ||
├── .pytest_cache/ | ||
├── tests/ | ||
│ ├── __init__.py | ||
│ └── test_hello.py | ||
├── src/ | ||
│ ├── config.py | ||
│ ├── main.py | ||
│ └── auth/ | ||
│ └── router.py | ||
└── ... | ||
``` | ||
## Testing | ||
The project includes a set of unit tests to ensure that the core functionalities work as expected. These tests are located in the `tests/` directory. | ||
### Running Tests | ||
To run all tests, use the following command: | ||
```bash | ||
poetry run pytest |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[tool.poetry] | ||
name = "intelligence-service" | ||
version = "0.1.0" | ||
description = "A FastAPI service for interfacing with large language models (LLMs) and providing intelligent text-based responses" | ||
authors = ["milenasrb <[email protected]>"] | ||
readme = "README.md" | ||
package-mode = false | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.12" | ||
fastapi = "^0.112.0" | ||
uvicorn = "^0.30.5" | ||
|
||
|
||
[tool.poetry.group.dev.dependencies] | ||
httpx = "^0.27.0" | ||
pytest = "^8.3.2" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from fastapi import APIRouter | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/", response_model=dict, summary="Hello World Endpoint") | ||
async def hello_world(): | ||
return {"message": "Hello, World!"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Settings: | ||
APP_NAME: str = "Intelligence Service" | ||
|
||
|
||
settings = Settings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from fastapi import FastAPI | ||
|
||
from .auth.router import router | ||
from .config import settings | ||
|
||
app = FastAPI(title=settings.APP_NAME) | ||
|
||
app.include_router(router) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from fastapi.testclient import TestClient | ||
from src.main import app | ||
|
||
client = TestClient(app) | ||
|
||
|
||
def test_hello_world(): | ||
response = client.get("/") | ||
assert response.status_code == 200 | ||
assert response.json() == {"message": "Hello, World!"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM node:latest as build | ||
|
||
WORKDIR /app | ||
|
||
COPY ./ /app/ | ||
|
||
# Ensure .env file exists | ||
RUN touch .env | ||
|
||
# Fix buggy replacement of COOLIFY_URL in .env | ||
RUN COOLIFY_URL_VALUE=$(grep '^COOLIFY_URL=' .env | cut -d '=' -f2) && \ | ||
sed -i "s|\$COOLIFY_URL|$COOLIFY_URL_VALUE|g" .env | ||
|
||
# Set serverUrl in environment.ts | ||
RUN APPLICATION_SERVER_URL=$(grep '^APPLICATION_SERVER_URL=' .env | cut -d '=' -f2) && \ | ||
echo "Replacing serverUrl in environment.ts with: $APPLICATION_SERVER_URL" && \ | ||
sed -i "s|serverUrl: '[^']*'|serverUrl: '$APPLICATION_SERVER_URL'|g" src/environments/environment.ts | ||
|
||
RUN npm install | ||
RUN npm run build | ||
|
||
FROM nginx:latest | ||
|
||
COPY --from=build /app/dist/webapp/browser /usr/share/nginx/html | ||
|
||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,4 +140,4 @@ | |
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ /index.html =404; | ||
} | ||
} |
Oops, something went wrong.