mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Always add reasoning for continue
This commit is contained in:
		| @@ -3863,10 +3863,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||||
|  | ||||
|     const reasoning = new PromptReasoning(); | ||||
|     for (let i = coreChat.length - 1; i >= 0; i--) { | ||||
|         if (reasoning.isLimitReached()) { | ||||
|             break; | ||||
|         } | ||||
|         const depth = coreChat.length - i - 1; | ||||
|         const isPrefix = isContinue && i === coreChat.length - 1; | ||||
|         coreChat[i] = { | ||||
|             ...coreChat[i], | ||||
|             mes: reasoning.addToMessage( | ||||
| @@ -3876,8 +3874,12 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||||
|                     regex_placement.REASONING, | ||||
|                     { isPrompt: true, depth: depth }, | ||||
|                 ), | ||||
|                 isPrefix, | ||||
|             ), | ||||
|         }; | ||||
|         if (reasoning.isLimitReached()) { | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // Determine token limit | ||||
|   | ||||
| @@ -50,11 +50,12 @@ export class PromptReasoning { | ||||
|      * Add reasoning to a message according to the power user settings. | ||||
|      * @param {string} content Message content | ||||
|      * @param {string} reasoning Message reasoning | ||||
|      * @param {boolean} isPrefix Whether this is the last message prefix | ||||
|      * @returns {string} Message content with reasoning | ||||
|      */ | ||||
|     addToMessage(content, reasoning) { | ||||
|     addToMessage(content, reasoning, isPrefix) { | ||||
|         // Disabled or reached limit of additions | ||||
|         if (!power_user.reasoning.add_to_prompts || this.counter >= power_user.reasoning.max_additions) { | ||||
|         if (!isPrefix && (!power_user.reasoning.add_to_prompts || this.counter >= power_user.reasoning.max_additions)) { | ||||
|             return content; | ||||
|         } | ||||
|  | ||||
| @@ -71,6 +72,11 @@ export class PromptReasoning { | ||||
|         const separator = substituteParams(power_user.reasoning.separator || ''); | ||||
|         const suffix = substituteParams(power_user.reasoning.suffix || ''); | ||||
|  | ||||
|         // Combine parts with reasoning only | ||||
|         if (isPrefix && !content) { | ||||
|             return `${prefix}${reasoning}`; | ||||
|         } | ||||
|  | ||||
|         // Combine parts with reasoning and content | ||||
|         return `${prefix}${reasoning}${suffix}${separator}${content}`; | ||||
|     } | ||||
| @@ -218,7 +224,7 @@ function registerReasoningMacros() { | ||||
|     MacrosParser.registerMacro('reasoningSeparator', () => power_user.reasoning.separator, t`Reasoning Separator`); | ||||
| } | ||||
|  | ||||
| function setReasoningEventHandlers(){ | ||||
| function setReasoningEventHandlers() { | ||||
|     $(document).on('click', '.mes_reasoning_copy', (e) => { | ||||
|         e.stopPropagation(); | ||||
|         e.preventDefault(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user