Introduction to Nonebot-plugin-gpt3
Nonebot-plugin-gpt3 is an engaging plugin for NoneBot, offering an interactive way to communicate using OpenAI's official API. The plugin takes advantage of OpenAI's advanced capabilities to provide a real-time chat experience, including support for the latest gpt-3.5-turbo model as of March 3.
Features
Nonebot-plugin-gpt3 comes packed with several features that enhance user interaction:
- Contextual Conversations: The plugin supports context-based discussion, allowing seamless transitions in conversation.
- Continuous Dialogue: Users can enjoy uninterrupted conversations, easily toggling between different chat sessions.
- Personality Settings: Alter the AI's personality according to preset options, or customize it to fit specific needs.
- Group Chat Switching: Effortlessly switch conversations between group chats, retaining all previous chat information.
- Image Rendering of Responses: Transform textual responses into visual formats for a varied user experience.
How to Use Nonebot-plugin-gpt3
Engaging with the plugin can be done through simple commands, either in private messages or by replying in group chats. Here’s a breakdown of the available functionality:
- Basic Chat: Initiate dialogues using default prefixes.
- Continuous Chat: Use commands like
chat
or开始聊天
to start a session without prefixes, and end it withstop
or结束聊天
. - Switch Conversations: Swap between group chats using the switch command.
- Manage Conversation Records: Refresh or reset dialogue history when needed.
- Modify AI Personality: Reset or configure the AI's persona to fit different scenarios.
- Export Chat Histories: Back up past conversations with ease.
- Enable Image Rendering: Choose to render answers as images through configuration.
Installation Guide
Installing Nonebot-plugin-gpt3 is straightforward:
-
Use Nonebot’s CLI:
nb plugin install nonebot-plugin-gpt3
-
Direct Package Manager Installation: Install with tools like pip:
pip install nonebot-plugin-gpt3 -U
Load the plugin within your bot’s setup by adding:
nonebot.load_plugin('nonebot_plugin_gpt3')
Configuration
The basic setup involves configuring your OpenAI API keys. Add the following to your configuration file:
openai_api_key = "your_api_key"
Alternatively, set this through an environment variable in your terminal before launching the bot:
export openai_api_key="your_api_key"
For advanced customization, modify these additional settings in the configuration:
- Command Prefix: Define a prefix for commands.
- Default Personality: Set standard dialogue personas.
- Proxy Settings: Configure network proxies if necessary.
- Trigger Requirements: Decide if the bot needs an
@
to respond. - Image Rendering Preferences: Enable or disable conversion to image formats and specify performance limits.
To enable image rendering, set gpt3_image_render = True
and ensure playwright
is installed:
pip3 install playwright && playwright install
Final Thoughts
With Nonebot-plugin-gpt3, users can access an intuitive, AI-driven chat experience. Whether for casual use or industry-specific applications, the plugin provides configurable and easy-to-use options to customize the AI's interactions, making it a versatile tool in any chat environment.