From be411affdb883d78cfd887913db830473d7ff242 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Mon, 1 Dec 2025 17:32:43 +0800 Subject: [PATCH] refactor: Rename DuckDuckGo test function for consistency and improve code readability; format error handling code for better clarity --- internal/application/service/web_search/duckduckgo_test.go | 4 ++-- internal/handler/faq.go | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/application/service/web_search/duckduckgo_test.go b/internal/application/service/web_search/duckduckgo_test.go index 3597762a..f54d4431 100644 --- a/internal/application/service/web_search/duckduckgo_test.go +++ b/internal/application/service/web_search/duckduckgo_test.go @@ -231,9 +231,9 @@ func TestDuckDuckGoProvider_Search_Real(t *testing.T) { } } -// TestDuckDuckGoProvider_Search_Real_Chinese tests the DuckDuckGo provider with Chinese query. +// TestDuckDuckGo_SearchChinese tests the DuckDuckGo provider with Chinese query. // This verifies the Chinese language parameter (kl=cn-zh) works correctly. -func TestDuckDuckGoProvider_SearchChinese(t *testing.T) { +func TestDuckDuckGo_SearchChinese(t *testing.T) { if testing.Short() { t.Skip("Skipping real DuckDuckGo integration test in short mode") } diff --git a/internal/handler/faq.go b/internal/handler/faq.go index e5c5d9a8..66f3aed4 100644 --- a/internal/handler/faq.go +++ b/internal/handler/faq.go @@ -103,7 +103,8 @@ func (h *FAQHandler) UpdateEntryTagBatch(c *gin.Context) { c.Error(errors.NewBadRequestError("请求参数不合法").WithDetails(err.Error())) return } - if err := h.knowledgeService.UpdateFAQEntryTagBatch(ctx, secutils.SanitizeForLog(c.Param("id")), req.Updates); err != nil { + if err := h.knowledgeService.UpdateFAQEntryTagBatch(ctx, + secutils.SanitizeForLog(c.Param("id")), req.Updates); err != nil { logger.ErrorWithFields(ctx, err, nil) c.Error(err) return @@ -122,7 +123,8 @@ func (h *FAQHandler) UpdateEntryStatusBatch(c *gin.Context) { c.Error(errors.NewBadRequestError("请求参数不合法").WithDetails(err.Error())) return } - if err := h.knowledgeService.UpdateFAQEntryStatusBatch(ctx, secutils.SanitizeForLog(c.Param("id")), req.Updates); err != nil { + if err := h.knowledgeService.UpdateFAQEntryStatusBatch(ctx, + secutils.SanitizeForLog(c.Param("id")), req.Updates); err != nil { logger.ErrorWithFields(ctx, err, nil) c.Error(err) return