Compare commits

..

No commits in common. "ce2cd9469e9b2e053e470a1fb6e8a3302ff6ed64" and "e4313b439a47c8ae399d2e6fba51c07e9dfb54b4" have entirely different histories.

10 changed files with 1367 additions and 1748 deletions

View file

@ -5,10 +5,7 @@ on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
env:
MONGO_URI: justtotes
NOVA_KEY: ${{ secrets.NOVA_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -16,17 +13,22 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
python-version: 3.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install uvicorn
- name: Start API server
env:
MONGO_URI: ${{ secrets.MONGO_URI }}
TEST_NOVA_KEY: ${{ secrets.NOVA_KEY }}
run: |
python run
- name: Wait for API server to start
run: sleep 10 # We can adjust this sleep duration as needed. idk how long the server takes to start
- name: Run tests
run: python tests

View file

@ -12,7 +12,7 @@ Reverse proxy server for "Closed"AI's API.
![Badge showing the number of forks](https://img.shields.io/github/forks/novaoss/nova-api?style=social)
![Badge showing the number of watchers](https://img.shields.io/github/watchers/novaoss/nova-api?style=social)
![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)
![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)
> "*OpenAI is very closed*"
>
@ -20,29 +20,13 @@ Reverse proxy server for "Closed"AI's API.
We aim to fix that!
## Star History
###### *I founded FoxGPT (called *NovaGPT* back then)
Old, slow, deprecated* FoxGPT vs new NovaAI repository star count:
<a href="https://star-history.com/#NovaOSS/nova-api&FoxGPT/gpt&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date" />
</picture>
</a>
<img alt="'Emotional damage' meme, with a man with a worried face and the yellow caption 'emotional damage'" src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Findianmemetemplates.com%2Fwp-content%2Fuploads%2Femotional-damage-1024x575.jpg&f=1&nofb=1&ipt=b325721ee0a7b9e11603a9bd484c8042b82e1704e639887107c6ce3e0d9b389e&ipo=images" height=100>
## NovaOSS APIs
Our infrastructure might seem a bit confusing, but it's actually quite simple. Just the first one really matters for you, if you want to access our AI API. The other ones are just for the team.
### AI API
**Public** (everyone can use it with a valid API key)
Endpoint: `https://api.nova-oss.com/v1/...`
Official endpoints: `https://api.nova-oss.com/v1/...`
Documentation & info: [nova-oss.com](https://nova-oss.com)
- Access to AI models
@ -52,24 +36,16 @@ Documentation & info: [nova-oss.com](https://nova-oss.com)
### User/Account management API
**Private** (NovaOSS operators only!)
Endpoint: `https://api.nova-oss.com/...`
Official endpoints: `https://api.nova-oss.com/...`
Documentation: [api.nova-oss.com/docs](https://api.nova-oss.com/docs)
- Access to user accounts
- Implemented in [NovaCord](https://nova-oss.com/novacord)
### NovaCord Bot API
**Private** (NovaOSS operators only!)
Endpoint: `http://0.0.0.0:3224/...`
- acess to Discord server member roles (for receiving the Discord level, ...)
- hosted using [NovaCord](https://nova-oss.com/novacord)
### Website API
**Private** (NovaOSS operators only!)
Endpoint: `https://nova-oss.com/api/...`
Official endpoints: `https://nova-oss.com/api/...`
This one's code can be found in the following repository: [github.com/novaoss/nova-web](https://github.com/novaoss/nova-web)

View file

@ -18,7 +18,7 @@ UA_SIMPLIFY = {
## MONGODB Setup
conn = AsyncIOMotorClient(os.environ['MONGO_URI'])
conn = AsyncIOMotorClient(os.getenv('MONGO_URI'))
async def _get_collection(collection_name: str):
return conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name]

View file

@ -23,7 +23,7 @@ class StatsManager:
"""
def __init__(self):
self.conn = AsyncIOMotorClient(os.environ['MONGO_URI'])
self.conn = AsyncIOMotorClient(os.getenv('MONGO_URI'))
async def _get_collection(self, collection_name: str):
return self.conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name]

View file

@ -35,7 +35,7 @@ class UserManager:
"""
def __init__(self):
self.conn = AsyncIOMotorClient(os.environ['MONGO_URI'])
self.conn = AsyncIOMotorClient(os.getenv('MONGO_URI'))
async def _get_collection(self, collection_name: str):
return self.conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name]

File diff suppressed because it is too large Load diff

View file

@ -28,9 +28,6 @@ async def handle(incoming_request):
users = UserManager()
path = incoming_request.url.path.replace('v1/v1/', 'v1/')
if '/models' in path:
return fastapi.responses.JSONResponse(content=models_list)
try:
payload = await incoming_request.json()
except json.decoder.JSONDecodeError:
@ -55,6 +52,10 @@ async def handle(incoming_request):
if ban_reason:
return await errors.error(403, f'Your NovaAI account has been banned. Reason: "{ban_reason}".', 'Contact the staff for an appeal.')
path_contains_models = '/models' in path
if path_contains_models:
return fastapi.responses.JSONResponse(content=models_list)
costs = config['costs']
cost = costs['other']

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 KiB

BIN
image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 KiB

View file

@ -109,7 +109,7 @@ def test_all():
if __name__ == '__main__':
closedai.api_base = api_endpoint
closedai.api_key = os.environ['NOVA_KEY']
closedai.api_key = os.getenv('TEST_NOVA_KEY')
HEADERS = {
'Content-Type': 'application/json',