feat(core): Multiple ways to run dbgpts (#1734)

This commit is contained in:
Fangyin Cheng
2024-07-18 17:50:40 +08:00
committed by GitHub
parent d389fddc2f
commit f889fa3775
19 changed files with 1410 additions and 304 deletions

View File

@@ -1,4 +1,5 @@
"""This module contains the client for the DB-GPT API."""
import atexit
import json
import os
@@ -102,6 +103,15 @@ class Client:
)
atexit.register(self.close)
def _base_url(self):
parsed_url = urlparse(self._api_url)
host = parsed_url.hostname
scheme = parsed_url.scheme
port = parsed_url.port
if port:
return f"{scheme}://{host}:{port}"
return f"{scheme}://{host}"
async def chat(
self,
model: str,