AI Integration
Enhance your reading experience with AI assistant
Rodel Reader's book reader integrates AI conversation features to help you understand book content, translate text, and answer questions.
Supported AI Services
| Service Type | Description |
|---|---|
| OpenAI | OpenAI official and all compatible API services |
| Claude | Anthropic Claude API and compatible services |
| Gemini | Google AI Studio or Vertex AI |
| Azure OpenAI | Microsoft Azure OpenAI enterprise service |
Compatibility Note
OpenAI and Claude types support third-party services with compatible APIs (like DashScope, OpenRouter, etc.), just configure the corresponding Base URL.
Configuring AI Services
Adding a Provider
- Open app Settings
- Go to AI Configuration page
- Click Add Provider
- Select service type and fill in configuration
Configuration Fields
| Field | Description |
|---|---|
| Name | Custom name for easy identification |
| Service Type | OpenAI / Claude / Gemini / Azure OpenAI |
| Base URL | API endpoint address |
| API Key | Key provided by service provider |
Base URL Examples
| Service | Base URL |
|---|---|
| OpenAI Official | https://api.openai.com/v1 |
| Claude Official | https://api.anthropic.com/v1 |
| Gemini Official | https://generativelanguage.googleapis.com/v1beta |
| Azure OpenAI | https://{resource-name}.openai.azure.com |
| DashScope | https://dashscope.aliyuncs.com/compatible-mode/v1 |
| OpenRouter | https://openrouter.ai/api/v1 |
Security Note
API keys are encrypted using Windows Credential Manager, but avoid saving sensitive keys on public devices.
Managing Models
Each provider can have multiple models configured:
- Preset Models: Common models are pre-configured
- Custom Models: Manually add model IDs supported by the provider
AI Chat Panel
In the book reader, click the AI tab in the sidebar to open the chat panel.
Interface Components
| Area | Function |
|---|---|
| Model Selector | Switch current AI model |
| Mode Selector | Select conversation mode (system prompt) |
| Message List | Display conversation history |
| Input Box | Enter questions or instructions |
| Session Management | Create, switch, delete sessions |
Conversation Modes
Conversation modes define AI behavior through system prompts:
| Mode | Description |
|---|---|
| Default | General assistant mode |
| Reading Assistant | Focused on helping understand book content |
| Translation | Translate selected text |
| Custom | User-defined modes |
You can create custom modes with your own system prompts.
AI Tool Calling
The AI assistant can execute specific operations to assist reading, called "tools".
Available Tools
| Tool | Function | Description |
|---|---|---|
| Get TOC | Read book table of contents | AI understands book structure |
| Get Current Chapter | Read current chapter content | AI knows what you're reading |
| Get Specific Chapter | Read specific chapter | Get content by chapter ID |
| Get Selected Text | Read highlighted content | AI knows your selected text |
| Jump to Chapter | Navigate to specified chapter | AI helps you navigate |
| Jump to Position | Navigate to specified position | Precise positioning |
| Search Book | Full-text search | Supports regular expressions |
Tool Execution Flow
- User asks a question
- AI determines if tool calling is needed
- AI requests tool execution (confirmation dialog appears)
- User approves or denies
- Tool executes and returns results
- AI generates answer based on results
User Control
All tool calls require your approval before execution. You can choose to allow or deny in the confirmation dialog.
Tool Usage Examples
Example 1: Asking about book content
User: What is this book about?
AI: [Calls Get TOC]
AI: Based on the table of contents, this book mainly covers the following chapters...Example 2: Finding content
User: Help me find chapters about "artificial intelligence"
AI: [Calls Search Book, keyword: artificial intelligence]
AI: I found relevant content in the following locations...Example 3: Explaining selected content
User: [Selects a passage] Explain this paragraph
AI: [Calls Get Selected Text]
AI: This paragraph means...AI Commands
AI Commands are a feature for quickly executing predefined prompts, ideal for frequently used scenarios like explaining vocabulary or summarizing paragraphs.
What are AI Commands?
Unlike AI chat, AI Commands are designed for quick one-time responses without maintaining conversation context. You can predefine prompt templates and execute them with one click after selecting text to get instant results.
How to Use
- Select text in the book
- Click the ⚡ button in the selection menu
- Choose a command from the popup list
- Wait for AI response
The response displays in a floating panel with Markdown support. You can copy the response or regenerate it.
Managing Commands
Click the AI tab in the sidebar, then switch to the Commands panel:
| Operation | Method |
|---|---|
| Add Command | Click + button at top |
| Edit Command | Click edit button on command card |
| Delete Command | Click delete button on command card |
| Reorder | Drag command cards |
Template Variables
Command prompts support the following variables, which are automatically replaced with actual content during execution:
| Variable | Description | Example |
|---|---|---|
{SELTEXT} | Currently selected text | User's highlighted content |
{SELPARA} | Paragraph containing the selection | Complete paragraph with selected content |
{CHAPTER} | Full text of current chapter | Content of the chapter being read |
Command Examples
Explain Vocabulary
Please explain the meaning of the following word and provide example sentences:
{SELTEXT}Translate Paragraph
Please translate the following paragraph to English:
{SELPARA}Summarize Chapter
Please summarize the key points of the following content in 3-5 sentences:
{CHAPTER}Model Selection
At the top of the Commands panel, there's a model selector for choosing a dedicated model for AI Commands. This is independent of the model used for AI chat.
If no model is manually selected, the first available model will be used automatically.
Session Management
AI chat supports multiple sessions, with multiple independent conversations per book.
Session Features
| Feature | Description |
|---|---|
| Book-bound | Each session is tied to a specific book |
| History Saved | Conversation records are persistently stored |
| Independent Context | Different sessions don't affect each other |
| Resumable | Continue conversation next time you open the book |
Session Operations
| Operation | Method |
|---|---|
| New Session | Click + button in session list |
| Switch Session | Click item in session list |
| Delete Session | Click delete button at end of history entry |
FAQ
AI features not working?
- Check if AI provider is configured
- Confirm API Key is correct
- Check network connection
- Try using a different model
Response is slow?
AI response speed depends on:
- Network latency
- Model type (larger models are slower)
- API service load
Suggestions:
- Use a smaller model
- Choose a faster provider
- Check network connection quality
Tool call failed?
- Make sure you clicked Allow in the confirmation dialog
- Some tools may fail due to unsupported book formats
- Check error message for specific reason
How to use Chinese AI services?
Configuration steps:
- Select OpenAI type (compatible API)
- Enter provider's Base URL
- Enter corresponding API Key
- Add model IDs supported by the provider
Supported Chinese services include: Alibaba Cloud DashScope, Zhipu AI, and other services supporting OpenAI-compatible format.
Where is session data saved?
Session data is saved in the database file in the library directory. When migrating the library, all AI session records are migrated together.