add testing database and chatgpt factories (#28)

* add testing database and chatgpt factories

* include lint job to develop stage

* reformat audioconverter save files to tmp directory

* add api tests

* update README.md
This commit is contained in:
Dmitry Afanasyev
2023-10-08 04:43:24 +03:00
committed by GitHub
parent 23031b0777
commit beb32fb0b9
25 changed files with 434 additions and 255 deletions

View File

@@ -4,6 +4,8 @@ STAGE="runtests"
APP_HOST="0.0.0.0"
APP_PORT="8000"
DB_NAME="test_chatgpt.db"
# ==== telegram settings ====
TELEGRAM_API_TOKEN="123456789:AABBCCDDEEFFaabbccddeeff-1234567890"
# set to true to start with webhook. Else bot will start on polling method

View File

@@ -4,6 +4,8 @@ STAGE="runtests"
APP_HOST="0.0.0.0"
APP_PORT="8000"
DB_NAME="test_chatgpt.db"
# ==== telegram settings ====
TELEGRAM_API_TOKEN="123456789:AABBCCDDEEFFaabbccddeeff-1234567890"
# set to true to start with webhook. Else bot will start on polling method

View File

@@ -32,30 +32,7 @@ URL_PREFIX="/gpt"
# ==== gpt settings ====
GPT_BASE_HOST="http://chat_service:8858"
GPT_MODEL="gpt-3.5-turbo-stream-DeepAi"
# ==== other settings ====
USER="web"
TZ="Europe/Moscow"
# "gpt-3.5-turbo-stream-openai"
# "gpt-3.5-turbo-Aichat"
# "gpt-4-ChatgptAi"
# "gpt-3.5-turbo-weWordle"
# "gpt-3.5-turbo-acytoo"
# "gpt-3.5-turbo-stream-DeepAi"
# "gpt-3.5-turbo-stream-H2o"
# "gpt-3.5-turbo-stream-yqcloud"
# "gpt-OpenAssistant-stream-HuggingChat"
# "gpt-4-turbo-stream-you"
# "gpt-3.5-turbo-AItianhu"
# "gpt-3-stream-binjie"
# "gpt-3.5-turbo-stream-CodeLinkAva"
# "gpt-4-stream-ChatBase"
# "gpt-3.5-turbo-stream-aivvm"
# "gpt-3.5-turbo-16k-stream-Ylokh"
# "gpt-3.5-turbo-stream-Vitalentum"
# "gpt-3.5-turbo-stream-GptGo"
# "gpt-3.5-turbo-stream-AItianhuSpace"
# "gpt-3.5-turbo-stream-Aibn"
# "gpt-3.5-turbo-ChatgptDuo"

View File

@@ -53,7 +53,7 @@ class AppSettings(SentrySettings, BaseSettings):
DOMAIN: str = "https://localhost"
URL_PREFIX: str = ""
DB_FILE: Path = SHARED_DIR / "chat_gpt.db"
DB_NAME: str = "chatgpt.db"
DB_ECHO: bool = False
# ==== gpt settings ====
@@ -96,15 +96,21 @@ class AppSettings(SentrySettings, BaseSettings):
return "/".join([self.api_prefix, self.token_part])
@cached_property
def db_url(self) -> URL:
"""
Assemble database URL from settings.
def db_file(self) -> Path:
return SHARED_DIR / self.DB_NAME
:return: database URL.
"""
@cached_property
def async_db_url(self) -> URL:
return URL.build(
scheme="sqlite+aiosqlite",
path=f"///{self.DB_FILE}",
path=f"///{self.db_file}",
)
@cached_property
def sync_db_url(self) -> URL:
return URL.build(
scheme="sqlite",
path=f"///{self.db_file}",
)
class Config: