mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 20:33:58 +01:00
Netclient rewrite coming soon (hopefully?)
This commit is contained in:
parent
ee5b8561df
commit
08a8755201
28
README.md
28
README.md
|
@ -27,24 +27,28 @@ pip install .
|
||||||
|
|
||||||
## `.env` configuration
|
## `.env` configuration
|
||||||
|
|
||||||
|
### 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 proxy host (host domain or IP address), without port!
|
||||||
|
- `PROXY_PORT` (optional)
|
||||||
|
- `PROXY_USER` (optional)
|
||||||
|
- `PROXY_PASS` (optional)
|
||||||
|
|
||||||
|
### ClosedAI configuration
|
||||||
|
- `CLOSEDAI_KEY`: the API key used to access the ClosedAI API
|
||||||
|
- `CLOSEDAI_ENDPOINT` (defaults to `https://api.openai.com/v1`): the API endpoint which is used for the provider ClosedAI
|
||||||
|
|
||||||
### `ACTUAL_IPS` (optional)
|
### `ACTUAL_IPS` (optional)
|
||||||
This is a security measure to make sure a proxy, VPN, Tor or any other IP hiding service is used by the host when accessing "Closed"AI's API.
|
This is a security measure to make sure a proxy, VPN, Tor or any other IP hiding service is used by the host when accessing "Closed"AI's API.
|
||||||
It is a space separated list of IP addresses that are allowed to access the API.
|
It is a space separated list of IP addresses that are allowed to access the API.
|
||||||
You can also just add the *beginning* of an API address, like `12.123.` to allow all IPs starting with `12.123.`.
|
You can also just add the *beginning* of an API address, like `12.123.` to allow all IPs starting with `12.123.`.
|
||||||
|
|
||||||
|
### `DEMO_AUTH`
|
||||||
|
API key for demo purposes. You can give this to trusted team members. Never use it in production.
|
||||||
|
|
||||||
> To disable the warning if you don't have this feature enabled, set `ACTUAL_IPS` to any value.
|
> To disable the warning if you don't have this feature enabled, set `ACTUAL_IPS` to any value.
|
||||||
|
|
||||||
## 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 proxy host (host domain or IP address), without port!
|
|
||||||
- `PROXY_PORT`
|
|
||||||
- `PROXY_USER` (optional)
|
|
||||||
- `PROXY_PASS` (optional)
|
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
`python cli`
|
`python run`
|
||||||
|
|
||||||
You can remove the `--reload` flag if you don't want to reload the server on file changes.
|
## Test if it works
|
||||||
|
|
||||||
## Test
|
|
||||||
`python tests`
|
`python tests`
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
Traceback (most recent call last):
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 429, in run_asgi
|
|
||||||
result = await app( # type: ignore[func-returns-value]
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
|
|
||||||
return await self.app(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 284, in __call__
|
|
||||||
await super().__call__(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
|
|
||||||
await self.middleware_stack(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
|
|
||||||
raise exc
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
|
|
||||||
await self.app(scope, receive, _send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/cors.py", line 83, in __call__
|
|
||||||
await self.app(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
|
|
||||||
raise exc
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
|
|
||||||
await self.app(scope, receive, sender)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
|
|
||||||
raise e
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
|
|
||||||
await self.app(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
|
|
||||||
await route.handle(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
|
|
||||||
await self.app(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 69, in app
|
|
||||||
await response(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/responses.py", line 270, in __call__
|
|
||||||
async with anyio.create_task_group() as task_group:
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 662, in __aexit__
|
|
||||||
raise exceptions[0]
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/responses.py", line 273, in wrap
|
|
||||||
await func()
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/responses.py", line 262, in stream_response
|
|
||||||
async for chunk in self.body_iterator:
|
|
||||||
File "/home/nova-api/api/transfer.py", line 62, in receive_target_stream
|
|
||||||
async with session.request(
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__
|
|
||||||
self._resp = await self._coro
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
|
|
||||||
conn = await self._connector.connect(
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
|
|
||||||
proto = await self._create_connection(req, traces, timeout)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
|
|
||||||
_, proto = await self._create_direct_connection(req, traces, timeout)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
|
|
||||||
transp, proto = await self._wrap_create_connection(
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/aiohttp_socks/connector.py", line 72, in _wrap_create_connection
|
|
||||||
stream = await proxy.connect(
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/python_socks/async_/asyncio/v2/_proxy.py", line 59, in connect
|
|
||||||
return await self._connect(
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/python_socks/async_/asyncio/v2/_proxy.py", line 100, in _connect
|
|
||||||
await self._negotiate(
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/python_socks/async_/asyncio/v2/_proxy.py", line 164, in _negotiate
|
|
||||||
await proto.negotiate()
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/python_socks/_proto/socks5_async.py", line 42, in negotiate
|
|
||||||
await self._socks_auth()
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/python_socks/_proto/socks5_async.py", line 55, in _socks_auth
|
|
||||||
res.validate()
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/python_socks/_proto/socks5.py", line 134, in validate
|
|
||||||
raise ProxyError('Username and password ' # pragma: no cover
|
|
||||||
python_socks._errors.ProxyError: Username and password authentication failure
|
|
|
@ -1,9 +0,0 @@
|
||||||
fastapi
|
|
||||||
httpx[socks]
|
|
||||||
openai
|
|
||||||
python-dotenv
|
|
||||||
rich
|
|
||||||
starlette
|
|
||||||
win_inet_pton
|
|
||||||
aiohttp-socks
|
|
||||||
aiohttp
|
|
|
@ -1,44 +0,0 @@
|
||||||
Traceback (most recent call last):
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 429, in run_asgi
|
|
||||||
result = await app( # type: ignore[func-returns-value]
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
|
|
||||||
return await self.app(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 284, in __call__
|
|
||||||
await super().__call__(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
|
|
||||||
await self.middleware_stack(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
|
|
||||||
raise exc
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
|
|
||||||
await self.app(scope, receive, _send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/cors.py", line 83, in __call__
|
|
||||||
await self.app(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
|
|
||||||
raise exc
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
|
|
||||||
await self.app(scope, receive, sender)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
|
|
||||||
raise e
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
|
|
||||||
await self.app(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
|
|
||||||
await route.handle(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
|
|
||||||
await self.app(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 69, in app
|
|
||||||
await response(scope, receive, send)
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/responses.py", line 270, in __call__
|
|
||||||
async with anyio.create_task_group() as task_group:
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 662, in __aexit__
|
|
||||||
raise exceptions[0]
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/responses.py", line 273, in wrap
|
|
||||||
await func()
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/starlette/responses.py", line 262, in stream_response
|
|
||||||
async for chunk in self.body_iterator:
|
|
||||||
File "/home/nova-api/api/transfer.py", line 60, in receive_target_stream
|
|
||||||
async with session.request(
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__
|
|
||||||
self._resp = await self._coro
|
|
||||||
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 399, in _request
|
|
||||||
raise RuntimeError("Session is closed")
|
|
||||||
RuntimeError: Session is closed
|
|
Loading…
Reference in a new issue