| 673 | |
| 674 | |
| 675 | def list_generate_sql_logs(session: SessionDep, chart_id: int) -> List[ChatLog]: |
| 676 | stmt = select(ChatLog).where( |
| 677 | and_(ChatLog.pid.in_(select(ChatRecord.id).where(and_(ChatRecord.chat_id == chart_id))), |
| 678 | ChatLog.type == TypeEnum.CHAT, ChatLog.operate == OperationEnum.GENERATE_SQL)).order_by( |
| 679 | ChatLog.start_time) |
| 680 | result = session.execute(stmt).all() |
| 681 | _list = [] |
| 682 | for row in result: |
| 683 | for r in row: |
| 684 | _list.append(ChatLog(**r.model_dump())) |
| 685 | return _list |
| 686 | |
| 687 | |
| 688 | def list_generate_chart_logs(session: SessionDep, chart_id: int) -> List[ChatLog]: |