chat-console 0.3.5__tar.gz → 0.3.6__tar.gz
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.
- {chat_console-0.3.5 → chat_console-0.3.6}/PKG-INFO +1 -1
- {chat_console-0.3.5 → chat_console-0.3.6}/app/__init__.py +1 -1
- {chat_console-0.3.5 → chat_console-0.3.6}/app/main.py +4 -45
- {chat_console-0.3.5 → chat_console-0.3.6}/app/ui/chat_interface.py +1 -15
- {chat_console-0.3.5 → chat_console-0.3.6}/app/utils.py +6 -15
- {chat_console-0.3.5 → chat_console-0.3.6}/chat_console.egg-info/PKG-INFO +1 -1
- {chat_console-0.3.5 → chat_console-0.3.6}/LICENSE +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/README.md +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/api/__init__.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/api/anthropic.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/api/base.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/api/ollama.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/api/openai.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/config.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/database.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/models.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/ui/__init__.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/ui/chat_list.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/ui/model_browser.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/ui/model_selector.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/ui/search.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/app/ui/styles.py +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/chat_console.egg-info/SOURCES.txt +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/chat_console.egg-info/dependency_links.txt +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/chat_console.egg-info/entry_points.txt +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/chat_console.egg-info/requires.txt +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/chat_console.egg-info/top_level.txt +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/setup.cfg +0 -0
- {chat_console-0.3.5 → chat_console-0.3.6}/setup.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: chat-console
|
3
|
-
Version: 0.3.
|
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
|
@@ -930,70 +930,29 @@ class SimpleChatApp(App): # Keep SimpleChatApp class definition
|
|
930
930
|
if not self.is_generating:
|
931
931
|
debug_log("update_ui called but is_generating is False, returning.")
|
932
932
|
return
|
933
|
-
|
934
|
-
# Make last_refresh_time accessible in inner scope
|
935
|
-
nonlocal last_refresh_time
|
936
933
|
|
937
934
|
async with update_lock:
|
938
935
|
try:
|
939
936
|
# Clear thinking indicator on first content
|
940
937
|
if assistant_message.content == "Thinking...":
|
941
938
|
debug_log("First content received, clearing 'Thinking...'")
|
939
|
+
print("First content received, clearing 'Thinking...'")
|
942
940
|
assistant_message.content = ""
|
943
941
|
|
944
942
|
# Update the message object with the full content
|
945
943
|
assistant_message.content = content
|
946
944
|
|
947
|
-
# Update UI with the content
|
948
|
-
# This is a critical change that ensures content is immediately visible
|
945
|
+
# Update UI with the content
|
949
946
|
await message_display.update_content(content)
|
950
947
|
|
951
|
-
#
|
952
|
-
# This ensures we don't need a second Enter press to see content
|
948
|
+
# Simple refresh approach - just force a layout refresh
|
953
949
|
self.refresh(layout=True)
|
954
|
-
|
955
|
-
# Always scroll after each update to ensure visibility
|
956
950
|
messages_container.scroll_end(animate=False)
|
957
951
|
|
958
|
-
# For longer responses, we can throttle the heavy refreshes
|
959
|
-
# to reduce visual jitter, but still do light refreshes for every update
|
960
|
-
content_length = len(content)
|
961
|
-
|
962
|
-
# Define key refresh points that require more thorough updates
|
963
|
-
new_paragraph = content.endswith("\n") and content.count("\n") > 0
|
964
|
-
code_block = "```" in content
|
965
|
-
needs_thorough_refresh = (
|
966
|
-
content_length < 30 or # Very aggressive for short responses
|
967
|
-
content_length % 16 == 0 or # More frequent periodic updates
|
968
|
-
new_paragraph or # Refresh on paragraph breaks
|
969
|
-
code_block # Refresh when code blocks are detected
|
970
|
-
)
|
971
|
-
|
972
|
-
# Check if it's been enough time since last heavy refresh
|
973
|
-
# Reduced from 200ms to 100ms for more responsive UI
|
974
|
-
current_time = time.time()
|
975
|
-
time_since_refresh = current_time - last_refresh_time
|
976
|
-
|
977
|
-
if needs_thorough_refresh and time_since_refresh > 0.1:
|
978
|
-
# Store the time we did the heavy refresh
|
979
|
-
last_refresh_time = current_time
|
980
|
-
|
981
|
-
# Ensure content is visible with an aggressive, guaranteed update sequence
|
982
|
-
# 1. Scroll to ensure visibility
|
983
|
-
messages_container.scroll_end(animate=False)
|
984
|
-
|
985
|
-
# 2. Force a comprehensive refresh with layout recalculation
|
986
|
-
self.refresh(layout=True)
|
987
|
-
|
988
|
-
# 3. Small delay for rendering
|
989
|
-
await asyncio.sleep(0.01)
|
990
|
-
|
991
|
-
# 4. Another scroll to account for any layout changes
|
992
|
-
messages_container.scroll_end(animate=False)
|
993
|
-
|
994
952
|
except Exception as e:
|
995
953
|
debug_log(f"Error updating UI: {str(e)}")
|
996
954
|
log.error(f"Error updating UI: {str(e)}")
|
955
|
+
print(f"Error updating UI: {str(e)}")
|
997
956
|
|
998
957
|
# --- Remove the inner run_generation_worker function ---
|
999
958
|
|
@@ -132,9 +132,6 @@ class MessageDisplay(Static): # Inherit from Static instead of RichLog
|
|
132
132
|
# This avoids text reflowing as new tokens arrive
|
133
133
|
formatted_content = self._format_content(content)
|
134
134
|
|
135
|
-
# Print debug info to console
|
136
|
-
print(f"MessageDisplay.update_content: Updating with {len(content)} chars")
|
137
|
-
|
138
135
|
# Use a direct update that forces refresh - critical fix for streaming
|
139
136
|
# This ensures content is immediately visible
|
140
137
|
self.update(formatted_content, refresh=True)
|
@@ -143,11 +140,7 @@ class MessageDisplay(Static): # Inherit from Static instead of RichLog
|
|
143
140
|
try:
|
144
141
|
# Always force app refresh for every update
|
145
142
|
if self.app:
|
146
|
-
#
|
147
|
-
self.app.refresh(layout=False)
|
148
|
-
|
149
|
-
# Then do a full layout refresh to ensure content is visible
|
150
|
-
await asyncio.sleep(0.01)
|
143
|
+
# Force a full layout refresh to ensure content is visible
|
151
144
|
self.app.refresh(layout=True)
|
152
145
|
|
153
146
|
# Find the messages container and scroll to end
|
@@ -155,17 +148,10 @@ class MessageDisplay(Static): # Inherit from Static instead of RichLog
|
|
155
148
|
for container in containers:
|
156
149
|
if hasattr(container, 'scroll_end'):
|
157
150
|
container.scroll_end(animate=False)
|
158
|
-
|
159
|
-
# Force another refresh after scrolling
|
160
|
-
await asyncio.sleep(0.01)
|
161
|
-
self.app.refresh(layout=True)
|
162
151
|
except Exception as e:
|
163
152
|
# Log the error and fallback to local refresh
|
164
153
|
print(f"Error refreshing app: {str(e)}")
|
165
154
|
self.refresh(layout=True)
|
166
|
-
|
167
|
-
# Small delay to allow UI to update
|
168
|
-
await asyncio.sleep(0.03) # Increased delay for better rendering
|
169
155
|
|
170
156
|
def _format_content(self, content: str) -> str:
|
171
157
|
"""Format message content with timestamp and handle markdown links"""
|
@@ -275,23 +275,14 @@ async def generate_streaming_response(
|
|
275
275
|
# Call the UI callback with the full response so far
|
276
276
|
await callback(full_response)
|
277
277
|
debug_log("UI callback completed successfully")
|
278
|
-
print("UI callback completed successfully")
|
279
278
|
|
280
|
-
# Force app refresh after each update
|
279
|
+
# Force app refresh after each update
|
281
280
|
if hasattr(app, 'refresh'):
|
282
|
-
#
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
# Try to force scroll to end
|
289
|
-
try:
|
290
|
-
messages_container = app.query_one("#messages-container")
|
291
|
-
if messages_container and hasattr(messages_container, 'scroll_end'):
|
292
|
-
messages_container.scroll_end(animate=False)
|
293
|
-
except Exception as scroll_err:
|
294
|
-
debug_log(f"Error scrolling: {str(scroll_err)}")
|
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)}")
|
295
286
|
except Exception as callback_err:
|
296
287
|
debug_log(f"Error in UI callback: {str(callback_err)}")
|
297
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.
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|