update to python 3.11.6 (#52)

* update dependencies

* update to python 3.11.6

* add human-readable migrations

* minor changes
This commit is contained in:
Dmitry Afanasyev
2023-11-05 14:21:37 +03:00
committed by GitHub
parent 18ea0a556a
commit b5fe195ef4
10 changed files with 272 additions and 268 deletions

View File

@@ -60,6 +60,7 @@ class ChatGptModelsEnum(StrEnum):
gpt_3_5_turbo_stream_gptforlove = "gpt-3.5-turbo-stream-gptforlove"
gpt_3_5_turbo_stream_Vercel = "gpt-3.5-turbo-stream-Vercel"
gpt_3_5_turbo_stream_aivvm = "gpt-3.5-turbo-stream-aivvm"
gpt_3_5_turbo_stream_ChatForAi = "gpt-3.5-turbo-stream-ChatForAi"
@classmethod
def values(cls) -> set[str]:
@@ -71,6 +72,10 @@ class ChatGptModelsEnum(StrEnum):
for model in ChatGptModelsEnum.values():
priority = 0
match model:
case "gpt-3-stream-binjie":
priority = 3
case "gpt-3.5-turbo-stream-yqcloud":
priority = 3
case "gpt-3.5-turbo-stream-GeekGpt":
priority = 2
case "gpt-3.5-turbo-stream-FakeGpt":

View File

@@ -1,6 +1,6 @@
"""initial commit
"""initial migration
Revision ID: eb78565abec7
Revision ID: 0001_create_chatgpt_table
Revises:
Create Date: 2023-10-05 18:28:30.915361
@@ -9,7 +9,7 @@ import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "eb78565abec7"
revision = "0001_create_chatgpt_table"
down_revision = None
branch_labels = None
depends_on = None

View File

@@ -1,12 +1,12 @@
"""create chat gpt models
"""create chatgpt models
Revision ID: c2e443941930
Revises: eb78565abec7
Revision ID: 0002_create_chatgpt_models
Revises: 0001_create_chatgpt_table
Create Date: 2025-10-05 20:44:05.414977
"""
from sqlalchemy import create_engine, select
from loguru import logger
from sqlalchemy import create_engine, select, text
from sqlalchemy.orm import sessionmaker
from constants import ChatGptModelsEnum
@@ -14,8 +14,8 @@ from core.bot.models.chat_gpt import ChatGpt
from settings.config import settings
# revision identifiers, used by Alembic.
revision = "c2e443941930"
down_revision = "eb78565abec7"
revision = "0002_create_chatgpt_models"
down_revision = "0001_create_chatgpt_table"
branch_labels: str | None = None
depends_on: str | None = None
@@ -39,9 +39,12 @@ def upgrade() -> None:
def downgrade() -> None:
chatgpt_table_name = ChatGpt.__tablename__
with session_factory() as session:
session.execute(f"""TRUNCATE TABLE {ChatGpt.__tablename__}""")
# Truncate doesn't exists for SQLite
session.execute(text(f"""DELETE FROM {chatgpt_table_name}""")) # noqa: S608
session.commit()
logger.info("chatgpt models table has been truncated", table=chatgpt_table_name)
engine.dispose()