40
elif not initial_response_sent and initial_num_questions <=0 and current_num_questions== 0:
no_more_questions = True
fun_fact_text = fun_fact(knowledge_topic)
# if a fun fact is generated respond the fun fact
if fun_fact_text:
response = fun_fact_text
else:
response = "No need to talk."
initial_response_sent = False
Εικόνα 22.Δημιουργία fun fact
Τέλος ελέγχεται αν εν τέλη ο χρήστης έχει απαντήσει σε όλες τις ερωτήσεις και
λαμβάνει το ανάλογο μήνυμα.
question_id,stored_question,correct_answer=get_last_question(knowledge_topic)
if not stored_question or current_num_questions ==0:
response = "I don't have any more questions for you."
follow_up_question_sent = False
else:
_, response_message = check_user_answer(message, correct_answer, user_id)
response = response_message