Adding terminal messenger
This is a golang based application that connects to the basic messenger
This commit is contained in:
166
terminal-messenger/application/README.md
Normal file
166
terminal-messenger/application/README.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# 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
|
||||
|
||||
1. **Clone or download the project**
|
||||
|
||||
2. **Initialize Go module**
|
||||
|
||||
```bash
|
||||
go mod init messenger
|
||||
```
|
||||
|
||||
3. **Install dependencies**
|
||||
|
||||
```bash
|
||||
go get github.com/chzyer/readline
|
||||
```
|
||||
|
||||
4. **Build the application (optional)**
|
||||
```bash
|
||||
go build -o messenger main.go
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Running the application
|
||||
|
||||
**Using go run:**
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
```
|
||||
|
||||
**Or if you built the binary:**
|
||||
|
||||
```bash
|
||||
./messenger
|
||||
```
|
||||
|
||||
### Getting started
|
||||
|
||||
1. When prompted, enter a model name (or press Enter for "default")
|
||||
2. Start typing your messages
|
||||
3. The assistant will respond to each message
|
||||
4. Use arrow keys to navigate through your input history
|
||||
5. Type `quit` or `exit` to 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:
|
||||
|
||||
```json
|
||||
{
|
||||
"input": "your message here",
|
||||
"model": "model name",
|
||||
"previous_response_id": "previous response ID for context",
|
||||
"metadata": {
|
||||
"channel": "text"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Response format
|
||||
|
||||
Expected response structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"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:
|
||||
|
||||
```bash
|
||||
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](https://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.
|
||||
Reference in New Issue
Block a user