Terminal Messenger
A simple, colorful terminal-based messenger application written in Go that connects to a remote messaging endpoint.
Features
- 🎨 Colorized output - Blue for your input, green for assistant responses
- ⌨️ Input history - Navigate previous messages with arrow keys
- 💬 Conversation context - Maintains conversation continuity across messages
- 🚀 Simple and fast - Minimal setup, quick startup
- 📝 Line editing - Full cursor movement and text editing support
Prerequisites
- Go 1.16 or higher
- Internet connection
Installation
-
Clone or download the project
-
Initialize Go module
go mod init messenger -
Install dependencies
go get github.com/chzyer/readline -
Build the application (optional)
go build -o messenger main.go
Usage
Running the application
Using go run:
go run main.go
Or if you built the binary:
./messenger
Getting started
- When prompted, enter a model name (or press Enter for "default")
- Start typing your messages
- The assistant will respond to each message
- Use arrow keys to navigate through your input history
- Type
quitorexitto end the session
Keyboard shortcuts
- ↑ (Up arrow) - Navigate to previous input
- ↓ (Down arrow) - Navigate to next input
- ←/→ (Left/Right arrows) - Move cursor within current input
- Ctrl+A - Jump to beginning of line
- Ctrl+E - Jump to end of line
- Ctrl+C - Interrupt/exit application
Configuration
The application connects to:
https://router.ivastudio.verint.live/ProxyScript/run/67bca862210071627d32ef12/current/basic_messenger
To change the endpoint, modify the apiURL constant in main.go.
Request format
The application sends POST requests with the following JSON structure:
{
"input": "your message here",
"model": "model name",
"previous_response_id": "previous response ID for context",
"metadata": {
"channel": "text"
}
}
Response format
Expected response structure:
{
"id": "response-id",
"object": "response",
"created_at": 1234567890,
"status": "completed",
"model": "Model Name",
"output": [
{
"type": "message",
"id": "message-id",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Assistant response here",
"annotations": []
}
]
}
]
}
Project Structure
.
├── main.go # Main application file
├── go.mod # Go module file
└── README.md # This file
Troubleshooting
Connection errors
If you encounter connection errors, check:
- Your internet connection
- The endpoint URL is accessible
- Firewall settings aren't blocking the connection
Module errors
If you get "module not found" errors:
go mod tidy
History file permissions
The app creates a history file at /tmp/messenger_history.tmp. If you encounter permission errors, ensure you have write access to /tmp/.
Dependencies
- github.com/chzyer/readline - For input history and line editing
License
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.