| 229 | |
| 230 | |
| 231 | def get_chart_data_with_user(session: SessionDep, current_user: CurrentUser, chat_record_id: int): |
| 232 | stmt = select(ChatRecord.data).where(and_(ChatRecord.id == chat_record_id, ChatRecord.create_by == current_user.id)) |
| 233 | res = session.execute(stmt) |
| 234 | for row in res: |
| 235 | try: |
| 236 | return orjson.loads(row.data) |
| 237 | except Exception: |
| 238 | pass |
| 239 | return {} |
| 240 | |
| 241 | def get_chart_data_with_user_live(session: SessionDep, current_user: CurrentUser, chat_record_id: int): |
| 242 | stmt = select(ChatRecord.datasource,ChatRecord.sql).where(and_(ChatRecord.id == chat_record_id, ChatRecord.create_by == current_user.id)) |