chat-console 0.3.4__py3-none-any.whl → 0.3.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
app/__init__.py CHANGED
@@ -3,4 +3,4 @@ Chat CLI
3
3
  A command-line interface for chatting with various LLM providers like ChatGPT and Claude.
4
4
  """
5
5
 
6
- __version__ = "0.3.4"
6
+ __version__ = "0.3.6"
app/main.py CHANGED
@@ -910,12 +910,16 @@ class SimpleChatApp(App): # Keep SimpleChatApp class definition
910
910
  message_display = MessageDisplay(assistant_message, highlight_code=CONFIG["highlight_code"])
911
911
  messages_container.mount(message_display)
912
912
 
913
- # Force a layout refresh and scroll to end
913
+ # Force multiple layout refreshes and scroll to end to ensure visibility
914
+ self.refresh(layout=False)
915
+ await asyncio.sleep(0.01)
914
916
  self.refresh(layout=True)
915
917
  messages_container.scroll_end(animate=False)
918
+ await asyncio.sleep(0.01)
919
+ self.refresh(layout=True)
916
920
 
917
921
  # Add small delay to show thinking state
918
- await asyncio.sleep(0.5)
922
+ await asyncio.sleep(0.3)
919
923
 
920
924
  # Stream chunks to the UI with synchronization
921
925
  update_lock = asyncio.Lock()
@@ -926,70 +930,29 @@ class SimpleChatApp(App): # Keep SimpleChatApp class definition
926
930
  if not self.is_generating:
927
931
  debug_log("update_ui called but is_generating is False, returning.")
928
932
  return
929
-
930
- # Make last_refresh_time accessible in inner scope
931
- nonlocal last_refresh_time
932
933
 
933
934
  async with update_lock:
934
935
  try:
935
936
  # Clear thinking indicator on first content
936
937
  if assistant_message.content == "Thinking...":
937
938
  debug_log("First content received, clearing 'Thinking...'")
939
+ print("First content received, clearing 'Thinking...'")
938
940
  assistant_message.content = ""
939
941
 
940
942
  # Update the message object with the full content
941
943
  assistant_message.content = content
942
944
 
943
- # Update UI with the content - the MessageDisplay will now handle its own refresh
944
- # This is a critical change that ensures content is immediately visible
945
+ # Update UI with the content
945
946
  await message_display.update_content(content)
946
947
 
947
- # CRITICAL: Force immediate UI refresh after EVERY update
948
- # This ensures we don't need a second Enter press to see content
948
+ # Simple refresh approach - just force a layout refresh
949
949
  self.refresh(layout=True)
950
-
951
- # Always scroll after each update to ensure visibility
952
950
  messages_container.scroll_end(animate=False)
953
951
 
954
- # For longer responses, we can throttle the heavy refreshes
955
- # to reduce visual jitter, but still do light refreshes for every update
956
- content_length = len(content)
957
-
958
- # Define key refresh points that require more thorough updates
959
- new_paragraph = content.endswith("\n") and content.count("\n") > 0
960
- code_block = "```" in content
961
- needs_thorough_refresh = (
962
- content_length < 30 or # Very aggressive for short responses
963
- content_length % 16 == 0 or # More frequent periodic updates
964
- new_paragraph or # Refresh on paragraph breaks
965
- code_block # Refresh when code blocks are detected
966
- )
967
-
968
- # Check if it's been enough time since last heavy refresh
969
- # Reduced from 200ms to 100ms for more responsive UI
970
- current_time = time.time()
971
- time_since_refresh = current_time - last_refresh_time
972
-
973
- if needs_thorough_refresh and time_since_refresh > 0.1:
974
- # Store the time we did the heavy refresh
975
- last_refresh_time = current_time
976
-
977
- # Ensure content is visible with an aggressive, guaranteed update sequence
978
- # 1. Scroll to ensure visibility
979
- messages_container.scroll_end(animate=False)
980
-
981
- # 2. Force a comprehensive refresh with layout recalculation
982
- self.refresh(layout=True)
983
-
984
- # 3. Small delay for rendering
985
- await asyncio.sleep(0.01)
986
-
987
- # 4. Another scroll to account for any layout changes
988
- messages_container.scroll_end(animate=False)
989
-
990
952
  except Exception as e:
991
953
  debug_log(f"Error updating UI: {str(e)}")
992
954
  log.error(f"Error updating UI: {str(e)}")
955
+ print(f"Error updating UI: {str(e)}")
993
956
 
994
957
  # --- Remove the inner run_generation_worker function ---
995
958
 
app/ui/chat_interface.py CHANGED
@@ -152,9 +152,6 @@ class MessageDisplay(Static): # Inherit from Static instead of RichLog
152
152
  # Log the error and fallback to local refresh
153
153
  print(f"Error refreshing app: {str(e)}")
154
154
  self.refresh(layout=True)
155
-
156
- # Small delay to allow UI to update
157
- await asyncio.sleep(0.02) # Increased delay for better rendering
158
155
 
159
156
  def _format_content(self, content: str) -> str:
160
157
  """Format message content with timestamp and handle markdown links"""
app/utils.py CHANGED
@@ -278,7 +278,11 @@ async def generate_streaming_response(
278
278
 
279
279
  # Force app refresh after each update
280
280
  if hasattr(app, 'refresh'):
281
- app.refresh(layout=True) # Force layout refresh for all models
281
+ app.refresh(layout=True) # Force layout refresh
282
+ except Exception as callback_err:
283
+ debug_log(f"Error in UI callback: {str(callback_err)}")
284
+ logger.error(f"Error in UI callback: {str(callback_err)}")
285
+ print(f"Error updating UI: {str(callback_err)}")
282
286
  except Exception as callback_err:
283
287
  debug_log(f"Error in UI callback: {str(callback_err)}")
284
288
  logger.error(f"Error in UI callback: {str(callback_err)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chat-console
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: A command-line interface for chatting with LLMs, storing chats and (future) rag interactions
5
5
  Home-page: https://github.com/wazacraftrfid/chat-console
6
6
  Author: Johnathan Greenaway
@@ -1,24 +1,24 @@
1
- app/__init__.py,sha256=LkWSI2xSwkZ6_nVnreshrwqa32Mt9MUFijeJIusFt5I,130
1
+ app/__init__.py,sha256=wUvsU30dqInIPNxEtkmKfV3elJ3g5-yEF367L06eu6E,130
2
2
  app/config.py,sha256=KawltE7cK2bR9wbe1NSlepwWIjkiFw2bg3vbLmUnP38,7626
3
3
  app/database.py,sha256=nt8CVuDpy6zw8mOYqDcfUmNw611t7Ln7pz22M0b6-MI,9967
4
- app/main.py,sha256=FpufDX9CdSIvLU_sCVaRs0jqr8Lz56E_qCk1goHqNvI,73653
4
+ app/main.py,sha256=aGCaQYBTgV6PRgv6ZngC-bOYAtPl8O-9V_cMOionqbk,71245
5
5
  app/models.py,sha256=4-y9Lytay2exWPFi0FDlVeRL3K2-I7E-jBqNzTfokqY,2644
6
- app/utils.py,sha256=QBKL6TXS93jooHhZiWCRRzN0ACqQNERBE1hUq0K-S0c,28634
6
+ app/utils.py,sha256=1eiwjQwZRJIaZvUPQVUmTpyEvWUh3iiKeX-vRRgyUGs,28925
7
7
  app/api/__init__.py,sha256=A8UL84ldYlv8l7O-yKzraVFcfww86SgWfpl4p7R03-w,62
8
8
  app/api/anthropic.py,sha256=UpIP3CgAOUimdVyif41MhBOCAgOyFO8mX9SFQMKRAmc,12483
9
9
  app/api/base.py,sha256=bqBT4jne_W6Cvj_GoWWclV4Uk95fQvt-kkYqqZFJd8M,5769
10
10
  app/api/ollama.py,sha256=EBEEKXbgAYWEg_zF5PO_UKO5l_aoU3J_7tfCj9e-fqs,61699
11
11
  app/api/openai.py,sha256=6ORruzuuZtIjME3WK-g7kXf7cBmM4td5Njv9JLaWh7E,9557
12
12
  app/ui/__init__.py,sha256=RndfbQ1Tv47qdSiuQzvWP96lPS547SDaGE-BgOtiP_w,55
13
- app/ui/chat_interface.py,sha256=IwNFirHEK55ZHscmMWyC4OhCfD9gSqd4FRK-1RLefhw,17393
13
+ app/ui/chat_interface.py,sha256=TJlMzVmrKzr3t0JIhto0vKBvyik7gJ7UEyW3Vqbn3cE,17262
14
14
  app/ui/chat_list.py,sha256=WQTYVNSSXlx_gQal3YqILZZKL9UiTjmNMIDX2I9pAMM,11205
15
15
  app/ui/model_browser.py,sha256=pdblLVkdyVF0_Bo02bqbErGAtieyH-y6IfhMOPEqIso,71124
16
16
  app/ui/model_selector.py,sha256=ue3rbZfjVsjli-rJN5mfSqq23Ci7NshmTb4xWS-uG5k,18685
17
17
  app/ui/search.py,sha256=b-m14kG3ovqW1-i0qDQ8KnAqFJbi5b1FLM9dOnbTyIs,9763
18
18
  app/ui/styles.py,sha256=04AhPuLrOd2yenfRySFRestPeuTPeMLzhmMB67NdGvw,5615
19
- chat_console-0.3.4.dist-info/licenses/LICENSE,sha256=srHZ3fvcAuZY1LHxE7P6XWju2njRCHyK6h_ftEbzxSE,1057
20
- chat_console-0.3.4.dist-info/METADATA,sha256=GdZ4D-htpXwUx8w_eM9_z9PQgUIDjrQk4Q3igAXuff0,2921
21
- chat_console-0.3.4.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
22
- chat_console-0.3.4.dist-info/entry_points.txt,sha256=kkVdEc22U9PAi2AeruoKklfkng_a_aHAP6VRVwrAD7c,67
23
- chat_console-0.3.4.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
24
- chat_console-0.3.4.dist-info/RECORD,,
19
+ chat_console-0.3.6.dist-info/licenses/LICENSE,sha256=srHZ3fvcAuZY1LHxE7P6XWju2njRCHyK6h_ftEbzxSE,1057
20
+ chat_console-0.3.6.dist-info/METADATA,sha256=WZawRM5bbluU90n7HsSWqcu4sJhCHZbZJg9eLp7BK_Y,2921
21
+ chat_console-0.3.6.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
22
+ chat_console-0.3.6.dist-info/entry_points.txt,sha256=kkVdEc22U9PAi2AeruoKklfkng_a_aHAP6VRVwrAD7c,67
23
+ chat_console-0.3.6.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
24
+ chat_console-0.3.6.dist-info/RECORD,,