This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/answer.git
The following commit(s) were added to refs/heads/test by this push:
new 8b61cad0 fix(lint): resolve the lint issue
8b61cad0 is described below
commit 8b61cad0143bf2978e75a0e02c7ca1c0de3bc309
Author: LinkinStars <[email protected]>
AuthorDate: Tue Jan 27 17:49:29 2026 +0800
fix(lint): resolve the lint issue
---
internal/base/constant/site_type.go | 13 ++++++-------
internal/controller/ai_controller.go | 8 ++++----
internal/migrations/v30.go | 4 ++--
internal/schema/siteinfo_schema.go | 9 +++------
internal/service/siteinfo/siteinfo_service.go | 1 -
5 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/internal/base/constant/site_type.go
b/internal/base/constant/site_type.go
index 20917f12..ff015ae6 100644
--- a/internal/base/constant/site_type.go
+++ b/internal/base/constant/site_type.go
@@ -20,14 +20,13 @@
package constant
const (
- SiteTypeGeneral = "general"
- // Deprecated: split SiteTypeInterfaceSettings and
SiteTypeUsersSettings for better clarity
+ // SiteTypeLegal\SiteTypeLegal\SiteTypeWrite The following items will
no longer be used.
+ SiteTypeLegal = "legal"
SiteTypeInterface = "interface"
- SiteTypeBranding = "branding"
- // Deprecated: use SiteTypeAdvanced, SiteTypeQuestions, and
SiteTypeTags instead
- SiteTypeWrite = "write"
- // Deprecated: use SiteTypePolicies and SiteTypeSecurity instead
- SiteTypeLegal = "legal"
+ SiteTypeWrite = "write"
+
+ SiteTypeGeneral = "general"
+ SiteTypeBranding = "branding"
SiteTypeSeo = "seo"
SiteTypeLogin = "login"
SiteTypeCustomCssHTML = "css-html"
diff --git a/internal/controller/ai_controller.go
b/internal/controller/ai_controller.go
index 85db78a9..e020ed30 100644
--- a/internal/controller/ai_controller.go
+++ b/internal/controller/ai_controller.go
@@ -613,7 +613,7 @@ func (c *AIController) executeToolCalls(ctx *gin.Context, _
http.ResponseWriter,
for _, toolCall := range validToolCalls {
if toolCall.Function.Name != "" {
- var args map[string]interface{}
+ var args map[string]any
if err :=
json.Unmarshal([]byte(toolCall.Function.Arguments), &args); err != nil {
log.Errorf("Failed to parse tool arguments for
%s: %v, arguments: %s", toolCall.Function.Name, err,
toolCall.Function.Arguments)
errorResult := fmt.Sprintf("Error parsing tool
arguments: %v", err)
@@ -677,14 +677,14 @@ func (c *AIController) getMCPTools() []openai.Tool {
// convertMCPToolToOpenAI
func (c *AIController) convertMCPToolToOpenAI(mcpTool mcp.Tool) openai.Tool {
- properties := make(map[string]interface{})
+ properties := make(map[string]any)
required := make([]string, 0)
maps.Copy(properties, mcpTool.InputSchema.Properties)
required = append(required, mcpTool.InputSchema.Required...)
- parameters := map[string]interface{}{
+ parameters := map[string]any{
"type": "object",
"properties": properties,
}
@@ -704,7 +704,7 @@ func (c *AIController) convertMCPToolToOpenAI(mcpTool
mcp.Tool) openai.Tool {
}
// callMCPTool
-func (c *AIController) callMCPTool(ctx context.Context, toolName string,
arguments map[string]interface{}) (string, error) {
+func (c *AIController) callMCPTool(ctx context.Context, toolName string,
arguments map[string]any) (string, error) {
request := mcp.CallToolRequest{
Request: mcp.Request{},
Params: struct {
diff --git a/internal/migrations/v30.go b/internal/migrations/v30.go
index aa2f48b3..a2dca77e 100644
--- a/internal/migrations/v30.go
+++ b/internal/migrations/v30.go
@@ -369,7 +369,7 @@ func splitLegalMenu(ctx context.Context, x *xorm.Engine)
error {
// save login settings
if existsLogin {
- loginContent, err := json.Marshal(siteLogin)
+ loginContent, _ := json.Marshal(siteLogin)
_, err =
x.Context(ctx).ID(siteInfoLogin.ID).Update(&entity.SiteInfo{
Type: constant.SiteTypeLogin,
Content: string(loginContent),
@@ -382,7 +382,7 @@ func splitLegalMenu(ctx context.Context, x *xorm.Engine)
error {
// save general settings
if existGeneral {
- generalContent, err := json.Marshal(siteGeneral)
+ generalContent, _ := json.Marshal(siteGeneral)
_, err =
x.Context(ctx).ID(siteInfoGeneral.ID).Update(&entity.SiteInfo{
Type: constant.SiteTypeGeneral,
Content: string(generalContent),
diff --git a/internal/schema/siteinfo_schema.go
b/internal/schema/siteinfo_schema.go
index a72a8460..bdf2308d 100644
--- a/internal/schema/siteinfo_schema.go
+++ b/internal/schema/siteinfo_schema.go
@@ -89,8 +89,7 @@ type SiteBrandingReq struct {
Favicon string `validate:"omitempty,gt=0,lte=512" form:"favicon"
json:"favicon"`
}
-// SiteWriteReq site write request
-// Deprecated: use SiteQuestionsReq, SiteAdvancedReq and SiteTagsReq instead
+// SiteWriteReq site write request use SiteQuestionsReq, SiteAdvancedReq and
SiteTagsReq instead
type SiteWriteReq struct {
MinimumContent int
`validate:"omitempty,gte=0,lte=65535" json:"min_content"`
RestrictAnswer bool `validate:"omitempty"
json:"restrict_answer"`
@@ -159,8 +158,7 @@ type SiteWriteTag struct {
DisplayName string `json:"display_name"`
}
-// SiteLegalReq site branding request
-// Deprecated: use SitePoliciesReq and SiteSecurityReq instead
+// SiteLegalReq site branding request use SitePoliciesReq and SiteSecurityReq
instead
type SiteLegalReq struct {
TermsOfServiceOriginalText string
`json:"terms_of_service_original_text"`
TermsOfServiceParsedText string `json:"terms_of_service_parsed_text"`
@@ -351,8 +349,7 @@ type SiteQuestionsResp SiteQuestionsReq
type SiteAdvancedResp SiteAdvancedReq
type SiteTagsResp SiteTagsReq
-// SiteLegalResp site write response
-// Deprecated: use SitePoliciesResp and SiteSecurityResp instead
+// SiteLegalResp site write response use SitePoliciesResp and SiteSecurityResp
instead
type SiteLegalResp SiteLegalReq
// SiteLegalSimpleResp site write response
diff --git a/internal/service/siteinfo/siteinfo_service.go
b/internal/service/siteinfo/siteinfo_service.go
index 6cdb8ae5..1e25cbaa 100644
--- a/internal/service/siteinfo/siteinfo_service.go
+++ b/internal/service/siteinfo/siteinfo_service.go
@@ -112,7 +112,6 @@ func (s *SiteInfoService) GetSiteUsers(ctx context.Context)
(resp *schema.SiteUs
// GetSiteTag get site info write
func (s *SiteInfoService) GetSiteTag(ctx context.Context) (resp
*schema.SiteTagsResp, err error) {
- resp = &schema.SiteTagsResp{}
resp, err = s.siteInfoCommonService.GetSiteTag(ctx)
if err != nil {
log.Error(err)