(session: SessionDep, record_id: int, chart: str)
| 1046 | |
| 1047 | |
| 1048 | def save_chart(session: SessionDep, record_id: int, chart: str) -> ChatRecord: |
| 1049 | if not record_id: |
| 1050 | raise Exception("Record id cannot be None") |
| 1051 | record = get_chat_record_by_id(session, record_id) |
| 1052 | |
| 1053 | record.chart = chart |
| 1054 | |
| 1055 | result = ChatRecord(**record.model_dump()) |
| 1056 | |
| 1057 | stmt = update(ChatRecord).where(and_(ChatRecord.id == record.id)).values( |
| 1058 | chart=record.chart |
| 1059 | ) |
| 1060 | |
| 1061 | session.execute(stmt) |
| 1062 | |
| 1063 | session.commit() |
| 1064 | |
| 1065 | return result |
| 1066 | |
| 1067 | |
| 1068 | def save_predict_data(session: SessionDep, record_id: int, data: str = '') -> ChatRecord: |
no test coverage detected