2025-01-09 07:30:52 +00:00
|
|
|
To use this bot:
|
2025-01-09 07:23:43 +00:00
|
|
|
|
2025-01-09 07:56:06 +00:00
|
|
|
1. Set up your environment:
|
2025-01-09 07:30:52 +00:00
|
|
|
```bash
|
2025-01-09 07:56:06 +00:00
|
|
|
export VENICE_API_KEY="your_venice_api_key_here"
|
2025-01-09 07:30:52 +00:00
|
|
|
```
|
|
|
|
|
2025-01-09 07:56:06 +00:00
|
|
|
2. Build and run the bot using Stack or Cabal.
|
2025-01-09 07:30:52 +00:00
|
|
|
|
|
|
|
Key features of this implementation:
|
|
|
|
|
2025-01-09 07:56:06 +00:00
|
|
|
1. The bot only responds to messages prefixed with ```/bot``` [^1]
|
|
|
|
2. It uses the Venice.ai API for generating responses [^2]
|
|
|
|
3. The API key is loaded from environment variables for security
|
|
|
|
4. Error handling for API calls is implemented
|
|
|
|
5. The bot maintains the SimpleX chat protocol while adding Venice.ai integration
|
2025-01-09 07:30:52 +00:00
|
|
|
|
2025-01-09 07:56:06 +00:00
|
|
|
Usage example:
|
2025-01-09 07:30:52 +00:00
|
|
|
```
|
2025-01-09 07:56:06 +00:00
|
|
|
User: /bot What is the capital of France?
|
|
|
|
Bot: Paris is the capital of France.
|
|
|
|
|
|
|
|
User: regular message
|
|
|
|
Bot: (no response)
|
2025-01-09 07:30:52 +00:00
|
|
|
```
|
|
|
|
|
2025-01-09 07:56:06 +00:00
|
|
|
To improve this further, you could:
|
2025-01-09 07:30:52 +00:00
|
|
|
|
2025-01-09 07:56:06 +00:00
|
|
|
1. Add rate limiting
|
|
|
|
2. Implement conversation history
|
|
|
|
3. Add more command options (like ```/bot help```, ```/bot reset```)
|
|
|
|
4. Add error logging
|
|
|
|
5. Implement retry logic for failed API calls
|
2025-01-09 07:30:52 +00:00
|
|
|
|
2025-01-09 07:56:06 +00:00
|
|
|
Let me know if you need any clarification or have questions about specific parts of the implementation!
|
2025-01-09 07:30:52 +00:00
|
|
|
|
2025-01-09 07:56:06 +00:00
|
|
|
[^1]: [simplex-chat/apps/simplex-bot/Main.hs at stable · simplex-chat/simplex-chat](https://github.com/simplex-chat/simplex-chat/blob/stable/apps/simplex-bot/Main.hs#:~:text=Full%20document,more%20information.)
|
|
|
|
[^2]: [Venice API Docs](https://docs.venice.ai/api-reference/api-spec#:~:text=Full%20document,more%20information.)
|