Character.AI Smart Auto-Continue

Automatically detects when a Character.ai bot message cuts off mid-sentence and prompts it to continue.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Character.AI Smart Auto-Continue
// @namespace    http://tampermonkey.net
// @version      1.0
// @description  Automatically detects when a Character.ai bot message cuts off mid-sentence and prompts it to continue.
// @author       YourName
// @license      MIT
// @match        https://character.ai*
// @match        https://*.character.ai/*
// @icon         https://google.com
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // Function to check the text and trigger continuation
    function checkAndContinue() {
        // Find all bot message text elements on the screen
        const messages = document.querySelectorAll('.message-text, [data-testid="chat-message-text"]');
        if (messages.length === 0) return;

        // Get the very last message sent by the bot
        const lastMessage = messages[messages.length - 1];
        const text = lastMessage.innerText.trim();

        // Check if the text ends abruptly (not ending with ., !, ?, ", or »)
        const endsAbruptly = /[^.!??"»]$/.test(text);

        if (endsAbruptly && !lastMessage.dataset.autoContinued) {
            // Mark it so we don't loop infinitely on the same message
            lastMessage.dataset.autoContinued = "true";

            // Find Character.ai's chat input textarea
            const textarea = document.querySelector('textarea');
            
            if (textarea) {
                textarea.focus();
                textarea.value = '(continue)';
                
                // Trigger input event for the website's framework
                const event = new Event('input', { bubbles: true });
                textarea.dispatchEvent(event);
                
                // Click the send button after a tiny delay
                setTimeout(() => {
                    const sendButton = document.querySelector('button[type="submit"]') || 
                                       textarea.parentElement.querySelector('button');
                    if (sendButton) {
                        sendButton.click();
                    }
                }, 300);
            }
        }
    }

    // Run the check every 3 seconds to see if a new cut-off message arrived
    setInterval(checkAndContinue, 3000);
})();