Skip to content

Commit 8f49379

Browse files
committed
add loging wait robot response chatkey
1 parent e87c84d commit 8f49379

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from dns_cache import _set_dns_cache
1919

20-
GRADER_VERSION = '1.3.1'
20+
GRADER_VERSION = '1.3.'
2121

2222
if __name__ == '__main__':
2323
report_logger.info("QiwuGrader ver {0}".format(GRADER_VERSION))

controller/private_msg_handler.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def pre_chat(self, from_name, msg):
4949
return True
5050

5151
# Process the message, and returns response
52-
def process_chat(self, from_name, msg):
52+
def process_chat(self, from_name, msg, login_wait=None):
5353

5454
result = ''
5555
skip_first = False
@@ -72,6 +72,9 @@ def process_chat(self, from_name, msg):
7272
result_str = to_str(result)
7373
self.logging.info('Login Res: {0} Length: {1} for chatkey {2}'.format(result_str, str(len(result_str)), chat_key))
7474

75+
if login_wait:
76+
time.sleep(login_wait)
77+
7578
self.logging.debug('User ask: {0} with chatkey'.format(msg.encode('utf-8'), chat_key))
7679

7780
if skip_first and len(result) != 0:
@@ -95,13 +98,13 @@ def process_chat(self, from_name, msg):
9598

9699
return result
97100

98-
def handle_chat(self, from_name, msg):
101+
def handle_chat(self, from_name, msg, login_wait=None):
99102
# Pre process and check if we really need to handle this message
100103
if self.pre_chat(from_name, msg):
101104
# Process the message and give a response
102-
result = self.process_chat(from_name, msg)
105+
result = self.process_chat(from_name, msg, login_wait=None)
103106

104-
self.logging.debug('Robot Response: {0}'.format(result))
107+
self.logging.debug('Robot Response: {0} for chatkey {1}'.format(result, from_name))
105108

106109
if result and result != '':
107110
return result

grader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_robot(self, name, questions, answers):
7272
question_str = str(question)
7373
else:
7474
question_str = question
75-
response = test_service.handle_chat(uid, question_str)
75+
response = test_service.handle_chat(uid, question_str, login_wait=self.question_interval)
7676
process_time = time.time() - process_time
7777

7878
correct = True

0 commit comments

Comments
 (0)