chat-console 0.1.1__py3-none-any.whl → 0.1.2__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/main.py CHANGED
@@ -4,6 +4,7 @@ Simplified version of Chat CLI with AI functionality
4
4
  """
5
5
  import os
6
6
  import asyncio
7
+ import typer
7
8
  from typing import List, Optional, Callable, Awaitable
8
9
  from datetime import datetime
9
10
 
@@ -299,12 +300,13 @@ class SimpleChatApp(App):
299
300
  current_conversation = reactive(None)
300
301
  is_generating = reactive(False)
301
302
 
302
- def __init__(self):
303
+ def __init__(self, initial_text: Optional[str] = None):
303
304
  super().__init__()
304
305
  self.db = ChatDatabase()
305
306
  self.messages = []
306
307
  self.selected_model = CONFIG["default_model"]
307
308
  self.selected_style = CONFIG["default_style"]
309
+ self.initial_text = initial_text
308
310
 
309
311
  def compose(self) -> ComposeResult:
310
312
  """Create the simplified application layout."""
@@ -363,8 +365,15 @@ class SimpleChatApp(App):
363
365
 
364
366
  # Create a new conversation
365
367
  await self.create_new_conversation()
366
- # Focus the input
367
- self.query_one("#message-input").focus()
368
+
369
+ # If initial text was provided, send it
370
+ if self.initial_text:
371
+ input_widget = self.query_one("#message-input", Input)
372
+ input_widget.value = self.initial_text
373
+ await self.action_send_message()
374
+ else:
375
+ # Focus the input if no initial text
376
+ self.query_one("#message-input").focus()
368
377
 
369
378
  async def create_new_conversation(self) -> None:
370
379
  """Create a new chat conversation."""
@@ -481,8 +490,14 @@ class SimpleChatApp(App):
481
490
  })
482
491
 
483
492
  # Get appropriate client
484
- client = BaseModelClient.get_client_for_model(model)
485
-
493
+ try:
494
+ client = BaseModelClient.get_client_for_model(model)
495
+ if client is None:
496
+ raise Exception(f"No client available for model: {model}")
497
+ except Exception as e:
498
+ self.notify(f"Failed to initialize model client: {str(e)}", severity="error")
499
+ return
500
+
486
501
  # Start streaming response
487
502
  assistant_message = Message(role="assistant", content="")
488
503
  self.messages.append(assistant_message)
@@ -590,10 +605,17 @@ class SimpleChatApp(App):
590
605
 
591
606
  self.push_screen(HistoryScreen(conversations, handle_selection))
592
607
 
593
- def main():
608
+ def main(initial_text: Optional[str] = typer.Argument(None, help="Initial text to start the chat with")):
594
609
  """Entry point for the chat-cli application"""
595
- app = SimpleChatApp()
610
+ # When no argument is provided, typer passes the ArgumentInfo object
611
+ # When an argument is provided, typer passes the actual value
612
+ if isinstance(initial_text, typer.models.ArgumentInfo):
613
+ initial_value = None # No argument provided
614
+ else:
615
+ initial_value = str(initial_text) if initial_text is not None else None
616
+
617
+ app = SimpleChatApp(initial_text=initial_value)
596
618
  app.run()
597
619
 
598
620
  if __name__ == "__main__":
599
- main()
621
+ typer.run(main)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: chat-console
3
- Version: 0.1.1
3
+ Version: 0.1.2
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,7 +1,7 @@
1
1
  app/__init__.py,sha256=u5X4kPcpqZ12ZLnhwwOCScNvftaknDTrb0DMXqR_iLc,130
2
2
  app/config.py,sha256=PLEic_jwfWvWJxDfQMbKSbJ4ULrcmDhVe0apqegMO_g,3571
3
3
  app/database.py,sha256=nt8CVuDpy6zw8mOYqDcfUmNw611t7Ln7pz22M0b6-MI,9967
4
- app/main.py,sha256=B_E8ovyGX1xLXDJF_nkjQcbX_AP5hLDih3jqJXdHMMY,19848
4
+ app/main.py,sha256=suyVFuVughSz4ld533sdwqtAedVN4EW1rZpoxNHksBY,21000
5
5
  app/models.py,sha256=4-y9Lytay2exWPFi0FDlVeRL3K2-I7E-jBqNzTfokqY,2644
6
6
  app/utils.py,sha256=oUpQpqrxvvQn0S0lMCSwDC1Rx0PHpoAIRDySohYV5Oo,6586
7
7
  app/api/__init__.py,sha256=A8UL84ldYlv8l7O-yKzraVFcfww86SgWfpl4p7R03-w,62
@@ -15,9 +15,9 @@ app/ui/chat_list.py,sha256=WQTYVNSSXlx_gQal3YqILZZKL9UiTjmNMIDX2I9pAMM,11205
15
15
  app/ui/model_selector.py,sha256=Rv0i2VjLL2-cp4Pn_uMnAnAIV7Zk9gBX1XoWKBzkxHg,10367
16
16
  app/ui/search.py,sha256=b-m14kG3ovqW1-i0qDQ8KnAqFJbi5b1FLM9dOnbTyIs,9763
17
17
  app/ui/styles.py,sha256=eVDBTpBGnQ-mg5SeLi6i74ZjhCpItxAwWh1IelD09GY,5445
18
- chat_console-0.1.1.dist-info/LICENSE,sha256=srHZ3fvcAuZY1LHxE7P6XWju2njRCHyK6h_ftEbzxSE,1057
19
- chat_console-0.1.1.dist-info/METADATA,sha256=Nhshut-tQIN9whzOfxVBNYVAjx6wG90KoyzLgpNeFlg,2899
20
- chat_console-0.1.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
21
- chat_console-0.1.1.dist-info/entry_points.txt,sha256=kkVdEc22U9PAi2AeruoKklfkng_a_aHAP6VRVwrAD7c,67
22
- chat_console-0.1.1.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
23
- chat_console-0.1.1.dist-info/RECORD,,
18
+ chat_console-0.1.2.dist-info/LICENSE,sha256=srHZ3fvcAuZY1LHxE7P6XWju2njRCHyK6h_ftEbzxSE,1057
19
+ chat_console-0.1.2.dist-info/METADATA,sha256=4VoR4lrcZq-m37Kkpy4-Ld7QSKsUtqDwpvjj8xCW9WE,2899
20
+ chat_console-0.1.2.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
21
+ chat_console-0.1.2.dist-info/entry_points.txt,sha256=kkVdEc22U9PAi2AeruoKklfkng_a_aHAP6VRVwrAD7c,67
22
+ chat_console-0.1.2.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
23
+ chat_console-0.1.2.dist-info/RECORD,,