File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,6 @@ class ChatMKAI {
5656
5757 console . log ( "ChatMK AI: Loading model from" , this . modelPath ) ;
5858
59- // Load the model with user-visible progress
60- this . updateLoadingStatus ( "Downloading language model from Hugging Face..." ) ;
61-
6259 await this . wllama . loadModelFromUrl ( this . modelPath , {
6360 n_ctx : 2048 , // Set context size during model loading
6461 n_ctx_per_seq : 2048 , // Set per-sequence context during model loading
@@ -75,9 +72,6 @@ class ChatMKAI {
7572 console . log (
7673 `ChatMK AI: Model loading ${ percent } % (${ mbLoaded } /${ mbTotal } MB)`
7774 ) ;
78- this . updateLoadingStatus (
79- `Loading language model... ${ percent } % (${ mbLoaded } /${ mbTotal } MB)`
80- ) ;
8175
8276 // Show progress in modal if open
8377 this . showProgressInModal ( percent , mbLoaded , mbTotal ) ;
Original file line number Diff line number Diff line change @@ -158,14 +158,22 @@ function createChatMKModal() {
158158function newChatMKConversation ( ) {
159159 const messagesContainer = document . getElementById ( 'chatmk-messages' ) ;
160160 if ( messagesContainer ) {
161- messagesContainer . innerHTML = `
162- <div class="chatmk-message system">
163- <div class="message-content">
164- <p>Hello! I'm ChatMK, your AI assistant trained on Michal's knowledge base.</p>
165- <p>Ask me anything about his notes and pages!</p>
166- </div>
161+ // Remove only user and assistant messages, keep system messages that are status-related
162+ const messagesToRemove = messagesContainer . querySelectorAll ( '.chatmk-message.user, .chatmk-message.assistant, .chatmk-message.system:not(.ai-progress):not(.embedding-loading)' ) ;
163+ messagesToRemove . forEach ( msg => msg . remove ( ) ) ;
164+
165+ // Add fresh welcome message
166+ const welcomeMessage = document . createElement ( 'div' ) ;
167+ welcomeMessage . className = 'chatmk-message system' ;
168+ welcomeMessage . innerHTML = `
169+ <div class="message-content">
170+ <p>Hello! I'm ChatMK, your AI assistant trained on Michal's knowledge base.</p>
171+ <p>Ask me anything about his notes and pages!</p>
167172 </div>
168173 ` ;
174+
175+ // Add the welcome message at the beginning (before any status messages)
176+ messagesContainer . insertBefore ( welcomeMessage , messagesContainer . firstChild ) ;
169177 }
170178
171179 // Clear input and focus
You can’t perform that action at this time.
0 commit comments