update chat service (#31)

* rename chatgpt service

* add zeus tool for new provider

* add zeus tool for new provider

* update chat service

* update README.md
This commit is contained in:
Dmitry Afanasyev
2023-10-10 23:22:41 +03:00
committed by GitHub
parent f6f3865fb6
commit e9f76d0ea9
30 changed files with 8095 additions and 969 deletions

View File

@@ -10,6 +10,7 @@ RELOAD="true"
DEBUG="true"
# ==== sentry ====
ENABLE_SENTRY="false"
SENTRY_DSN=
SENTRY_TRACES_SAMPLE_RATE="0.95"
DEPLOY_ENVIRONMENT="stage"
@@ -17,8 +18,11 @@ DEPLOY_ENVIRONMENT="stage"
# ==== logs ====:
ENABLE_JSON_LOGS="true"
ENABLE_SENTRY_LOGS="false"
ENABLE_GRAYLOG="false"
GRAYLOG_HOST=
GRAYLOG_PORT=
LOG_TO_FILE="example.log"
# ==== telegram settings ====
@@ -31,7 +35,7 @@ DOMAIN="https://mydomain.com"
URL_PREFIX="/gpt"
# ==== gpt settings ====
GPT_BASE_HOST="http://chat_service:8858"
GPT_BASE_HOST="http://chatgpt_chat_service:8858"
# ==== other settings ====
USER="web"

View File

@@ -29,12 +29,36 @@ load_dotenv(env_path, override=True)
class SentrySettings(BaseSettings):
ENABLE_SENTRY: bool = False
SENTRY_DSN: str | None = None
DEPLOY_ENVIRONMENT: str | None = None
SENTRY_TRACES_SAMPLE_RATE: float = 0.95
@model_validator(mode="after")
def validate_sentry_enabled(self) -> "SentrySettings":
if self.ENABLE_SENTRY and not self.SENTRY_DSN:
raise RuntimeError("sentry dsn must be set")
return self
class AppSettings(SentrySettings, BaseSettings):
class LoggingSettings(BaseSettings):
ENABLE_JSON_LOGS: bool = True
ENABLE_SENTRY_LOGS: bool = False
ENABLE_GRAYLOG: bool = False
GRAYLOG_HOST: str | None = None
GRAYLOG_PORT: int | None = None
LOG_TO_FILE: str | None = None
@model_validator(mode="after")
def validate_graylog_enabled(self) -> "LoggingSettings":
if self.ENABLE_GRAYLOG and not all([self.GRAYLOG_HOST, self.GRAYLOG_PORT]):
raise RuntimeError("graylog host and port must be set")
return self
class AppSettings(SentrySettings, LoggingSettings, BaseSettings):
"""Application settings."""
PROJECT_NAME: str = "chat gpt bot"
@@ -58,13 +82,7 @@ class AppSettings(SentrySettings, BaseSettings):
# ==== gpt settings ====
GPT_MODEL: str = "gpt-3.5-turbo-stream-DeepAi"
GPT_BASE_HOST: str = "http://chat_service:8858"
ENABLE_JSON_LOGS: bool = True
ENABLE_SENTRY_LOGS: bool = False
GRAYLOG_HOST: str | None = None
GRAYLOG_PORT: int | None = None
LOG_TO_FILE: str | None = None
GPT_BASE_HOST: str = "http://chathpt_chat_service:8858"
@model_validator(mode="before") # type: ignore[arg-type]
def validate_boolean_fields(self) -> Any:
@@ -75,6 +93,8 @@ class AppSettings(SentrySettings, BaseSettings):
"START_WITH_WEBHOOK",
"RELOAD",
"DEBUG",
"ENABLE_GRAYLOG",
"ENABLE_SENTRY",
):
setting_value: str | None = values_dict.get(value)
if setting_value and setting_value.lower() == "false":