mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-12-16 21:20:39 +03:00
add gpt/chat api prefix (#33)
* add gpt/chat api prefix * add chatgpt backend url
This commit is contained in:
@@ -14,6 +14,7 @@ START_WITH_WEBHOOK="false"
|
||||
# ==== domain settings ====
|
||||
DOMAIN="http://localhost"
|
||||
URL_PREFIX=
|
||||
CHAT_PREFIX="/chat"
|
||||
|
||||
# ==== gpt settings ====
|
||||
GPT_BASE_HOST="http://localhost"
|
||||
|
||||
@@ -14,6 +14,7 @@ START_WITH_WEBHOOK="false"
|
||||
# ==== domain settings ====
|
||||
DOMAIN="http://localhost"
|
||||
URL_PREFIX=
|
||||
CHAT_PREFIX="/chat"
|
||||
|
||||
# ==== gpt settings ====
|
||||
GPT_BASE_HOST="http://localhost"
|
||||
|
||||
@@ -33,6 +33,7 @@ START_WITH_WEBHOOK="false"
|
||||
# ==== domain settings ====
|
||||
DOMAIN="https://mydomain.com"
|
||||
URL_PREFIX="/gpt"
|
||||
CHAT_PREFIX="/chat"
|
||||
|
||||
# ==== gpt settings ====
|
||||
GPT_BASE_HOST="http://chatgpt_chat_service:8858"
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import model_validator
|
||||
from pydantic_settings import BaseSettings
|
||||
from yarl import URL
|
||||
|
||||
from constants import API_PREFIX
|
||||
from constants import API_PREFIX, CHATGPT_BASE_URI
|
||||
|
||||
BASE_DIR = Path(__file__).parent.parent
|
||||
SHARED_DIR = BASE_DIR.resolve().joinpath("shared")
|
||||
@@ -76,6 +76,7 @@ class AppSettings(SentrySettings, LoggingSettings, BaseSettings):
|
||||
START_WITH_WEBHOOK: bool = False
|
||||
DOMAIN: str = "https://localhost"
|
||||
URL_PREFIX: str = ""
|
||||
CHAT_PREFIX: str = ""
|
||||
|
||||
DB_NAME: str = "chatgpt.db"
|
||||
DB_ECHO: bool = False
|
||||
@@ -107,6 +108,14 @@ class AppSettings(SentrySettings, LoggingSettings, BaseSettings):
|
||||
return "/" + "/".join([self.URL_PREFIX.strip("/"), API_PREFIX.strip("/")])
|
||||
return API_PREFIX
|
||||
|
||||
@cached_property
|
||||
def chat_prefix(self) -> str:
|
||||
return self.URL_PREFIX + self.CHAT_PREFIX
|
||||
|
||||
@cached_property
|
||||
def chatgpt_backend_url(self) -> str:
|
||||
return self.chat_prefix + CHATGPT_BASE_URI
|
||||
|
||||
@cached_property
|
||||
def token_part(self) -> str:
|
||||
return self.TELEGRAM_API_TOKEN[15:30]
|
||||
|
||||
Reference in New Issue
Block a user