chat-console 0.4.91__py3-none-any.whl → 0.4.94__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 +1 -1
- app/console_utils.py +46 -29
- {chat_console-0.4.91.dist-info → chat_console-0.4.94.dist-info}/METADATA +1 -1
- {chat_console-0.4.91.dist-info → chat_console-0.4.94.dist-info}/RECORD +8 -8
- {chat_console-0.4.91.dist-info → chat_console-0.4.94.dist-info}/WHEEL +0 -0
- {chat_console-0.4.91.dist-info → chat_console-0.4.94.dist-info}/entry_points.txt +0 -0
- {chat_console-0.4.91.dist-info → chat_console-0.4.94.dist-info}/licenses/LICENSE +0 -0
- {chat_console-0.4.91.dist-info → chat_console-0.4.94.dist-info}/top_level.txt +0 -0
app/__init__.py
CHANGED
app/console_utils.py
CHANGED
@@ -55,37 +55,54 @@ async def console_streaming_response(
|
|
55
55
|
style=style
|
56
56
|
):
|
57
57
|
if chunk:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
58
|
+
# For Ollama, break down large chunks into smaller pieces for smoother streaming
|
59
|
+
if is_ollama and len(chunk) > 1:
|
60
|
+
# Split chunk into smaller pieces (words or characters)
|
61
|
+
words = chunk.split(' ')
|
62
|
+
for i, word in enumerate(words):
|
63
|
+
if i > 0:
|
64
|
+
word = ' ' + word # Add space back except for first word
|
65
|
+
|
66
|
+
full_content += word
|
67
|
+
|
68
|
+
# Update display with gradual content
|
69
|
+
if update_callback:
|
70
|
+
update_callback(full_content)
|
71
|
+
|
72
|
+
yield word
|
73
|
+
|
74
|
+
# Small delay between words for streaming effect
|
75
|
+
await asyncio.sleep(0.03)
|
76
|
+
else:
|
77
|
+
buffer.append(chunk)
|
78
|
+
current_time = time.time()
|
78
79
|
|
79
|
-
#
|
80
|
-
|
80
|
+
# Update based on time interval or buffer size
|
81
|
+
should_update = (
|
82
|
+
current_time - last_update >= update_interval or
|
83
|
+
len(buffer) >= buffer_size or
|
84
|
+
len(full_content) < 100 # Always update quickly for first few chars
|
85
|
+
)
|
81
86
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
87
|
+
if should_update:
|
88
|
+
# Process buffered chunks
|
89
|
+
new_content = ''.join(buffer)
|
90
|
+
full_content += new_content
|
91
|
+
buffer = []
|
92
|
+
last_update = current_time
|
93
|
+
|
94
|
+
# Call update callback with accumulated content
|
95
|
+
if update_callback:
|
96
|
+
update_callback(full_content)
|
97
|
+
|
98
|
+
# Yield the new chunk for compatibility
|
99
|
+
yield new_content
|
100
|
+
|
101
|
+
# Provider-specific delays
|
102
|
+
if is_openai and not model.startswith(("o1", "o3", "o4")):
|
103
|
+
await asyncio.sleep(0.01) # Minimal delay for fast OpenAI models
|
104
|
+
else:
|
105
|
+
await asyncio.sleep(0.015) # Default delay
|
89
106
|
|
90
107
|
# Process any remaining buffer content
|
91
108
|
if buffer:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: chat-console
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.94
|
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,8 +1,8 @@
|
|
1
|
-
app/__init__.py,sha256=
|
1
|
+
app/__init__.py,sha256=jOSPwihztW6tm1_MpiQdJBEJFLc7SwQ1y6Q1xRgvtao,131
|
2
2
|
app/config.py,sha256=F-0hO3NT5kRJxZelGLxaeUmnwx8i0LPHzYtNftL6CwM,8468
|
3
3
|
app/console_chat.py,sha256=y43zFuX4WT08NNGsXcO6GhA8B0RRCvrfRIPY5-jcQVo,82326
|
4
4
|
app/console_main.py,sha256=QNUiD9IPw2Spl-gpvrw1AzDqezMpmU3IPHlcK1LDOtI,1799
|
5
|
-
app/console_utils.py,sha256=
|
5
|
+
app/console_utils.py,sha256=rPaE71NK-7x3Xh9gblN-4j6iDoGgiOqp9BXVYG_POBs,7965
|
6
6
|
app/database.py,sha256=nt8CVuDpy6zw8mOYqDcfUmNw611t7Ln7pz22M0b6-MI,9967
|
7
7
|
app/main.py,sha256=kZtiKXNVmy9QLjm_qdSW9qged8nhXBydUq_5u7yYx6k,87767
|
8
8
|
app/models.py,sha256=4-y9Lytay2exWPFi0FDlVeRL3K2-I7E-jBqNzTfokqY,2644
|
@@ -20,9 +20,9 @@ app/ui/model_browser.py,sha256=pdblLVkdyVF0_Bo02bqbErGAtieyH-y6IfhMOPEqIso,71124
|
|
20
20
|
app/ui/model_selector.py,sha256=3ykyDhzJU9KQg3XnOQbba5bhpqsSH1RwIYEGWVY37GQ,19407
|
21
21
|
app/ui/search.py,sha256=b-m14kG3ovqW1-i0qDQ8KnAqFJbi5b1FLM9dOnbTyIs,9763
|
22
22
|
app/ui/styles.py,sha256=MZ7J3D796IFYsDQs-RFxSLGHhcQqsaXym9wv3LYMI5k,9284
|
23
|
-
chat_console-0.4.
|
24
|
-
chat_console-0.4.
|
25
|
-
chat_console-0.4.
|
26
|
-
chat_console-0.4.
|
27
|
-
chat_console-0.4.
|
28
|
-
chat_console-0.4.
|
23
|
+
chat_console-0.4.94.dist-info/licenses/LICENSE,sha256=srHZ3fvcAuZY1LHxE7P6XWju2njRCHyK6h_ftEbzxSE,1057
|
24
|
+
chat_console-0.4.94.dist-info/METADATA,sha256=XDmFk-BV1qb9L7iwIUk2gLi863rEtfOn5m5gs6HmSHM,3810
|
25
|
+
chat_console-0.4.94.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
26
|
+
chat_console-0.4.94.dist-info/entry_points.txt,sha256=oy1j-LnmYOO0akBMP8Ijx0rZxxA7N3FSy82ZeCPNnqE,142
|
27
|
+
chat_console-0.4.94.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
|
28
|
+
chat_console-0.4.94.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|