Refactor error handling in services to use internationalized error messages

- Updated OSSStorage validation errors to use internationalized messages.
- Changed error messages in provider.go for unsupported file storage types.
- Refactored tag_service.go to replace hardcoded error messages with internationalized versions.
- Updated ticket_service.go to use internationalized error messages for various validation checks.
- Refactored ticket_tag_service.go to use internationalized error messages for tag validation.
- Changed ticket_view_service.go to use internationalized error messages for view validation.
- Updated tool_catalog_service.go to use internationalized error messages for tool code validation.
- Refactored user_service.go to replace error messages with internationalized versions.
- Updated ws_service.go to use internationalized error messages for WebSocket handling.
- Refactored wxwork_kf_inbound_service.go to use internationalized error messages for message handling.
- Updated wxwork_kf_outbound_service.go to use internationalized error messages for outbound message handling.
- Refactored wxwork_login_service.go to use internationalized error messages for login handling.
- Updated login.go in wxwork package to use internationalized error messages for login state and ticket validation.
This commit is contained in:
mlogclub
2026-06-02 20:51:13 +08:00
parent 77be1b4f5e
commit 0b4a1b4594
103 changed files with 1688 additions and 1350 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ func (s *embedding) GetModel(ctx context.Context) (*models.AIConfig, error) {
func (s *embedding) GenerateEmbedding(ctx context.Context, text string) (*EmbeddingResult, error) {
if text == "" {
return nil, errorsx.InvalidParam("文本内容不能为空")
return nil, errorsx.InvalidParamI18n("error.e0215")
}
result, err := s.callEmbeddingAPI(ctx, text)
@@ -45,7 +45,7 @@ func (s *embedding) GenerateEmbedding(ctx context.Context, text string) (*Embedd
func (s *embedding) GenerateBatchEmbeddings(ctx context.Context, texts []string) ([]EmbeddingResult, error) {
if len(texts) == 0 {
return nil, errorsx.InvalidParam("文本列表不能为空")
return nil, errorsx.InvalidParamI18n("error.e0216")
}
results := make([]EmbeddingResult, 0, len(texts))