desktop_chat_qt =============== .. py:module:: desktop_chat_qt Attributes ---------- .. autoapisummary:: desktop_chat_qt.APP_TITLE desktop_chat_qt._CODE_FENCE_GENERIC desktop_chat_qt._GEOM_LINE Classes ------- .. autoapisummary:: desktop_chat_qt.AgentWorker desktop_chat_qt.ChatWindow Functions --------- .. autoapisummary:: desktop_chat_qt.escape desktop_chat_qt.render_msg desktop_chat_qt.make_acknowledgement desktop_chat_qt.extract_geom_command desktop_chat_qt.strip_terminate_tokens desktop_chat_qt.main Module Contents --------------- .. py:data:: APP_TITLE :value: 'GEOM AI Assistant' .. py:function:: escape(s: str) -> str .. py:function:: render_msg(role: str, content: str) -> str Message bubbles via a two-cell table for rock-solid alignment in QTextBrowser: - Assistant: LEFT (pale blue) - User: RIGHT (pale blue) .. py:function:: make_acknowledgement(user_text: str) -> str .. py:data:: _CODE_FENCE_GENERIC .. py:data:: _GEOM_LINE .. py:function:: extract_geom_command(text: str) -> Tuple[str, str | None] Find command-like content in assistant text; remove from visible message. Priority: 1) First fenced code block 2) First 'geom ...' line (optional leading $) Returns (cleaned_text, command_or_None). .. py:function:: strip_terminate_tokens(text: str) -> str .. py:class:: AgentWorker(assistant, messages: List[Dict], parent=None) Bases: :py:obj:`PySide6.QtCore.QThread` .. py:attribute:: finished_with_reply .. py:attribute:: assistant .. py:attribute:: messages .. py:method:: run() .. py:class:: ChatWindow Bases: :py:obj:`PySide6.QtWidgets.QMainWindow` .. py:attribute:: assistant .. py:attribute:: messages :type: List[Dict[str, str]] :value: [] .. py:attribute:: system_prompt :value: 'You are a helpful assistant for GEOM. Propose safe shell commands only when appropriate; when... .. py:attribute:: logo_label .. py:attribute:: title_label .. py:attribute:: type_label .. py:attribute:: _samples :value: ['"Create a gold nanorod"', '"I want a graphene disk of 3 nm radius"', '"Create a dimer of... .. py:attribute:: _sample_index :value: 0 .. py:attribute:: _type_pos :value: 0 .. py:attribute:: _type_timer .. py:attribute:: _typewriter_running :value: True .. py:attribute:: chat_frame .. py:attribute:: chat_view .. py:attribute:: input_frame .. py:attribute:: input_box .. py:attribute:: send_btn .. py:attribute:: _last_user_text :value: '' .. py:attribute:: _toggle_counter :value: 0 .. py:attribute:: _toggles :type: Dict[str, Dict[str, str]] .. py:method:: _set_logo_pixmap(label: PySide6.QtWidgets.QLabel, path: str, target_height_css: int = 56) .. py:method:: _typewriter_tick() .. py:method:: _advance_sample() .. py:method:: on_anchor_clicked(url: PySide6.QtCore.QUrl) .. py:method:: eventFilter(obj, event) .. py:method:: append_chat(message: Dict[str, str]) .. py:method:: send_message() .. py:method:: on_agent_reply(reply_message: Dict[str, str]) .. py:function:: main()