diff --git a/src/interface/desktop/chat.html b/src/interface/desktop/chat.html index 11f6f17d..b27bbc90 100644 --- a/src/interface/desktop/chat.html +++ b/src/interface/desktop/chat.html @@ -68,6 +68,8 @@ // Replace any ** with and __ with newHTML = newHTML.replace(/\*\*([\s\S]*?)\*\*/g, '$1'); newHTML = newHTML.replace(/__([\s\S]*?)__/g, '$1'); + // Remove any text between [INST] and tags. These are spurious instructions for the AI chat model. + newHTML = newHTML.replace(/\[INST\].+(<\/s>)?/g, ''); return newHTML; } @@ -168,6 +170,7 @@ function incrementalChat(event) { if (!event.shiftKey && event.key === 'Enter') { + event.preventDefault(); chat(); } } @@ -291,8 +294,7 @@ diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html index 13ba9875..30304caf 100644 --- a/src/khoj/interface/web/chat.html +++ b/src/khoj/interface/web/chat.html @@ -67,6 +67,8 @@ // Replace any ** with and __ with newHTML = newHTML.replace(/\*\*([\s\S]*?)\*\*/g, '$1'); newHTML = newHTML.replace(/__([\s\S]*?)__/g, '$1'); + // Remove any text between [INST] and tags. These are spurious instructions for the AI chat model. + newHTML = newHTML.replace(/\[INST\].+(<\/s>)?/g, ''); return newHTML; } @@ -163,6 +165,7 @@ function incrementalChat(event) { if (!event.shiftKey && event.key === 'Enter') { + e.preventDefault(); chat(); } } @@ -281,8 +284,7 @@