Skip to content

Commit 43fc694

Browse files
committed
Some fixes
1 parent 58dbe06 commit 43fc694

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

mikupad.html

+9-7
Original file line numberDiff line numberDiff line change
@@ -3850,15 +3850,15 @@
38503850
// split the chunk in 2
38513851
const left = { content: chunk.content.substring(0, chunk.content.indexOf(fillPlaceholder)), type: "user" };
38523852
const right = { content: chunk.content.substring(chunk.content.indexOf(fillPlaceholder) + fillPlaceholder.length), type: "user" };
3853-
fillIdx = i + 1;
38543853
leftPromptChunks = [
3855-
...promptChunks.slice(0, Math.max(0, i - 1)),
3856-
...[left]
3854+
...promptChunks.slice(0, i),
3855+
left
38573856
];
38583857
rightPromptChunks = [
3859-
...[right],
3858+
right,
38603859
...promptChunks.slice(i + 1, promptChunks.length - 1),
38613860
];
3861+
fillIdx = i + 1;
38623862
break;
38633863
}
38643864
}
@@ -3872,9 +3872,9 @@
38723872
const finalPrompt = assembleFinalPrompt(additionalContextPrompt);
38733873

38743874
predict(finalPrompt, leftPromptChunks.length, (chunk) => {
3875-
console.log(chunk);
38763875
if (rightPromptChunks[0]) {
3877-
if (chunk.content.trim().startsWith(rightPromptChunks[0].content[0])) {
3876+
const trimmedChunk = chunk.content.replace(/^ +| +$/gm, "")
3877+
if (trimmedChunk.startsWith(rightPromptChunks[0].content[0])) {
38783878
if (chunk.content[0] == ' ' && rightPromptChunks[0].content[0] != ' ') {
38793879
rightPromptChunks[0].content = ' ' + rightPromptChunks[0].content;
38803880
setPromptChunks(p => [
@@ -3956,8 +3956,10 @@
39563956
while (undoStack.current.at(-1) >= chunkCount)
39573957
undoStack.current.pop();
39583958
undoStack.current.push(chunkCount);
3959-
redoStack.current = [];
3959+
} else {
3960+
undoStack.current = [];
39603961
}
3962+
redoStack.current = [];
39613963
setUndoHovered(false);
39623964
setRejectedAPIKey(false);
39633965
promptArea.current.scrollTarget = undefined;

0 commit comments

Comments
 (0)