fix(gpt): use default gpt service

This commit is contained in:
Haojun Liao 2025-03-20 11:48:29 +08:00
parent f42ce412ae
commit 383b985869
1 changed files with 7 additions and 9 deletions

View File

@ -17,7 +17,7 @@ class _GPTService(AbstractForecastService):
super().__init__() super().__init__()
self.table_name = None self.table_name = None
self.service_host = 'http://192.168.2.90:5000/ds_predict' self.service_host = 'http://127.0.0.1:5000/ds_predict'
self.headers = {'Content-Type': 'application/json'} self.headers = {'Content-Type': 'application/json'}
self.std = None self.std = None
@ -61,15 +61,13 @@ class _GPTService(AbstractForecastService):
def set_params(self, params): def set_params(self, params):
super().set_params(params) super().set_params(params)
if "host" not in params: if "host" in params:
raise ValueError("gpt service host needs to be specified") self.service_host = params['host']
self.service_host = params['host'] if self.service_host.startswith("https://"):
self.service_host = self.service_host.replace("https://", "http://")
if self.service_host.startswith("https://"): elif "http://" not in self.service_host:
self.service_host = self.service_host.replace("https://", "http://") self.service_host = "http://" + self.service_host
elif "http://" not in self.service_host:
self.service_host = "http://" + self.service_host
app_logger.log_inst.info("%s specify gpt host service: %s", self.__class__.__name__, app_logger.log_inst.info("%s specify gpt host service: %s", self.__class__.__name__,
self.service_host) self.service_host)