refac: prompt command behaviour

This commit is contained in:
Timothy Jaeryang Baek 2025-03-31 00:48:09 -07:00
parent 300b7dfcc0
commit effa87638d
2 changed files with 7 additions and 4 deletions

View File

@ -855,7 +855,6 @@
on:keydown={async (e) => {
const isCtrlPressed = e.ctrlKey || e.metaKey; // metaKey is for Cmd key on Mac
console.log('keydown', e);
const commandsContainerElement =
document.getElementById('commands-container');

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { prompts, user } from '$lib/stores';
import { prompts, settings, user } from '$lib/stores';
import {
findWordIndices,
getUserPosition,
@ -120,12 +120,16 @@
text = text.replaceAll('{{CURRENT_WEEKDAY}}', weekday);
}
const promptWords = prompt.split(' ');
const paragraphs = prompt.split('\n');
let lastParagraph = paragraphs.pop();
const promptWords = lastParagraph.split(' ');
promptWords.pop();
promptWords.push(`${text}`);
prompt = promptWords.join(' ');
lastParagraph = promptWords.join(' ');
prompt = $settings?.richTextInput ? paragraphs.join('<br/>') : paragraphs.join('\n');
const chatInputContainerElement = document.getElementById('chat-input-container');
const chatInputElement = document.getElementById('chat-input');