├── manifest.json ├── README.md ├── style.css ├── rewrite_settings.html └── index.js /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "display_name": "Rewrite Extension", 3 | "loading_order": 39, 4 | "requires": [], 5 | "optional": [], 6 | "js": "index.js", 7 | "css": "style.css", 8 | "author": "SplitClover", 9 | "version": "1.3.0", 10 | "homePage": "" 11 | } 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rewrite Extension for SillyTavern 2 | 3 | > [!IMPORTANT] 4 | > **2025.09.02** - This is extension is no longer maintained for the foreseeable future. 5 | 6 | ## Overview 7 | 8 | The Rewrite Extension enhances the chat experience in SillyTavern by allowing users to dynamically rewrite, shorten, or expand selected text within messages. Works for chat completion, text completion and NovelAI. 9 | 10 | ## Features 11 | 12 | - Custom {{rewrite}} macro that contains the selected text 13 | - Custom {{targetmessage}} macro that contains the full targeted message 14 | - Custom {{rewritecount}} macro that returns a numeric (39) count of words selected 15 | - Rewrite, shorten, or expand selected text in chat messages, with an added delete button 16 | - Convenient undo button 17 | - Real-time streaming of rewritten text 18 | - Temporary highlighting of modified text for easy identification 19 | - Ability to abort ongoing rewrites 20 | 21 | ## Installation 22 | 23 | Use SillyTavern's built-in extension installer: 24 | `https://github.com/splitclover/rewrite-extension` 25 | 26 | ## Usage 27 | 28 | To use the Rewrite Extension: 29 | 30 | 1. Configure the extension (see below) 31 | 2. Select text within a single(!) chat message 32 | 3. A context menu will appear with options to Rewrite, Shorten, or Expand 33 | 4. Choose the desired option 34 | 5. The selected text will be replaced with the AI-generated modification 35 | 36 | ## Configuration 37 | 38 | 1. Open the Extension tab -> Rewrite Extension 39 | 2. Set presets for Rewrite, Shorten, and Expand operations 40 | 3. Adjust the highlight duration for modified text 41 | 42 | ## Contributing 43 | 44 | Contributions to improve the Rewrite Extension are welcome. Please fork the repository and submit a pull request with your changes. -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | @keyframes vibrantWavyBackground { 2 | 0% { 3 | background-position: 0% 50%; 4 | box-shadow: 0 0 10px rgba(26, 35, 126, 0.7); 5 | } 6 | 25% { 7 | background-position: 50% 100%; 8 | box-shadow: 0 0 15px rgba(74, 20, 140, 0.7); 9 | } 10 | 50% { 11 | background-position: 100% 50%; 12 | box-shadow: 0 0 20px rgba(26, 35, 126, 0.7); 13 | } 14 | 75% { 15 | background-position: 50% 0%; 16 | box-shadow: 0 0 15px rgba(74, 20, 140, 0.7); 17 | } 18 | 100% { 19 | background-position: 0% 50%; 20 | box-shadow: 0 0 10px rgba(26, 35, 126, 0.7); 21 | } 22 | } 23 | 24 | .animated-highlight { 25 | background: linear-gradient(45deg, #1a237e, #4a148c, #7b1fa2, #4a148c, #1a237e); 26 | background-size: 300% 300%; 27 | animation: vibrantWavyBackground 6s ease infinite; 28 | border-radius: 8px; 29 | padding: 2px 6px; 30 | color: white; 31 | display: inline-block; 32 | box-decoration-break: clone; 33 | -webkit-box-decoration-break: clone; 34 | transition: all 0.3s ease; 35 | } 36 | 37 | .rewrite-extension_block textarea.text_pole { 38 | width: 100%; 39 | min-height: 60px; 40 | resize: vertical; 41 | padding: 5px; 42 | box-sizing: border-box; 43 | } 44 | 45 | .rewrite-extension-settings .flex-container { 46 | display: flex; 47 | align-items: center; 48 | margin-bottom: 10px; 49 | position: relative; 50 | } 51 | 52 | .rewrite-extension-settings label { 53 | flex-grow: 1; 54 | margin-right: 10px; 55 | } 56 | 57 | .rewrite-extension-settings .tooltip-icon { 58 | font-size: var(--mainFontSize); 59 | color: var(--SmartThemeBodyColor); 60 | cursor: pointer; 61 | margin-right: 10px; 62 | } 63 | 64 | .rewrite-extension-settings .tooltip-icon:hover::after { 65 | content: attr(data-tooltip); 66 | position: absolute; 67 | right: 30px; /* Adjust this value as needed */ 68 | top: 50%; 69 | transform: translateY(-50%); 70 | background-color: var(--SmartThemeBlurTintColor); 71 | color: var(--SmartThemeBodyColor); 72 | padding: 8px 12px; 73 | border-radius: 5px; 74 | font-size: calc(var(--mainFontSize) * 0.9); 75 | font-weight: normal; 76 | font-family: var(--mainFontFamily); 77 | white-space: normal; 78 | max-width: 250px; 79 | z-index: 1000; 80 | text-shadow: 0px 0px calc(var(--shadowWidth) * 1px) var(--SmartThemeShadowColor); 81 | border: 1px solid var(--SmartThemeBorderColor); 82 | box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); 83 | } 84 | 85 | .rewrite-extension-settings .inline-drawer-content > div { 86 | margin-bottom: 15px; 87 | } 88 | 89 | .rewrite-extension-settings .checkbox-container { 90 | justify-content: space-between; 91 | } 92 | 93 | .rewrite-extension-settings .checkbox-label-group { 94 | display: flex; 95 | align-items: center; 96 | } 97 | 98 | .rewrite-extension-settings .checkbox-label-group label { 99 | margin-left: 5px; 100 | order: 1; 101 | } 102 | 103 | .rewrite-extension-settings .checkbox-label-group input[type="checkbox"] { 104 | order: 0; 105 | margin-right: 0; 106 | } 107 | 108 | .rewrite-extension-settings .checkbox-container .tooltip-icon { 109 | margin-left: 10px; 110 | } 111 | 112 | .rewrite-extension-settings .checkbox-container .tooltip-icon:hover::after { 113 | right: 25px; 114 | } 115 | 116 | .rewrite-extension_block .flex-container > div { 117 | display: flex; 118 | align-items: center; 119 | justify-content: space-between; 120 | } 121 | 122 | .rewrite-extension_block .flex-container > div .tooltip-icon { 123 | margin-left: 5px; 124 | } 125 | 126 | .rewrite-extension-settings .inline-drawer { 127 | width: 100%; 128 | } 129 | 130 | .rewrite-extension-settings .inline-drawer-content { 131 | width: 100%; 132 | } 133 | 134 | .rewrite-extension-settings .inline-drawer-toggle { 135 | width: 100%; 136 | display: flex; 137 | justify-content: space-between; 138 | align-items: center; 139 | cursor: pointer; 140 | padding: 5px 0; 141 | } 142 | 143 | .rewrite-extension-settings .inline-drawer-content .checkbox-container { 144 | display: flex; 145 | justify-content: flex-start; 146 | align-items: center; 147 | margin-bottom: 5px; 148 | } 149 | 150 | .rewrite-extension-settings .inline-drawer-content .checkbox-container input[type="checkbox"] { 151 | margin-right: 5px; 152 | } 153 | 154 | .rewrite-extension-settings .inline-drawer-content .checkbox-container label { 155 | margin-right: 0; 156 | } 157 | 158 | /* Ensure the tooltip doesn't go off-screen on smaller screens */ 159 | @media (max-width: 768px) { 160 | .rewrite-extension-settings .tooltip-icon:hover::after { 161 | right: 0; 162 | left: 50%; 163 | transform: translateX(-50%); 164 | top: 100%; 165 | margin-top: 5px; 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /rewrite_settings.html: -------------------------------------------------------------------------------- 1 |