Skip to content

Commit

Permalink
格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterH0323 committed Oct 10, 2024
1 parent 6f481fd commit 2091660
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions server/base/base_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ async def lifespan(app: FastAPI):

if WEB_CONFIGS.ENABLE_RAG:
from .modules.rag.rag_worker import load_rag_model

# 生成 rag 数据库
await load_rag_model(user_id=1)

Expand Down
4 changes: 2 additions & 2 deletions server/base/database/product_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def get_db_product_info(
page_size: int = 10,
product_name: str | None = None,
product_id: int | None = None,
exclude_list: List[int] | None = None
exclude_list: List[int] | None = None,
) -> Tuple[List[ProductInfo], int]:
"""查询数据库中的商品信息
Expand Down Expand Up @@ -64,7 +64,7 @@ async def get_db_product_info(
query_condiction = and_(
ProductInfo.user_id == user_id, ProductInfo.delete == False, ProductInfo.product_id == product_id
)

elif exclude_list is not None:
# 排除查询
query_condiction = and_(
Expand Down
6 changes: 3 additions & 3 deletions server/base/models/user_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ class UserBaseInfo(BaseModel):
username: str = Field(index=True, unique=True)
email: str | None = None
avatar: str | None = None
create_time: datetime =datetime.now()
create_time: datetime = datetime.now()


# =======================================================
# 数据库模型
# =======================================================
class UserInfo(UserBaseInfo, SQLModel, table=True):

__tablename__ = "user_info"

hashed_password: str
ip_address: IPv4Address | None = None
delete: bool = False
2 changes: 1 addition & 1 deletion server/base/routers/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async def gen_poduct_base_prompt(
"""

assert (streamer_id == -1 and streamer_info is not None) or (streamer_id != -1 and streamer_info is None)
assert (product_id == -1 and product_info is not None) or (product_id != -1 and product_info is None)
assert (product_id == -1 and product_info is not None) or (product_id != -1 and product_info is None)

# 加载对话配置文件
dataset_yaml = await get_llm_product_prompt_base_info()
Expand Down
2 changes: 1 addition & 1 deletion server/base/routers/streaming_room.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def get_streaming_room_id_api(
# 直接返回会导致字段丢失,需要转 dict 确保返回值里面有该字段
format_product_list = []
for db_product in streaming_room_list[0].product_list:

product_dict = dict(db_product)
# 将 start_video 改为服务器地址
if product_dict["start_video"] != "":
Expand Down
2 changes: 0 additions & 2 deletions server/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ def create_default_user():
session.add(admin_user)
session.commit()


def init_user() -> bool:
"""判断是否需要创建默认用户
Expand All @@ -347,7 +346,6 @@ def init_user() -> bool:

return False


def create_default_product_item():
"""生成商品默认数据库"""
delivery_company_list = ["京东", "顺丰", "韵达", "圆通", "中通"]
Expand Down

0 comments on commit 2091660

Please sign in to comment.