| 686 | |
| 687 | |
| 688 | def list_generate_chart_logs(session: SessionDep, chart_id: int) -> List[ChatLog]: |
| 689 | stmt = select(ChatLog).where( |
| 690 | and_(ChatLog.pid.in_(select(ChatRecord.id).where(and_(ChatRecord.chat_id == chart_id))), |
| 691 | ChatLog.type == TypeEnum.CHAT, ChatLog.operate == OperationEnum.GENERATE_CHART)).order_by( |
| 692 | ChatLog.start_time) |
| 693 | result = session.execute(stmt).all() |
| 694 | _list = [] |
| 695 | for row in result: |
| 696 | for r in row: |
| 697 | _list.append(ChatLog(**r.model_dump())) |
| 698 | return _list |
| 699 | |
| 700 | |
| 701 | def create_chat(session: SessionDep, current_user: CurrentUser, create_chat_obj: CreateChat, |