Compare commits

..

No commits in common. "0e10b961a4a35f5fe2bad7cca9865163f4c47c3e" and "08776459818e4c7c26079d9fdb0054721f486fa4" have entirely different histories.

6 changed files with 27 additions and 32 deletions

View file

@ -1,14 +1,12 @@
name: Python Tests
on:
pull_request_target:
types: [review_requested]
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
env:
MONGO_URI: ${{ secrets.MONGO_URI }}
MONGO_URI: justtotes
NOVA_KEY: ${{ secrets.NOVA_KEY }}
steps:
@ -18,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
python-version: 3.10
- name: Install dependencies
run: |
@ -26,7 +24,9 @@ jobs:
pip install -r requirements.txt
pip install uvicorn
- name: Start API server & run tests!
- name: Start API server
run: |
python run
- name: Run tests
run: python tests

View file

@ -1,5 +1,5 @@
# ☄️ NovaAI - Core API Server
API server for accessing AI models.
# ☄️ NovaOSS API Server
Reverse proxy server for "Closed"AI's API.
![Badge showing the most used language](https://img.shields.io/github/languages/top/novaoss/nova-api)
![Badge showing the code size](https://img.shields.io/github/languages/code-size/novaoss/nova-api)
@ -14,7 +14,11 @@ API server for accessing AI models.
![Nova-API Conver/Banner Image - a picture of a galaxy with the caption "the core API server"](https://i.ibb.co/ZBhkS56/nova-api.png)
We aim to fix that! NovaAI provides several AI models for you to use for free.
> "*OpenAI is very closed*"
>
> — [ArsTechnica (July 2023)](https://arstechnica.com/information-technology/2023/07/is-chatgpt-getting-worse-over-time-study-claims-yes-but-others-arent-sure/)
We aim to fix that!
## Star History

View file

@ -47,7 +47,7 @@ class UserManager:
async def create(self, discord_id: str = '') -> dict:
chars = string.ascii_letters + string.digits
infix = os.getenv('KEYGEN_INFIX', 'S3LFH0ST')
infix = os.getenv('KEYGEN_INFIX')
suffix = ''.join(random.choices(chars, k=20))
prefix = ''.join(random.choices(chars, k=20))

View file

@ -26,7 +26,7 @@ app.include_router(core.router)
async def startup_event():
# DATABASE FIX https://stackoverflow.com/questions/65970988/python-mongodb-motor-objectid-object-is-not-iterable-error-while-trying-to-f
import pydantic, bson
# pydantic.json.ENCODERS_BY_TYPE[bson.objectid.ObjectId]=str
pydantic.json.ENCODERS_BY_TYPE[bson.objectid.ObjectId]=str
@app.get('/')
async def root():

View file

@ -14,7 +14,6 @@ Runs for production on the speicified port.
import os
import sys
import time
port = sys.argv[1] if len(sys.argv) > 1 else 2332
dev = True
@ -23,4 +22,4 @@ if 'prod' in sys.argv:
port = 2333
dev = False
os.system(f'cd api && uvicorn main:app{" --reload" if dev else ""} --host 0.0.0.0 --port {port} & python tests')
os.system(f'cd api && uvicorn main:app{" --reload" if dev else ""} --host 0.0.0.0 --port {port}')

View file

@ -3,7 +3,6 @@
import os
import openai as closedai
import httpx
import time
from rich import print
from typing import List
@ -92,28 +91,21 @@ def test_api_moderation() -> dict:
def test_all():
"""Runs all tests."""
try:
print("Waiting until API Server is started up...")
time.sleep(6)
print('[lightblue]Running test on API server to check if its running...')
print(test_server())
print('[lightblue]Running test on API server to check if its running...')
print(test_server())
print('[lightblue]Running a api endpoint to see if requests can go through...')
print(test_api('gpt-3.5-trubo'))
print('[lightblue]Running a api endpoint to see if requests can go through...')
print(test_api())
print('[lightblue]Checking if the API works with the python library...')
print(test_library())
print('[lightblue]Checking if the API works with the python library...')
print(test_library())
print('[lightblue]Checking if the moderation endpoint works...')
print(test_library_moderation())
print('[lightblue]Checking if the moderation endpoint works...')
print(test_library_moderation())
print('[lightblue]Checking the /v1/models endpoint...')
print(test_models())
except Exception as e:
print('[red]Error: ')
print(e)
exit(500)
print('[lightblue]Checking the /v1/models endpoint...')
print(test_models())
if __name__ == '__main__':
closedai.api_base = api_endpoint