Timothy Jaeryang Baek 3 months ago
parent
commit
9809ffb095
1 changed files with 7 additions and 7 deletions
  1. 7 7
      src/lib/components/chat/MessageInput/Commands/Prompts.svelte

+ 7 - 7
src/lib/components/chat/MessageInput/Commands/Prompts.svelte

@@ -120,16 +120,16 @@
 			text = text.replaceAll('{{CURRENT_WEEKDAY}}', weekday);
 		}
 
-		const paragraphs = prompt.split('\n');
+		const lines = prompt.split('\n');
+		const lastLine = lines.pop();
 
-		let lastParagraph = paragraphs.pop();
-		const promptWords = lastParagraph.split(' ');
+		const lastLineWords = lastLine.split(' ');
+		const lastWord = lastLineWords.pop();
 
-		promptWords.pop();
-		promptWords.push(`${text}`);
+		lastLineWords.push(text);
+		lines.push(lastLineWords.join(' '));
 
-		lastParagraph = promptWords.join(' ');
-		prompt = $settings?.richTextInput ? paragraphs.join('<br/>') : paragraphs.join('\n');
+		prompt = lines.join('\n');
 
 		const chatInputContainerElement = document.getElementById('chat-input-container');
 		const chatInputElement = document.getElementById('chat-input');