feat: implement chatbot service with RAG-based question answering and history tracking
Build and Release / release (push) Successful in 1m25s

This commit is contained in:
2026-06-05 17:55:45 +07:00
parent fdcd44cc00
commit 32ade66c6c
+4 -2
View File
@@ -150,12 +150,14 @@ func normalizeAnswer(s string) string {
end := strings.LastIndex(s, "</answer>")
if start >= 0 && end > start {
return strings.TrimSpace(s[start : end+len("</answer>")])
return strings.TrimSpace(s[start+len("<answer>") : end])
}
s = strings.TrimSpace(strings.TrimPrefix(s, "Answer:"))
s = strings.TrimSpace(strings.TrimPrefix(s, "<answer>"))
s = strings.TrimSpace(strings.TrimSuffix(s, "</answer>"))
return fmt.Sprintf("<answer>%s</answer>", s)
return s
}
func (s *chatbotService) GetHistory(ctx context.Context, userID string, dto *request.GetChatbotHistoryDto) ([]*models.ChatbotHistoryEntity, error) {
pgUserID, err := convert.StringToUUID(userID)