| 10 | |
| 11 | |
| 12 | class ChatHubRequest: |
| 13 | def __init__( |
| 14 | self, |
| 15 | conversation_signature: str, |
| 16 | encrypted_conversation_signature: str, |
| 17 | client_id: str, |
| 18 | conversation_id: str, |
| 19 | invocation_id: int = 3, |
| 20 | ) -> None: |
| 21 | self.struct: dict = {} |
| 22 | |
| 23 | self.client_id: str = client_id |
| 24 | self.conversation_id: str = conversation_id |
| 25 | self.conversation_signature: str = conversation_signature |
| 26 | self.encrypted_conversation_signature: str = encrypted_conversation_signature |
| 27 | self.invocation_id: int = invocation_id |
| 28 | |
| 29 | def update( |
| 30 | self, |
| 31 | prompt: str, |
| 32 | conversation_style: CONVERSATION_STYLE_TYPE, |
| 33 | webpage_context: Union[str, None] = None, |
| 34 | search_result: bool = False, |
| 35 | locale: str = guess_locale(), |
| 36 | ) -> None: |
| 37 | options = [ |
| 38 | "deepleo", |
| 39 | "enable_debug_commands", |
| 40 | "disable_emoji_spoken_text", |
| 41 | "enablemm", |
| 42 | ] |
| 43 | if conversation_style: |
| 44 | if not isinstance(conversation_style, ConversationStyle): |
| 45 | conversation_style = getattr(ConversationStyle, conversation_style) |
| 46 | options = conversation_style.value |
| 47 | message_id = str(uuid.uuid4()) |
| 48 | # Get the current local time |
| 49 | now_local = datetime.now() |
| 50 | |
| 51 | # Get the current UTC time |
| 52 | now_utc = datetime.utcnow() |
| 53 | |
| 54 | # Calculate the time difference between local and UTC time |
| 55 | timezone_offset = now_local - now_utc |
| 56 | |
| 57 | # Get the offset in hours and minutes |
| 58 | offset_hours = int(timezone_offset.total_seconds() // 3600) |
| 59 | offset_minutes = int((timezone_offset.total_seconds() % 3600) // 60) |
| 60 | |
| 61 | # Format the offset as a string |
| 62 | offset_string = f"{offset_hours:+03d}:{offset_minutes:02d}" |
| 63 | |
| 64 | # Get current time |
| 65 | timestamp = datetime.now().strftime("%Y-%m-%dT%H:%M:%S") + offset_string |
| 66 | self.struct = { |
| 67 | "arguments": [ |
| 68 | { |
| 69 | "source": "cib", |
no outgoing calls
no test coverage detected