Commit 356a1478 authored by ZZH's avatar ZZH

init session mgr 2024-08-5

parent 2a3c8f1f
# -*- coding:utf-8 -*-
"""
DATE:2024/8/5 17:41
"""
from dataclasses import dataclass
from pot_libs.sanic_api import Model
from pot_libs.sanic_api.column import Opt, Int, List, Str
@dataclass
class SessionHisReq(Model):
page_num: int = Opt(Int("页码").eg(1))
page_size: int = Opt(Int("条数").eg(10))
@dataclass
class SessionInfo(Model):
id: int = Opt(Int("会话ID").eg(1))
title: str = Opt(Str("会话标题").eg("未命名会话"))
create_time: str = Opt(Str("创建时间").eg("2023-12-08 00:54"))
@dataclass
class SessionHisRsp(Model):
sessions: list = List("会话列表").items(SessionInfo)
......@@ -4,8 +4,18 @@ DATE:2024/8/5 16:56
"""
from pot_libs.sanic_api import summary
from unify_api.modules.inv_eval.components.session_mgr_cps import (
SessionHisReq, SessionHisRsp
)
@summary("历史会话")
async def post_session_his(req, body):
pass
async def post_session_his(req, body: SessionHisReq) -> SessionHisRsp:
try:
pg_num = int(body.page_num)
pg_size = int(body.page_size)
except Exception as e:
pg_num, pg_size = 1, 10
rsp_sessions = []
return SessionHisRsp(sessions=rsp_sessions)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment