(session: SessionDep, datasource: int)
| 1160 | |
| 1161 | |
| 1162 | def get_old_questions(session: SessionDep, datasource: int): |
| 1163 | records = [] |
| 1164 | if not datasource: |
| 1165 | return records |
| 1166 | stmt = select(ChatRecord.question).where( |
| 1167 | and_(ChatRecord.datasource == datasource, ChatRecord.question.isnot(None), |
| 1168 | ChatRecord.error.is_(None))).order_by( |
| 1169 | ChatRecord.create_time.desc()).limit(20) |
| 1170 | result = session.execute(stmt) |
| 1171 | for r in result: |
| 1172 | records.append(r.question) |
| 1173 | return records |
no test coverage detected