@@ -118,7 +118,7 @@ def get_messages(self) -> list[Message]:
118118 message_dicts = self ._get_messages ()
119119 return [Message (** message_dict ) for message_dict in message_dicts ]
120120
121- def _extract_mentions (self , body : str ) -> list [str ]:
121+ def _find_mentions (self , body : str ) -> list [str ]:
122122 """
123123 Extract mentioned usernames from a message body.
124124 Finds all @mentions in the body and returns the corresponding usernames.
@@ -151,7 +151,7 @@ def add_message(self, new_message: NewMessage) -> str:
151151 )
152152
153153 # find all mentioned users and add them as message mentions
154- message .mentions = self ._extract_mentions (message .body )
154+ message .mentions = self ._find_mentions (message .body )
155155
156156 with self ._ydoc .transaction ():
157157 index = len (self ._ymessages ) - next ((i for i , v in enumerate (self ._get_messages ()[::- 1 ]) if v ["time" ] < timestamp ), len (self ._ymessages ))
@@ -162,11 +162,11 @@ def add_message(self, new_message: NewMessage) -> str:
162162
163163 return uid
164164
165- def update_message (self , message : Message , append : bool = False , is_done : bool = False ):
165+ def update_message (self , message : Message , append : bool = False , find_mentions : bool = False ):
166166 """
167167 Update a message of the document.
168168 If append is True, the content will be appended to the previous content.
169- If is_done is True, mentions will be extracted and notifications triggered (use for streaming completion).
169+ If find_mentions is True, mentions will be extracted and notifications triggered (use for streaming completion).
170170 """
171171 with self ._ydoc .transaction ():
172172 index = self ._indexes_by_id [message .id ]
@@ -176,8 +176,8 @@ def update_message(self, message: Message, append: bool = False, is_done: bool =
176176 message .body = initial_message ["body" ] + message .body # type:ignore[index]
177177
178178 # Extract and update mentions from the message body
179- if is_done :
180- message .mentions = self ._extract_mentions (message .body )
179+ if find_mentions :
180+ message .mentions = self ._find_mentions (message .body )
181181
182182 self ._ymessages [index ] = asdict (message , dict_factory = message_asdict_factory )
183183
0 commit comments