diff --git a/terminal-messenger/application/README.md b/terminal-messenger/application/README.md index 6e1869e..96d2f29 100644 --- a/terminal-messenger/application/README.md +++ b/terminal-messenger/application/README.md @@ -1,15 +1,20 @@ # Terminal Messenger -A simple, colorful terminal-based messenger application written in Go that connects to a remote messaging endpoint with conversation persistence and history management. +A simple, colorful terminal-based messenger application written in Go that +connects to a remote messaging endpoint with conversation persistence and +history management. ## Features -- šŸŽØ **Colorized output** - Blue for your input, green for assistant responses +- šŸŽØ **Colorized output** - Blue for your input, green for assistant + responses - āŒØļø **Input history** - Navigate previous messages with arrow keys - šŸ’¾ **Conversation persistence** - Resume previous conversations seamlessly -- šŸ“ **Full conversation logs** - Both user and assistant messages saved with timestamps +- šŸ“ **Full conversation logs** - Both user and assistant messages saved + with timestamps - šŸ”„ **Auto-resume** - Lists your 5 most recent conversations on startup -- šŸ·ļø **Model tracking** - Automatically saves and loads the model used per conversation +- šŸ·ļø **Model tracking** - Automatically saves and loads the model used per + conversation - šŸš€ **Simple and fast** - Minimal setup, quick startup ## Prerequisites @@ -87,9 +92,12 @@ go run main.go For each conversation, three files are created in `/tmp/`: -1. **`messenger_{ID}.tmp`** - Readline history for arrow key navigation (user inputs only) -2. **`messenger_{ID}_log.txt`** - Full conversation log with timestamps (both user and assistant) -3. **`messenger_{ID}_meta.txt`** - Stores the model name for the conversation +1. **`messenger_{ID}.tmp`** - Readline history for arrow key navigation + (user inputs only) +2. **`messenger_{ID}_log.txt`** - Full conversation log with timestamps + (both user and assistant) +3. **`messenger_{ID}_meta.txt`** - Stores the model name for the + conversation ### Conversation Continuity @@ -176,15 +184,19 @@ go mod tidy ### History file permissions -The app creates files in `/tmp/`. If you encounter permission errors, ensure you have write access to `/tmp/`. +The app creates files in `/tmp/`. If you encounter permission errors, +ensure you have write access to `/tmp/`. ### Cannot find previous conversations -Conversations are stored in `/tmp/` which may be cleared on system restart. For permanent storage, modify the file paths in `main.go` to use a different directory like `~/.messenger/`. +Conversations are stored in `/tmp/` which may be cleared on system +restart. For permanent storage, modify the file paths in `main.go` to use +a different directory like `~/.messenger/`. ## Dependencies -- [github.com/chzyer/readline](https://github.com/chzyer/readline) - For input history and line editing +- [github.com/chzyer/readline](https://github.com/chzyer/readline) - + For input history and line editing ## License @@ -192,4 +204,7 @@ This project is provided as-is for educational and development purposes. ## Contributing -Feel free to submit issues, fork the repository, and create pull requests for any improvements. +Feel free to submit issues, fork the repository, and create pull requests +for any improvements.:> [!WARNING] + +> diff --git a/terminal-messenger/application/main.go b/terminal-messenger/application/main.go index 49f3da9..dcfd642 100644 --- a/terminal-messenger/application/main.go +++ b/terminal-messenger/application/main.go @@ -121,9 +121,11 @@ func showHistory(id string) { } func main() { - var id, model string +var id, model string - // Check for recent conversations +fmt.Println("\nā–‘ā–€ā–ˆā–€ā–‘ā–ˆā–‘ā–ˆā–‘ā–ˆā–€ā–ˆā–‘ā–‘ā–‘ā–ˆā–„ā–ˆā–‘ā–ˆā–€ā–€ā–‘ā–ˆā–€ā–€ā–‘ā–ˆā–€ā–€ā–‘ā–ˆā–€ā–€ā–‘ā–ˆā–€ā–ˆā–‘ā–ˆā–€ā–€ā–‘ā–ˆā–€ā–€ā–‘ā–ˆā–€ā–„\nā–‘ā–‘ā–ˆā–‘ā–‘ā–€ā–„ā–€ā–‘ā–ˆā–€ā–ˆā–‘ā–‘ā–‘ā–ˆā–‘ā–ˆā–‘ā–ˆā–€ā–€ā–‘ā–€ā–€ā–ˆā–‘ā–€ā–€ā–ˆā–‘ā–ˆā–€ā–€ā–‘ā–ˆā–‘ā–ˆā–‘ā–ˆā–‘ā–ˆā–‘ā–ˆā–€ā–€ā–‘ā–ˆā–€ā–„\n░▀▀▀░░▀░░▀░▀░░░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀░▀") + +// Check for recent conversations convs := getConversations() if len(convs) > 0 { fmt.Println("Recent conversations:") @@ -153,7 +155,8 @@ func main() { m := &Messenger{&http.Client{Timeout: 10 * time.Second}, model, id} - fmt.Println("\n=== Terminal Messenger ===") + + fmt.Println("Use ↑/↓ for history, 'quit' to exit\n") histFile := "/tmp/messenger_temp.tmp"