diff --git a/internal/dtos/request/chatbot.go b/internal/dtos/request/chatbot.go index dd93de9..9d9e9dc 100644 --- a/internal/dtos/request/chatbot.go +++ b/internal/dtos/request/chatbot.go @@ -2,7 +2,7 @@ package request type ChatbotDto struct { ProjectID *string `json:"project_id"` - Question string `json:"question" validate:"required"` + Question string `json:"question" validate:"required,max=500"` } type GetChatbotHistoryDto struct { diff --git a/internal/services/chatbotService.go b/internal/services/chatbotService.go index 9182055..3f6c993 100644 --- a/internal/services/chatbotService.go +++ b/internal/services/chatbotService.go @@ -86,8 +86,7 @@ User Question: Rules: - Reply in the same language as the user's question. - If the user is greeting, respond with a friendly greeting and briefly introduce yourself. -- If the user asks a history-related question, respond exactly: -I don't have enough historical context to answer that. +- If the user asks a history-related question, respond in the same language as the user's question, stating that you don't have enough historical context to answer that (for example, in Vietnamese: "Tôi không có đủ dữ liệu lịch sử để trả lời câu hỏi này."). - Do not answer historical questions from memory. - Do not use your own knowledge, assumptions, memory, or external facts. - Do not guess, infer, assume, or invent missing information. @@ -110,8 +109,7 @@ Rules: - Never infer information that is not explicitly stated in Context. - Never create names, dates, places, events, causes, results, or explanations that are not in Context. - Every factual sentence must be directly supported by Context. -- If Context does not contain enough information to answer, respond exactly: -I don't have enough historical context to answer that. +- If Context does not contain enough information to answer, respond in the same language as the user's question, stating that you don't have enough historical context to answer that (for example, in Vietnamese: "Tôi không có đủ dữ liệu lịch sử để trả lời câu hỏi này."). - If Context only partially answers the question, answer only the supported part and clearly say the remaining information is not available in the provided context. - Do not mention document scores. - Do not cite documents unless the user asks. diff --git a/pkg/constants/usage.go b/pkg/constants/usage.go index bfbf3fa..622907f 100644 --- a/pkg/constants/usage.go +++ b/pkg/constants/usage.go @@ -3,6 +3,6 @@ package constants import "time" const ( - MaxDailyAIUsage = 1000 + MaxDailyAIUsage = 50 UsageExpiration = 24 * time.Hour )