From 4935071dd6c0c8617d4ad28c2242c582774aaf38 Mon Sep 17 00:00:00 2001 From: anonymous Date: Fri, 23 Jun 2023 11:20:25 +0200 Subject: [PATCH] Fixed git stuff, but socks seems to still not work --- README.md | 39 ++++++++++++++++++++++++++++++--------- cli/__main__.py | 5 +++++ requirements.txt | 6 +++++- setup.py | 21 +++++++++++++++++++++ 4 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 cli/__main__.py create mode 100644 setup.py diff --git a/README.md b/README.md index 287b42a..8157536 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,29 @@ -# nova-api -☄️ Nova API -<<<<<<< HEAD +# ☄️ Nova API Server +Reverse proxy server for OpenAI's API. + +## Install +Assuming you have a new version of Python 3 and pip installed: +```py +python -m pip install -r requirements.txt +``` + +If you still get a `ModuleNotFoundError`s, you can forefully install the dependencies using: +```py +python -m pip install pipreqs +python -m pipreqs.pipreqs --force --mode no-pin +python -m pip install --upgrade -r requirements.txt +``` + +You can also try installing Nova API using `setup.py`: +```py +python setup.py +``` + +or + +```py +pip install . +``` ## `.env` configuration @@ -13,17 +36,15 @@ You can also just add the *beginning* of an API address, like `12.123.` to allow ## Proxy - `PROXY_TYPE` (optional, defaults to `socks.PROXY_TYPE_HTTP`): the type of proxy - can be `http`, `https`, `socks4`, `socks5`, `4` or `5`, etc... -- `PROXY_HOST`: the host used by the proxy -- `PROXY_PORT`: the port used by the proxy +- `PROXY_HOST`: the proxy host (host domain or IP address), without port! +- `PROXY_PORT` - `PROXY_USER` (optional) - `PROXY_PASS` (optional) ## Run -`cd api && uvicorn main:app --reload && cd ..` +`python cli` You can remove the `--reload` flag if you don't want to reload the server on file changes. ## Test -`python3 tests` -======= ->>>>>>> 5dad208be237c43fa339b4cb98eb68ed398e30be +`python tests` diff --git a/cli/__main__.py b/cli/__main__.py new file mode 100644 index 0000000..3c9bcb5 --- /dev/null +++ b/cli/__main__.py @@ -0,0 +1,5 @@ +import sys +import os + +port = sys.argv[1] if len(sys.argv) > 1 else 8000 +os.system(f'cd api && uvicorn main:app --reload --host 0.0.0.0 --port {port}') diff --git a/requirements.txt b/requirements.txt index f0615cf..137024f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,6 @@ fastapi -uvicorn \ No newline at end of file +httpx +openai +python-dotenv +rich +starlette diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..72e5d4c --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +import setuptools + +with open('README.md', 'r') as fh: + long_description = fh.read() + +setuptools.setup( + name='nova-api', + version='0.0.1', + author='Luna OSS', + author_email='nsde@dmc.chat', + description='Nova API Server', + long_description=long_description, + long_description_content_type='text/markdown', + packages=setuptools.find_packages(), + classifiers=[ + 'Programming Language :: Python :: 3', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: OS Independent', + ] +) +