summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
authorRamon Victor Cardoso <ramonvc19@gmail.com>2024-03-08 02:59:43 +0100
committerRamon Victor Cardoso <ramonvc19@gmail.com>2024-03-08 02:59:43 +0100
commitd8e715a30b4a252647824daaf7095f0a924373e4 (patch)
treeba7ecfe55191e9ce295f4a2c36f35494f8cd3d92 /g4f
parentMerge branch 'main' of https://github.com/xtekky/gpt4free (diff)
downloadgpt4free-d8e715a30b4a252647824daaf7095f0a924373e4.tar
gpt4free-d8e715a30b4a252647824daaf7095f0a924373e4.tar.gz
gpt4free-d8e715a30b4a252647824daaf7095f0a924373e4.tar.bz2
gpt4free-d8e715a30b4a252647824daaf7095f0a924373e4.tar.lz
gpt4free-d8e715a30b4a252647824daaf7095f0a924373e4.tar.xz
gpt4free-d8e715a30b4a252647824daaf7095f0a924373e4.tar.zst
gpt4free-d8e715a30b4a252647824daaf7095f0a924373e4.zip
Diffstat (limited to '')
-rw-r--r--g4f/api/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/g4f/api/__init__.py b/g4f/api/__init__.py
index d8e68bed..b5af629e 100644
--- a/g4f/api/__init__.py
+++ b/g4f/api/__init__.py
@@ -115,9 +115,9 @@ class Api:
async def completions():
return Response(content=json.dumps({'info': 'Not working yet.'}, indent=4), media_type="application/json")
- def run(self, ip):
+ def run(self, ip, use_colors : bool = False):
split_ip = ip.split(":")
- uvicorn.run(app=self.app, host=split_ip[0], port=int(split_ip[1]), use_colors=False)
+ uvicorn.run(app=self.app, host=split_ip[0], port=int(split_ip[1]), use_colors=use_colors)
def format_exception(e: Exception, config: ChatCompletionsConfig) -> str:
last_provider = g4f.get_last_provider(True)
@@ -130,4 +130,4 @@ def format_exception(e: Exception, config: ChatCompletionsConfig) -> str:
def run_api(host: str = '0.0.0.0', port: int = 1337, debug: bool = False, use_colors=True) -> None:
print(f'Starting server... [g4f v-{g4f.version.utils.current_version}]')
app = Api(engine=g4f, debug=debug)
- uvicorn.run(app=app, host=host, port=port, use_colors=use_colors) \ No newline at end of file
+ app.run(f"{host}:{port}", use_colors=use_colors) \ No newline at end of file