Add inga method to cqi_over_socketio

This commit is contained in:
Patrick Jentsch
2023-06-01 11:24:09 +02:00
parent 6648b3548b
commit 44d98dfa46
3 changed files with 32 additions and 0 deletions

View File

@ -83,3 +83,17 @@ def cqi_corpora_corpus_paginate(cqi_client: cqi.CQiClient, corpus_name: str, pag
# Number of the next page
payload['next_num'] = payload['page'] + 1 if payload['has_next'] else None
return {'code': 200, 'msg': 'OK', 'payload': payload}
@socketio.on('cqi.corpora.corpus.inga', namespace=ns)
@socketio_login_required
@cqi_over_socketio
def cqi_corpora_corpus_inga(cqi_client: cqi.CQiClient, corpus_name: str):
print('Hallo Inga')
cqi_corpus = cqi_client.corpora.get(corpus_name)
if cqi_corpus.size > 2000:
payload = cqi_corpus.size
return {'code': 200, 'msg': 'OK', 'payload': payload}
else:
return {'code': 456, 'msg': 'Ich habe keine Lust auf so kleine Korpusse'}