WTR LAB Novel Image Generator

A powerful userscript to enhance web novel reading on WTR-LAB.COM. Select text to generate AI-powered images using multiple providers (Pollinations, AI Horde, Google Imagen, OpenAI). Features Gemini-enhanced prompts, 100+ art styles, a modern UI, history, and robust configuration options. Built with Webpack for modularity and maintainability.

这些是此脚本变更过代码的版本。 显示所有版本。

  • v6.0.5 2025-11-10 Imported from URL
  • v5.7 2025-11-03

    [5.7.0] - 2025-11-03

    🚀 Added

    • AI-powered image enhancement using Google's advanced AI technology
    • Test-before-generate feature for prompt enhancement preview
    • Enhanced timeout protection and error handling
    • Local log storage with management interface

    🔄 Changed

    • Automatic selection of best enhancement method for each provider
    • Customizable prompt improvement options
    • Improved mobile experience with responsive design
    • Enhanced status indicators with visual feedback
    • More descriptive messages throughout the process

    🐛 Fixed

    • Improved error handling with clear recovery options
    • Enhanced validation with helpful feedback
    • Smart fallback to original prompts when enhancement fails

    🔒 Security

    • Enhanced protection for API keys
    • Improved validation of all connections
  • v5.6 2025-11-02

    Version 5.6 (2025-11-02)

    🐛 UI Fixes

    • Fixed Image Actions Container: Updated download button to use consistent Material Symbols icon (download) instead of emoji (💾) for better visual consistency
    • Fixed Image Actions Visibility: Changed image action buttons from white background with white icons to dark background (rgba(0, 0, 0, 0.8)) with white icons for improved visibility and contrast
    • Fixed Icon-to-Text Alignment: Added proper flexbox alignment properties to utility buttons using display: inline-flex, align-items: center, justify-content: center, and gap: var(--nig-space-sm) for better visual alignment

    🎨 UI Improvements

    • Enhanced Button Visibility: Improved visibility of image action container buttons (Download and Fullscreen) with dark background overlay
    • Better Utility Button Layout: Standardized alignment for utility buttons including Clean button, Download Configuration, Clear Cached Models, and Toggle Console Logging
  • v5.5 2025-11-01

    Version 5.5 (2025-11-01)

    ✨ Major Styling Overhaul

    • Modern CSS Foundation: Complete rewrite of the styling system with CSS custom properties, design tokens, and enhanced dark theme support for a professional appearance
    • Utilities Tab Redesign: Transformed from chaotic "random" layout to organized card-based system with improved visual hierarchy and clear section divisions
    • Panel Configuration Overhaul: New grid-based layout with enhanced tab navigation, better form controls, and improved visual structure for all configuration panels
    • Mobile-First Responsive Design: Multi-breakpoint responsive design optimized for both mobile and desktop experiences with touch-friendly interface elements

    🎨 UI/UX Improvements

    • Modern Interactive Elements: Enhanced button styling with better hover states, improved form controls with consistent sizing, and professional loading state animations
    • Enhanced Visual Hierarchy: Improved spacing, typography, and layout organization throughout the interface for better readability and user experience
    • Material Symbols Integration: Modern iconography using Google Material Symbols for a contemporary and consistent visual language
    • Improved Color Scheme: Modernized color palette with enhanced contrast ratios and improved accessibility compliance

    📱 Mobile Enhancements

    • Touch-Optimized Interface: Redesigned all interactive elements for optimal touch interaction with proper sizing and spacing
    • Mobile-Responsive Layout: Multi-breakpoint design system that seamlessly adapts from mobile phones to desktop displays
    • Enhanced Mobile Navigation: Improved tab switching and panel navigation specifically optimized for mobile users
    • Mobile-Specific Optimizations: Better button positioning, touch targets, and mobile-specific interface improvements

    ⚡ Performance Improvements

    • CSS Architecture Optimization: Modern CSS custom properties system for better performance and easier maintenance
    • Enhanced Rendering Performance: Optimized CSS injection and rendering pipeline for smoother user interactions
    • Memory Efficiency: Improved resource management and reduced memory footprint through optimized styling approach
    • Faster Load Times: Streamlined CSS delivery and optimized stylesheet structure for quicker initial rendering

    🔧 Technical Improvements

    • CSS Custom Properties System: Implementation of modern CSS variables and design tokens for consistent theming and easier customization
    • Responsive Grid Layout: Complete overhaul to CSS Grid and Flexbox for modern, flexible layouts across all screen sizes
    • Enhanced Accessibility: Improved ARIA support, better focus management, and enhanced keyboard navigation throughout the interface
    • Modern CSS Architecture: Clean, maintainable CSS structure following modern best practices and design patterns

    📖 Documentation Updates

    • Enhanced GreasyFork Documentation: User-friendly documentation with emojis, improved formatting, and better visual presentation
    • Better Troubleshooting Sections: Expanded help content with visual examples and clearer troubleshooting guidance
    • Improved Readability: Better structured documentation with clear sections and enhanced visual organization
    • User Experience Guides: Added helpful guides for understanding the new interface and maximizing the enhanced features

    Version 5.4 (2025-11-01)

    Features

    • Import/Export: Updated settings import/export functionality to use JSON files instead of copy/paste, improving reliability and user experience.
    • OpenAI Compatible Provider: Implemented model caching for the OpenAI Compatible Provider, allowing model lists to load instantly after the first fetch.
    • AI Horde: Added configuration (shared: true) to improve image generation speed.

    Improvements

    • Maintenance Commands: Standardized the layout of maintenance commands in the "Utilities" tab.
    • Clear Cached Models: Verified and fixed clear cache models to work correctly for all providers (Pollinations, AI Horde, OpenAI Compatible).
    • UI: Repositioned the "Save Configuration" button to the bottom and centered it for better accessibility.

    Fixes

    • Fixed a critical error with the handleImportFile function.

    Version 5.3 (2025-11-01)

    Features

    • Settings Panel Refactor: Moved "Clear Cached Models" and "Toggle Logging" from the Tampermonkey menu to a new "Utilities" tab in the settings panel. The Tampermonkey menu now only contains "Image Generator Settings".
    • Settings Import/Export: Added Settings Import/Export functionality to the "Utilities" tab.
    • Standardized Negative Prompting: Negative prompt configuration is now global, located in the "Prompt Styling" tab, and is applied to all providers (either appended to the main prompt or passed in a dedicated field for AI Horde).

    Fixes

    • The settings panel no longer automatically closes after saving configuration.
    • The AI Horde API Key field is now hidden (input type changed to password) for security.
  • v5.2 2025-10-30

    Changelog

    • v5.2
      • 🐛 Fixed a layout issue where long error messages could stretch the failure notification box, making it hard to read.
      • ✨ Improved the error-handling screen. The 'Retry' button will now correctly appear when you select a different provider, not just when you edit the prompt.
  • v5.1 2025-10-28

    Changelog

    • v5.1
      • ✨ Fixed an issue where viewing generated images from the history tab would fail on browsers like Chrome and Opera. Now, all images from your history can be viewed reliably, with base64 images opening in the convenient in-page viewer for a consistent experience across all browsers.
  • v5.0 2025-10-27

    Changelog

    • v5.0
      • Feature: Added a history cleanup tool in the "History" tab to delete entries older than a specified number of days (1-365).
      • Feature: Implemented a "Custom Style" option in the "Prompt Styling" tab, allowing users to define their own prompt prefixes.
      • Feature: Added a "None" option to sub-style dropdowns to use a generic prefix based on the main style.
      • Feature: Enhanced the "Failed Generation Modal" with a provider dropdown, allowing users to retry a failed prompt with a different provider.
      • Fix: Updated the Google Imagen provider label to "Requires Billed Account" for better accuracy.
      • Fix: Corrected the fullscreen icon in the image viewer by properly implementing Google Material Symbols.
  • v4.9 2025-10-27

    Changelog

    • v4.9
      • Feature: Implemented a profile management system for the OpenAI Compatible provider. Users can now save, load, and delete multiple configurations (Base URL, API Key, Model) for seamless switching.
      • Feature: Enhanced the History tab to display the specific provider and model used for each past generation, providing better context.
      • Fix: Expanded model fetching compatibility for OpenAI providers to support a new JSON format (used by services like MNN AI), making the script more versatile.
      • Fix: Improved the "free model" detection logic to recognize more patterns across different APIs.
    • v4.8
      • Feature: Added a flexible model input system for the OpenAI Compatible provider, allowing users to either select a model from a fetched list or switch to a manual text input if fetching fails or the desired model is not listed.
      • Feature: Included a direct link to the cool-ai-stuff GitHub repository in the settings to help users find free public API providers.
      • Fix: The script now automatically switches to manual model input if the model fetching process fails, providing a seamless fallback.
      • Fix: Configuration saving now correctly stores the user's preferred input method (fetched list vs. manual input) for the OpenAI provider.
  • v4.7 2025-10-27

    Changelog

    • v4.7:
      • Fix: Resolved a critical bug in the "OpenAI Compatible" provider where API error responses were not handled correctly, causing the script to crash. The error handling is now more robust and will display the actual error message from the provider.
      • Enhancement: The "OpenAI Compatible" provider can now process successful responses that contain either a direct url or b64_json data, increasing compatibility with more API services.
    • v4.6:
      • Fix: Corrected a bug in the "OpenAI Compatible" provider's model fetching logic. The script now correctly filters for image models by looking for the /v1/images/generations endpoint path, resolving an issue where no models would appear for certain providers.
    • v4.5:
      • Enhancement: Made the "OpenAI Compatible" provider significantly more flexible and user-friendly by replacing specific @connect permissions with @connect *. This allows users to connect to any provider URL without needing to manually edit the script.
      • Enhancement: Improved model detection to support multiple API response formats (e.g., checking for both endpoint string and endpoints array).
      • Enhancement: Generalized "free model" detection to correctly identify and sort free models from different providers by checking for both is_free: true and premium_model: false.
    • v4.4:
      • Feature: Added a new "OpenAI Compatible" provider, allowing users to connect to any custom API that follows the OpenAI standard for image generation.
      • Feature: Implemented a new UI section in the configuration panel for the OpenAI Compatible provider, including fields for Base URL, API Key, and a "Fetch Models" button.
      • Enhancement: Added logic to dynamically fetch, filter, and display image-generation models from the user-provided endpoint.
      • Enhancement: Implemented sorting for the fetched model list to prioritize free models, displaying them at the top.
  • v4.3 2025-10-26

    Changelog

    Version 4.3

    • Feature: The prompt field in the 'Generation Failed' modal is now an editable textarea, allowing for quick corrections.
    • Feature: Implemented a conditional 'Retry' button for non-retryable errors (e.g., safety violations). The button now appears only after the user starts editing the failed prompt.
    • Improvement: The retry functionality now uses the new, edited prompt from the modal for the subsequent attempt, enabling users to fix and resubmit prompts without starting over.

    Version 4.2

    • Fix: Enhanced the smart retry system to correctly identify and allow retries for temporary server-side issues, such as 502 Bad Gateway errors.
  • v4.1 2025-10-25

    Changelog

    [4.1] - The Creative Control Update

    • New: Comprehensive Two-Tiered Prompt Styling System. The "Prompt Styling" tab has been completely overhauled.
      • Users can now select a Main Style (e.g., Anime, Fantasy, Sci-Fi) from 10 high-level categories.
      • Based on the main style, a Sub-Style dropdown is populated with over 10 specific options, totaling over 100 detailed styles.
      • Dynamic descriptions appear for both main and sub-styles to guide the user's choice.
    • Improved: Smarter Style Saving. The script now saves the specific sub-style value and correctly re-selects both the main and sub-style dropdowns when the configuration panel is reopened.

    [4.0] - The Reliability Update

    • New: Conditional Retry Button. An intelligent "Retry" button now appears in the failure modal, but only for retry-able errors like server timeouts (e.g., Error 524). It is hidden for content policy violations, preventing pointless re-attempts.
    • New: Error Modal Queue. If multiple generations fail in quick succession, the error modals are now queued. The next error will only be displayed after the user closes the current one, preventing overlapping pop-ups.

    [3.9] - The Clarity Update

    • New: User-Friendly Error Modal. Replaced silent console errors with a clear, user-facing pop-up modal on generation failure.
      • The modal displays a parsed, easy-to-understand reason for the failure.
      • It also shows the full prompt that was sent, helping users identify and correct problematic text selections (e.g., for unsafe content).
    • Fixed: Generation failures are no longer silent, providing crucial feedback to non-technical users.
  • v3.8 2025-10-21

    Changelog

    Version 3.8 - Prompt Styling & Mobile UI Overhaul

    • New Feature: Prompt Styling Tab:
      • Added a new "Prompt Styling" tab to the configuration panel, located between "Configuration" and "History".
      • Allows you to select a default art style (e.g., Anime, Cyberpunk, Papercraft) from a dropdown menu.
      • The selected style is automatically added to the beginning of every prompt, ensuring a consistent look for your images across all providers.
    • UI Improvement: Mobile Button Fix:
      • The "🎨 Generate Image" button on mobile views (or narrow browser windows) is now fixed to the bottom-center of the screen.
      • This provides easy, one-handed access and prevents the button from being cut off by the edge of the screen. The desktop behavior remains unchanged.
    • UX Improvement: The "Save Configuration" button is now accessible from both the Configuration and the new Prompt Styling tabs for convenience.
  • v3.7 2025-10-21

    Changelog

    v3.7

    • Fix: Corrected the "Generate Image" button alignment to precisely match the start of the selected text, even on multi-line selections.
    • Feature: Added automatic text deselection after clicking "Generate Image" for a smoother workflow.

    v3.6

    • Feature: Added a "Toggle Logging" command to the Tampermonkey menu, allowing users to enable/disable console logging (disabled by default).
    • Update: Changed Pollinations.ai default settings to the flux model for speed, 512x512 resolution, and enabled "Enhance Prompt" by default. The UI now highlights gptimage as the recommended model for quality.
    • Update: Changed AI Horde default settings to AlbedoBase XL (SDXL) model, k_dpmpp_2m sampler, 25 steps, 512x512 resolution, and a CFG scale of 7 for better out-of-the-box results.
    • Fix: Improved the "Generate Image" button positioning to appear above the selected text, preventing it from being obscured by the native text selection UI on mobile browsers.
  • v3.5 2025-10-21

    Changelog

    Version 3.5 (Latest)

    • Feature: Model List Caching System.
      • Instant Loading: The configuration panel now loads model lists for Pollinations.ai and AI Horde instantly after the first run, eliminating the "fetching models..." delay.
      • Reduced API Calls: The script is now faster, more reliable, and less demanding on the provider APIs by caching the model lists in your browser's storage.
      • Automatic Cache Refresh: If you try to generate an image and the API returns an error that the model doesn't exist, the script will automatically clear the cache for that specific provider. The next time you open the settings, it will fetch a fresh list.
      • Manual Cache Refresh: Added a new Tampermonkey menu command, "Clear Cached Models," allowing you to manually force a refresh of all model lists at any time.

    Version 3.4

    • Fix: Pollinations.ai Model Fetching.
      • Resolved a critical bug where the Pollinations.ai model list would fail to load, causing a JSON.parse error. This was due to a server-side change requiring a User-Agent header.
      • The fix has been applied to both the model fetching and image generation functions to ensure stable communication with the Pollinations.ai service.
  • v3.3 2025-10-21

    Changelog

    Version 3.3

    • Pollinations.ai Authentication Fix: The script now correctly handles 403 Forbidden errors that occur when a selected model requires authentication.
    • New Authentication Prompt: When an authentication error is detected, a new pop-up will appear, explaining the issue and providing a direct link to auth.pollinations.ai.
    • API Token Support: Added an optional API Token field for Pollinations.ai in the main settings panel and the new authentication prompt. Using a token grants access to restricted models and higher rate limits.
    • Save & Retry Functionality: The new authentication prompt includes a "Save Token & Retry" button, which automatically re-attempts the failed image generation after a token is provided.
  • v3.2 2025-10-21

    Changelog (v3.2)

    • New Provider: Pollinations.ai - Added Pollinations.ai as a new, free, and easy-to-use image generation provider. It is now the default option for new users due to its simplicity and speed.
    • ⚙️ Pollinations Configuration - A new settings section has been added to the configuration panel, allowing you to:
      • Select from a list of models fetched directly from the Pollinations API.
      • Customize image dimensions (width/height) and set a seed for reproducibility.
      • Toggle options like prompt enhancement, NSFW safety filters, and privacy settings.
    • 🔧 Technical Integration - The script's core logic has been updated to seamlessly handle the Pollinations API, including its direct image response and URL structure for persistent history logging.
    • 📜 Minor Updates - Updated the script's version, description, and added the necessary @connect directive for image.pollinations.ai.
  • v3.1 2025-10-20

    Changelog

    Version 3.1

    • Added: A persistent results queue. Completed images are now stored until they are viewed, ensuring no result is ever missed.
    • Added: The "Image Ready!" notification now displays a count of how many images are waiting to be viewed (e.g., "3 Images Ready!").
    • Changed: The "Image Ready!" notification is now the highest priority. It will remain visible even while other images are being generated in the background.
    • Changed: Clicking the notification now shows the oldest unseen image first (First-In, First-Out). After viewing, the notification will update for the next image in the results queue.
    • Fixed: An issue where the "Image Ready!" message would disappear if the user queued another image, potentially causing them to miss the completed result.

    Version 3.0

    • Added: A generation queue system. Users can now select and generate multiple images sequentially without waiting for the previous one to finish.
    • Added: A non-intrusive status widget in the bottom-left corner to display generation progress and queue status.
    • Changed: Replaced the disruptive full-screen loading overlay with the new status widget, allowing users to continue reading while images generate.
  • v2.9 2025-10-20

    Changelog

    Version 2.9 (Latest)

    • Fixed: Corrected the AI Horde model selector to perfectly match and group the top 10 popular models using their exact API names, ensuring the feature works as intended.
    • Improved: Changed the default AI Horde model to Deliberate for better out-of-the-box results for new users.

    Version 2.8

    • Feature: Enhanced the AI Horde model selector to group the top 10 most popular models with descriptions of their style focus (e.g., realism, anime). This makes it much easier for users to choose the best model for their needs.
    • Improved: All other models are now listed in a separate "Other Models" group, sorted by the number of active workers.

    Version 2.7

    • Fixed: Resolved a critical bug that caused the configuration tab's content to disappear and the history tab to fail to load when switching between them. The panel is now stable and reliable.

    Version 2.6

    • Fixed: Reworked the configuration panel logic to correctly load content every time a tab is clicked, fully resolving issues with disappearing settings and an empty history list.
    • Feature: Added descriptive hints for AI Horde's "Steps," "CFG Scale," and "Post-Processing" options to clarify their function for users.

    Version 2.5

    • Feature: Implemented a collapsible prompt in the image viewer. The prompt is now hidden by default to provide a cleaner view of the images and can be expanded with a single click.
    • Fixed: Addressed an issue where the configuration panel content would disappear after navigating to the history tab and back.
  • v2.5 2025-10-20
  • v2.4 2025-10-20
  • v1.1 2025-10-19