From 4cb1b554c3bee7ff07f6bb231d95067af93d137c Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Tue, 7 Oct 2025 14:42:04 -0700 Subject: [PATCH 1/3] Alias `messageID` to `sid` instead of redundant `message_id` --- neon_data_models/models/api/klat/socketio.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/neon_data_models/models/api/klat/socketio.py b/neon_data_models/models/api/klat/socketio.py index 90bf175..1e18dfd 100644 --- a/neon_data_models/models/api/klat/socketio.py +++ b/neon_data_models/models/api/klat/socketio.py @@ -195,7 +195,9 @@ def model_dump(self, **kwargs): class UserMessage(BaseModel): sid: str = Field( - description="Shout ID associated with the message" + description="Shout ID associated with the message", + default_factory=lambda: uuid.uuid4().hex[:10], + alias="messageID" ) cid: str = Field(description="Conversation ID associated with the message") user_id: Optional[str] = Field( @@ -260,11 +262,6 @@ class UserMessage(BaseModel): description="Unix timestamp (epoch seconds)", alias="timeCreated" ) - message_id: str = Field( - description="UUID for this message", - alias="messageID", - default_factory=lambda: uuid.uuid4().hex[:10], - ) # TODO: This is probably `sid` with a different name bound_service: Optional[str] = Field( default=None, description="Service this message is targeting", From 52e9c7ee3234d09c8eb8f878e3547d91f9cd64e5 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Tue, 7 Oct 2025 14:44:09 -0700 Subject: [PATCH 2/3] Update unit test to account for sid refactor --- tests/models/api/test_klat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/models/api/test_klat.py b/tests/models/api/test_klat.py index 67b8792..fecff9d 100644 --- a/tests/models/api/test_klat.py +++ b/tests/models/api/test_klat.py @@ -291,7 +291,7 @@ def test_user_message(self): # Test to_db_query method db_query = test_object.to_db_query() - self.assertEqual(db_query["_id"], test_object.message_id) + self.assertEqual(db_query["_id"], test_object.sid) self.assertEqual(db_query["cid"], test_object.cid) self.assertEqual(db_query["message_text"], test_object.message_body) self.assertEqual(db_query["is_audio"], test_object.is_audio) From d1f42cf426f534eefce9e5f9912b1cedb2b821d4 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Tue, 7 Oct 2025 14:47:47 -0700 Subject: [PATCH 3/3] Update `UserMessage` model --- neon_data_models/models/api/klat/socketio.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/neon_data_models/models/api/klat/socketio.py b/neon_data_models/models/api/klat/socketio.py index 1e18dfd..70794aa 100644 --- a/neon_data_models/models/api/klat/socketio.py +++ b/neon_data_models/models/api/klat/socketio.py @@ -196,7 +196,6 @@ def model_dump(self, **kwargs): class UserMessage(BaseModel): sid: str = Field( description="Shout ID associated with the message", - default_factory=lambda: uuid.uuid4().hex[:10], alias="messageID" ) cid: str = Field(description="Conversation ID associated with the message") @@ -315,7 +314,7 @@ class Config: def to_db_query(self) -> Dict[str, Any]: return { - "_id": self.message_id, + "_id": self.sid, "cid": self.cid, "user_id": self.user_uid, "prompt_id": self.prompt_id,