diff --git a/internal/common/app_name.go b/internal/common/app_name.go index b1ff8a6b5e..c0eef5d9d3 100644 --- a/internal/common/app_name.go +++ b/internal/common/app_name.go @@ -102,7 +102,7 @@ func ValidateName(name string) error { // Validate name is not empty after trimming trimmedName := strings.TrimSpace(name) if trimmedName == "" { - return fmt.Errorf("name can't be empty") + return fmt.Errorf("name cannot be empty or whitespace") } // Validate name length in bytes (not characters) - same as Python len(search_name.encode("utf-8")) diff --git a/internal/handler/memory.go b/internal/handler/memory.go index b6dca6ee8a..49bccc7c3b 100644 --- a/internal/handler/memory.go +++ b/internal/handler/memory.go @@ -105,7 +105,7 @@ func (h *MemoryHandler) CreateMemory(c *gin.Context) { } // Validate required field: name - if req.Name == "" { + if strings.TrimSpace(req.Name) == "" { common.ResponseWithCodeData(c, common.CodeArgumentError, nil, "name is required") return } @@ -892,8 +892,10 @@ func isArgumentError(msg string) bool { // Define list of argument error prefixes // Matches Python ArgumentException error messages argumentErrorPrefixes := []string{ - "memory name cannot be empty", // Memory name cannot be empty + "memory name cannot be empty", // Python: "Memory name cannot be empty or whitespace." + "name cannot be empty", // ValidateName trimmed-empty case "memory name exceeds limit", // Memory name exceeds limit + "name length is", // ValidateName exceeds limit "memory type must be a list", // memory_type must be a list "memory type is not supported", // Unsupported memory_type } diff --git a/test/testcases/restful_api/conftest.py b/test/testcases/restful_api/conftest.py index 6a7eb4e987..c7b287b343 100644 --- a/test/testcases/restful_api/conftest.py +++ b/test/testcases/restful_api/conftest.py @@ -65,14 +65,14 @@ GO_ONLY_SKIPS = { "test_dataset_create_parser_config_defaults_and_extra_fields_contract", "test_dataset_list_query_contract_matrix", "test_dataset_delete_contract_matrix", - "test_memory_update_invalid_name", - "test_memory_crud_cycle", - "test_messages_add_list_recent_content_update_forget", - "test_message_status_validation_requires_boolean", - "test_message_search_route_contract", - "test_memory_crud_and_config", - "test_messages_list_and_search_validation_contracts", - "test_message_update_forget_and_content_error_contracts", + # "test_memory_update_invalid_name", + # "test_memory_crud_cycle", + # "test_messages_add_list_recent_content_update_forget", + # "test_message_status_validation_requires_boolean", + # "test_message_search_route_contract", + # "test_memory_crud_and_config", + # "test_messages_list_and_search_validation_contracts", + # "test_message_update_forget_and_content_error_contracts", "test_session_create_validation_and_deleted_chat_contract", "test_session_delete_basic_scenarios", "test_session_list_filter_and_deleted_chat_contract", diff --git a/test/testcases/restful_api/test_memories_messages.py b/test/testcases/restful_api/test_memories_messages.py index da59d56602..dde6c2e6e5 100644 --- a/test/testcases/restful_api/test_memories_messages.py +++ b/test/testcases/restful_api/test_memories_messages.py @@ -48,8 +48,8 @@ def create_memory_resource(rest_client, memory_cleanup): payload = { "name": f"{name_prefix}_{uuid.uuid4().hex[:8]}", "memory_type": ["raw"], - "embd_id": "BAAI/bge-small-en-v1.5@Builtin", - "llm_id": "glm-4-flash@ZHIPU-AI", + "embd_id": "BAAI/bge-small-en-v1.5@Local@Builtin", + "llm_id": "glm-4-flash@CI@ZHIPU-AI", } res = rest_client.post("/memories", json=payload) assert res.status_code == 200 diff --git a/test/testcases/restful_api/test_memory_messages.py b/test/testcases/restful_api/test_memory_messages.py index dcf5a3704f..e0546341be 100644 --- a/test/testcases/restful_api/test_memory_messages.py +++ b/test/testcases/restful_api/test_memory_messages.py @@ -23,8 +23,8 @@ def _memory_payload(name: str) -> dict: return { "name": name, "memory_type": ["raw"], - "embd_id": "BAAI/bge-small-en-v1.5@Builtin", - "llm_id": "glm-4-flash@ZHIPU-AI", + "embd_id": "BAAI/bge-small-en-v1.5@Local@Builtin", + "llm_id": "glm-4-flash@CI@ZHIPU-AI", }