Expand qna database to 60 items and add query logging in main.go

This commit is contained in:
Shanmuga Krishnan S M
2026-07-27 08:56:11 +05:30
parent 59895a0ec2
commit c998e68718
2 changed files with 412 additions and 4 deletions

View File

@@ -469,11 +469,17 @@ func handleChat(w http.ResponseWriter, r *http.Request) {
MatchedQuestion: matchedQuestion,
Confidence: score,
}
log.Printf("[CHATBOT] Query: %q | MATCHED: %q (Score: %.4f)", req.Message, matchedQuestion, score)
} else {
resp = ChatResponse{
Answer: "I'm sorry, I couldn't find an answer to your question about RIT Chennai. Please try rephrasing your question or contact our administrative office at +91 8925977445 or mail@ritchennai.edu.in.",
Confidence: score,
}
if bestIdx != -1 {
log.Printf("[CHATBOT] Query: %q | FALLBACK (Close Match: %q, Score: %.4f < %.2f)", req.Message, matchedQuestion, score, threshold)
} else {
log.Printf("[CHATBOT] Query: %q | FALLBACK (No matches found)", req.Message)
}
}
w.Header().Set("Content-Type", "application/json")