XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Fix TypeError: 'Api' object is not callable

d8e715a3
Ramon Victor Cardoso <ramonvc19@gmail.com>
提交于

代码差异

1 个文件 +3 -3
Modified g4f/api/__init__.py +3 -3
@@ -115,9 +115,9 @@ class Api:
115 115 async def completions():
116 116 return Response(content=json.dumps({'info': 'Not working yet.'}, indent=4), media_type="application/json")
117 117
118 def run(self, ip):
118 def run(self, ip, use_colors : bool = False):
119 119 split_ip = ip.split(":")
120 uvicorn.run(app=self.app, host=split_ip[0], port=int(split_ip[1]), use_colors=False)
120 uvicorn.run(app=self.app, host=split_ip[0], port=int(split_ip[1]), use_colors=use_colors)
121 121
122 122 def format_exception(e: Exception, config: ChatCompletionsConfig) -> str:
123 123 last_provider = g4f.get_last_provider(True)
@@ -130,4 +130,4 @@ def format_exception(e: Exception, config: ChatCompletionsConfig) -> str:
130 130 def run_api(host: str = '0.0.0.0', port: int = 1337, debug: bool = False, use_colors=True) -> None:
131 131 print(f'Starting server... [g4f v-{g4f.version.utils.current_version}]')
132 132 app = Api(engine=g4f, debug=debug)
133 uvicorn.run(app=app, host=host, port=port, use_colors=use_colors)
133 app.run(f"{host}:{port}", use_colors=use_colors)