chat-console 0.1.6.dev1__py3-none-any.whl → 0.1.9.dev1__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/main.py +20 -41
- app/ui/chat_interface.py +45 -14
- {chat_console-0.1.6.dev1.dist-info → chat_console-0.1.9.dev1.dist-info}/METADATA +3 -2
- {chat_console-0.1.6.dev1.dist-info → chat_console-0.1.9.dev1.dist-info}/RECORD +9 -9
- {chat_console-0.1.6.dev1.dist-info → chat_console-0.1.9.dev1.dist-info}/WHEEL +1 -1
- {chat_console-0.1.6.dev1.dist-info → chat_console-0.1.9.dev1.dist-info}/entry_points.txt +0 -0
- {chat_console-0.1.6.dev1.dist-info → chat_console-0.1.9.dev1.dist-info/licenses}/LICENSE +0 -0
- {chat_console-0.1.6.dev1.dist-info → chat_console-0.1.9.dev1.dist-info}/top_level.txt +0 -0
app/__init__.py
CHANGED
app/main.py
CHANGED
@@ -258,42 +258,9 @@ class SimpleChatApp(App):
|
|
258
258
|
border: solid $primary;
|
259
259
|
}
|
260
260
|
|
261
|
-
#send-button
|
262
|
-
|
263
|
-
min-width: 8;
|
264
|
-
height: 2;
|
265
|
-
color: $text;
|
266
|
-
background: $primary;
|
267
|
-
border: solid $primary;
|
268
|
-
content-align: center middle;
|
269
|
-
}
|
270
|
-
|
271
|
-
#button-row {
|
272
|
-
width: 100%;
|
273
|
-
height: auto;
|
274
|
-
align-horizontal: right;
|
275
|
-
}
|
276
|
-
|
277
|
-
#new-chat-button {
|
278
|
-
width: auto;
|
279
|
-
min-width: 8;
|
280
|
-
height: 2;
|
281
|
-
color: $text;
|
282
|
-
background: $success;
|
283
|
-
border: solid $success-lighten-1;
|
284
|
-
content-align: center middle;
|
285
|
-
}
|
261
|
+
/* Removed CSS for #send-button, #new-chat-button, #view-history-button, #settings-button */
|
262
|
+
/* Removed CSS for #button-row */
|
286
263
|
|
287
|
-
#view-history-button, #settings-button {
|
288
|
-
width: auto;
|
289
|
-
min-width: 8;
|
290
|
-
height: 2;
|
291
|
-
color: $text;
|
292
|
-
background: $primary-darken-1;
|
293
|
-
border: solid $primary;
|
294
|
-
margin-right: 1;
|
295
|
-
content-align: center middle;
|
296
|
-
}
|
297
264
|
"""
|
298
265
|
|
299
266
|
BINDINGS = [
|
@@ -301,6 +268,8 @@ class SimpleChatApp(App):
|
|
301
268
|
Binding("n", "action_new_conversation", "New Chat"),
|
302
269
|
Binding("escape", "escape", "Cancel"),
|
303
270
|
Binding("ctrl+c", "quit", "Quit"),
|
271
|
+
Binding("h", "view_history", "History", show=True, key_display="h"),
|
272
|
+
Binding("s", "settings", "Settings", show=True, key_display="s"),
|
304
273
|
]
|
305
274
|
|
306
275
|
current_conversation = reactive(None)
|
@@ -333,11 +302,7 @@ class SimpleChatApp(App):
|
|
333
302
|
# Input area
|
334
303
|
with Container(id="input-area"):
|
335
304
|
yield Input(placeholder="Type your message here...", id="message-input")
|
336
|
-
|
337
|
-
with Horizontal(id="button-row"):
|
338
|
-
yield Button("Settings", id="settings-button", variant="primary")
|
339
|
-
yield Button("View History", id="view-history-button", variant="primary")
|
340
|
-
yield Button("+ New Chat", id="new-chat-button")
|
305
|
+
# Removed Static widgets previously used for diagnosis
|
341
306
|
|
342
307
|
yield Footer()
|
343
308
|
|
@@ -617,7 +582,7 @@ class SimpleChatApp(App):
|
|
617
582
|
def on_style_selector_style_selected(self, event: StyleSelector.StyleSelected) -> None:
|
618
583
|
"""Handle style selection"""
|
619
584
|
self.selected_style = event.style_id
|
620
|
-
|
585
|
+
|
621
586
|
async def on_button_pressed(self, event: Button.Pressed) -> None:
|
622
587
|
"""Handle button presses."""
|
623
588
|
button_id = event.button.id
|
@@ -666,6 +631,20 @@ class SimpleChatApp(App):
|
|
666
631
|
|
667
632
|
self.push_screen(HistoryScreen(conversations, handle_selection))
|
668
633
|
|
634
|
+
async def action_view_history(self) -> None:
|
635
|
+
"""Action to view chat history via key binding."""
|
636
|
+
# Only trigger if message input is not focused
|
637
|
+
input_widget = self.query_one("#message-input", Input)
|
638
|
+
if not input_widget.has_focus:
|
639
|
+
await self.view_chat_history()
|
640
|
+
|
641
|
+
def action_settings(self) -> None:
|
642
|
+
"""Action to open settings via key binding."""
|
643
|
+
# Only trigger if message input is not focused
|
644
|
+
input_widget = self.query_one("#message-input", Input)
|
645
|
+
if not input_widget.has_focus:
|
646
|
+
self.push_screen(SettingsScreen())
|
647
|
+
|
669
648
|
def main(initial_text: Optional[str] = typer.Argument(None, help="Initial text to start the chat with")):
|
670
649
|
"""Entry point for the chat-cli application"""
|
671
650
|
# When no argument is provided, typer passes the ArgumentInfo object
|
app/ui/chat_interface.py
CHANGED
@@ -12,7 +12,9 @@ from textual.widgets import Button, Input, Label, Static
|
|
12
12
|
from textual.widget import Widget
|
13
13
|
from textual.widgets import RichLog
|
14
14
|
from textual.message import Message
|
15
|
+
from textual.binding import Binding
|
15
16
|
|
17
|
+
from .. import __version__
|
16
18
|
from ..models import Message, Conversation
|
17
19
|
from ..api.base import BaseModelClient
|
18
20
|
from ..config import CONFIG
|
@@ -20,6 +22,37 @@ from ..config import CONFIG
|
|
20
22
|
# Set up logging
|
21
23
|
logger = logging.getLogger(__name__)
|
22
24
|
|
25
|
+
class SendButton(Button):
|
26
|
+
"""Custom send button implementation"""
|
27
|
+
|
28
|
+
DEFAULT_CSS = """
|
29
|
+
/* Drastically simplified SendButton CSS */
|
30
|
+
SendButton {
|
31
|
+
color: white; /* Basic text color */
|
32
|
+
/* Removed most properties */
|
33
|
+
margin: 0 1; /* Keep margin for spacing */
|
34
|
+
}
|
35
|
+
|
36
|
+
SendButton > .button--label {
|
37
|
+
color: white; /* Basic label color */
|
38
|
+
width: auto; /* Ensure label width isn't constrained */
|
39
|
+
height: auto; /* Ensure label height isn't constrained */
|
40
|
+
/* Removed most properties */
|
41
|
+
}
|
42
|
+
"""
|
43
|
+
|
44
|
+
def __init__(self, name: Optional[str] = None):
|
45
|
+
super().__init__(
|
46
|
+
"⬆ SEND ⬆",
|
47
|
+
name=name,
|
48
|
+
variant="success"
|
49
|
+
)
|
50
|
+
|
51
|
+
def on_mount(self) -> None:
|
52
|
+
"""Handle mount event"""
|
53
|
+
self.styles.text_opacity = 100
|
54
|
+
self.styles.text_style = "bold"
|
55
|
+
|
23
56
|
class MessageDisplay(RichLog):
|
24
57
|
"""Widget to display a single message"""
|
25
58
|
|
@@ -150,10 +183,14 @@ class ChatInterface(Container):
|
|
150
183
|
border: solid $primary;
|
151
184
|
}
|
152
185
|
|
153
|
-
#
|
154
|
-
width:
|
155
|
-
|
156
|
-
|
186
|
+
#version-label {
|
187
|
+
width: 100%;
|
188
|
+
height: 1;
|
189
|
+
background: $warning;
|
190
|
+
color: black;
|
191
|
+
text-align: right;
|
192
|
+
padding: 0 1;
|
193
|
+
text-style: bold;
|
157
194
|
}
|
158
195
|
|
159
196
|
#loading-indicator {
|
@@ -192,23 +229,18 @@ class ChatInterface(Container):
|
|
192
229
|
self.messages = conversation.messages
|
193
230
|
|
194
231
|
def compose(self) -> ComposeResult:
|
195
|
-
"
|
196
|
-
# Messages area
|
232
|
+
yield Label(f"Chat CLI v{__version__}", id="version-label")
|
197
233
|
with ScrollableContainer(id="messages-container"):
|
198
234
|
for message in self.messages:
|
199
235
|
yield MessageDisplay(message, highlight_code=CONFIG["highlight_code"])
|
200
|
-
|
201
|
-
# Input area with loading indicator and controls
|
202
236
|
with Container(id="input-area"):
|
203
237
|
yield Container(
|
204
238
|
Label("Generating response...", id="loading-text"),
|
205
239
|
id="loading-indicator"
|
206
240
|
)
|
207
|
-
|
208
|
-
InputWithFocus(placeholder="Type your message here...", id="message-input")
|
209
|
-
|
210
|
-
id="controls"
|
211
|
-
)
|
241
|
+
with Container(id="controls"):
|
242
|
+
yield InputWithFocus(placeholder="Type your message here...", id="message-input")
|
243
|
+
yield SendButton(id="send-button")
|
212
244
|
|
213
245
|
def on_mount(self) -> None:
|
214
246
|
"""Initialize on mount"""
|
@@ -229,7 +261,6 @@ class ChatInterface(Container):
|
|
229
261
|
async def on_button_pressed(self, event: Button.Pressed) -> None:
|
230
262
|
"""Handle button presses"""
|
231
263
|
button_id = event.button.id
|
232
|
-
|
233
264
|
if button_id == "send-button":
|
234
265
|
await self.send_message()
|
235
266
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: chat-console
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.9.dev1
|
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
|
@@ -23,6 +23,7 @@ Dynamic: classifier
|
|
23
23
|
Dynamic: description
|
24
24
|
Dynamic: description-content-type
|
25
25
|
Dynamic: home-page
|
26
|
+
Dynamic: license-file
|
26
27
|
Dynamic: requires-dist
|
27
28
|
Dynamic: requires-python
|
28
29
|
Dynamic: summary
|
@@ -1,7 +1,7 @@
|
|
1
|
-
app/__init__.py,sha256=
|
1
|
+
app/__init__.py,sha256=OeqboIrx_Kjea0CY9Be8nLI-No1YWQfqbWIp-4lMOOI,131
|
2
2
|
app/config.py,sha256=7C09kn2bmda9frTPfZ7f1JhagqHAZjGM5BYqZmhegYM,5190
|
3
3
|
app/database.py,sha256=nt8CVuDpy6zw8mOYqDcfUmNw611t7Ln7pz22M0b6-MI,9967
|
4
|
-
app/main.py,sha256=
|
4
|
+
app/main.py,sha256=7RbLeFWRwZEqZvYijvUTvZmngXGeKVZx7MH4mPiW2jA,23972
|
5
5
|
app/models.py,sha256=4-y9Lytay2exWPFi0FDlVeRL3K2-I7E-jBqNzTfokqY,2644
|
6
6
|
app/utils.py,sha256=zK8aTPdadXomyG2Kgpi7WuC5XYwfShJj74bXWSLtyW0,4309
|
7
7
|
app/api/__init__.py,sha256=A8UL84ldYlv8l7O-yKzraVFcfww86SgWfpl4p7R03-w,62
|
@@ -10,14 +10,14 @@ app/api/base.py,sha256=-6RSxSpqe-OMwkaq1wVWbu3pVkte-ZYy8rmdvt-Qh48,3953
|
|
10
10
|
app/api/ollama.py,sha256=zFZ3g2sYncvMgcvx92jTCLkigIaDvTuhILcLiCrwisc,11640
|
11
11
|
app/api/openai.py,sha256=1fYgFXXL6yj_7lQ893Yj28RYG4M8d6gt_q1gzhhjcig,3641
|
12
12
|
app/ui/__init__.py,sha256=RndfbQ1Tv47qdSiuQzvWP96lPS547SDaGE-BgOtiP_w,55
|
13
|
-
app/ui/chat_interface.py,sha256=
|
13
|
+
app/ui/chat_interface.py,sha256=4ahB7IpqL3hLzVPsfN6E4uC833_gMvRSzjSVfdjHGUY,13082
|
14
14
|
app/ui/chat_list.py,sha256=WQTYVNSSXlx_gQal3YqILZZKL9UiTjmNMIDX2I9pAMM,11205
|
15
15
|
app/ui/model_selector.py,sha256=xCuaohgYvebgP0Eel6-XzUn-7Y0SrJUArdTr-CDBZXc,12840
|
16
16
|
app/ui/search.py,sha256=b-m14kG3ovqW1-i0qDQ8KnAqFJbi5b1FLM9dOnbTyIs,9763
|
17
17
|
app/ui/styles.py,sha256=04AhPuLrOd2yenfRySFRestPeuTPeMLzhmMB67NdGvw,5615
|
18
|
-
chat_console-0.1.
|
19
|
-
chat_console-0.1.
|
20
|
-
chat_console-0.1.
|
21
|
-
chat_console-0.1.
|
22
|
-
chat_console-0.1.
|
23
|
-
chat_console-0.1.
|
18
|
+
chat_console-0.1.9.dev1.dist-info/licenses/LICENSE,sha256=srHZ3fvcAuZY1LHxE7P6XWju2njRCHyK6h_ftEbzxSE,1057
|
19
|
+
chat_console-0.1.9.dev1.dist-info/METADATA,sha256=VQorzuMOChtzRwlOf88fnHEdbtDpUi-PMIYGDVoK9AY,2926
|
20
|
+
chat_console-0.1.9.dev1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
21
|
+
chat_console-0.1.9.dev1.dist-info/entry_points.txt,sha256=kkVdEc22U9PAi2AeruoKklfkng_a_aHAP6VRVwrAD7c,67
|
22
|
+
chat_console-0.1.9.dev1.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
|
23
|
+
chat_console-0.1.9.dev1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|