feat: implement RAG chatbot service, background cron worker, and asynchronous indexing infrastructure
All checks were successful
Build and Release / release (push) Successful in 1m30s

This commit is contained in:
2026-05-07 11:38:18 +07:00
parent 76bb1735bb
commit a4fed88b8a
7 changed files with 0 additions and 13 deletions

View File

@@ -49,7 +49,6 @@ func (cx *ChatbotController) Chat(c fiber.Ctx) error {
answer, err := cx.chatbotService.Chat(ctx, claims.UId, dto.ProjectID, dto.Question)
if err != nil {
// Trả về lỗi 429 (Too Many Requests) nếu hết lượt dùng
if err.Error() == "you have reached your daily limit of 10 questions. Please come back tomorrow" {
return c.Status(fiber.StatusTooManyRequests).JSON(response.CommonResponse{
Status: false,

View File

@@ -61,7 +61,6 @@ func (r *rasterTileRepository) GetTile(ctx context.Context, z, x, y int) ([]byte
return nil, "", fmt.Errorf("invalid tile coordinates")
}
// cache key
cacheId := fmt.Sprintf("rasterTile:%d:%d:%d", z, x, y)
var cached []byte

View File

@@ -224,7 +224,6 @@ func (r *statisticRepository) Upsert(ctx context.Context, date time.Time) (*mode
entity := mapToEntity(row)
// Clear search cache and the specific date cache
go func() {
bgCtx := context.Background()
_ = r.c.DelByPattern(bgCtx, "statistic:search*")

View File

@@ -61,7 +61,6 @@ func (r *tileRepository) GetTile(ctx context.Context, z, x, y int) ([]byte, stri
return nil, "", false, fmt.Errorf("invalid tile coordinates")
}
// cache key
cacheId := fmt.Sprintf("tile:%d:%d:%d", z, x, y)
var cached []byte

View File

@@ -78,8 +78,6 @@ Question: %s`, contextStr, question)
if err != nil {
return "", err
}
// 3. Tăng số lần sử dụng sau khi gọi AI thành công
_, _ = s.usageRepo.IncrementAIUsage(ctx, userID)
return response, nil