Skip to content

Commit

Permalink
build(docs): build documentation only when docs files change (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
mawandm authored Apr 22, 2024
1 parent bb3c7b3 commit 1f2c0ab
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 140 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
paths:
- "docs/**"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
72 changes: 0 additions & 72 deletions nesis/api/README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1 @@
# Nesis API
Nesis API module
1. Allows you to chat with data
2. Chats with documents and enhances document knowledge retrival
3. Offers business insights

## Run migrations with
```commandline
alembic -x "url=postgresql://admin:password@localhost:65432/optimai" revision --autogenerate -m "migrations-"`cat version.txt`
```

## Build docker image with
```commandline
docker build -t ametnes/optimai:`cat version.txt` .
```

## Local Development
### Install required version of Python
Install pyenv, a tool the can help one manage multiple Python versions
```commandline
brew install pyenv
```
Using pyenv install python 3.11.5
```commandline
pyenv install 3.11.5
```
Browse to the opmtimAI source code location and set the python version locally using pyenv and create a python virtual environment and activate it.
```commandline
pyenv local 3.11.5
pyenv exec python -m venv .venv
source .venv/bin/activate
```
### Docker services
In a separate terminal window, Start docker services with
```
docker-compose -f ../../deploy/compose.yml up
```

### Install project dependencies
While in the python virtual environment, run the following to install the required project dependencies
```commandline
pip install -r requirements.txt
```
Sometimes one will incur issues with the postgresSQL adapter, so we will uninstall it and re-install it to avoid any potential issues.
```commandline
pip uninstall psycopg2-binary
pip install psycopg2-binary
```

### Running unit tests
Run unit tests after starting docker services
```commandline
python -m unittest discover -s tests -t tests
```

## Running locally
### Start the service
```commandline
export OPENAI_API_KEY=<your-api-key>
python bin/main.py --config=deploy/config.yml
```

### Test
Set up the datasource settings
```commandline
curl -X POST http://localhost:6000/v1/modules/insights/settings -H 'Content-Type: application/json' -d '{"attributes": {"connection": {"database": "optimai", "host": "localhost", "password": "password", "port": "65432", "user": "admin"}, "engine": "postgres"}, "module": "data", "name": "Northwinds"}'
```
Run predictions query command
```commandline
curl -X POST http://localhost:6000/v1/modules/insights/predictions --header "Content-Type: application/json" --data '{"query": "Which top 15 cities has the most sales revenue"}'
```

66 changes: 1 addition & 65 deletions nesis/frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1 @@
# Nesis

Project Structure

```
|
|- deployment # CI deployment scripts
|- server # ExpressJS API service
|- client # Frontend Client
```

# Setup

## Install node packages

`npm install`

## Run application

### Start the server

```
npm run start:server:local
```

### Start the application

```
cd client
npm start
```

Point your browser to http://localhost:3001/

`Connecting to the TEST API`

```
PROFILE=TEST API_URL=https://test.cloud.ametnes.com/api/optimai npm start
```

`You can ignore SSL certs with`

```
NODE_TLS_REJECT_UNAUTHORIZED=0 PROFILE=TEST API_URL=https://test.cloud.ametnes.com/api/optimai npm start
```

## Run application locally

### Start the backend API server

1. `cd server`
2. `NODE_TLS_REJECT_UNAUTHORIZED=0 PROFILE=TEST API_URL=https://test.cloud.ametnes.com/api/optimai npm start`

### In a separate terminal start the frontend application

1. `cd client`
2. `npm start`

Point your browser to http://localhost:3001/

## Building

```
docker build --build-arg PROFILE=PROD --build-arg PUBLIC_URL=/ -t ametnes/optimai:`cat version.txt` .
```
# Nesis Frontend
4 changes: 2 additions & 2 deletions nesis/frontend/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nesis/frontend/client/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ametnes-optimal",
"name": "ametnes-nesis",
"version": "0.1.0",
"private": true,
"dependencies": {
Expand Down

0 comments on commit 1f2c0ab

Please sign in to comment.