Send a message in the conversation.
(self, content: str)
| 182 | return None |
| 183 | |
| 184 | async def send_message(self, content: str): |
| 185 | """Send a message in the conversation.""" |
| 186 | if not self.conversation_id: |
| 187 | return None |
| 188 | |
| 189 | try: |
| 190 | start_time = time.perf_counter() |
| 191 | |
| 192 | response = await self.http_client.post( |
| 193 | f"/chat/{self.conversation_id}/message", |
| 194 | json={"content": content}, |
| 195 | headers={"Authorization": f"Bearer token_{self.client_id}"} |
| 196 | ) |
| 197 | |
| 198 | if response.status_code == 200: |
| 199 | self.messages_sent += 1 |
| 200 | else: |
| 201 | self.errors += 1 |
| 202 | |
| 203 | end_time = time.perf_counter() |
| 204 | return end_time - start_time |
| 205 | |
| 206 | except Exception as e: |
| 207 | self.errors += 1 |
| 208 | return None |
| 209 | |
| 210 | async def join_conversation(self, conversation_id: str): |
| 211 | """Join an existing conversation.""" |
no outgoing calls
no test coverage detected