Skip to content

Commit 2910343

Browse files
Update models loading messages
1 parent 297edc6 commit 2910343

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

assets/js/chatmkAI.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ChatMKAI {
5555
console.log("ChatMK AI: Loading model from", this.modelPath);
5656

5757
// Load the model with user-visible progress
58-
this.updateLoadingStatus("Downloading AI model from Hugging Face...");
58+
this.updateLoadingStatus("Downloading language model from Hugging Face...");
5959

6060
await this.wllama.loadModelFromUrl(this.modelPath, {
6161
n_ctx: 2048, // Set context size during model loading
@@ -69,7 +69,7 @@ class ChatMKAI {
6969
`ChatMK AI: Model loading ${percent}% (${mbLoaded}/${mbTotal}MB)`
7070
);
7171
this.updateLoadingStatus(
72-
`Loading AI model... ${percent}% (${mbLoaded}/${mbTotal}MB)`
72+
`Loading language model... ${percent}% (${mbLoaded}/${mbTotal}MB)`
7373
);
7474

7575
// Show progress in modal if open
@@ -82,15 +82,15 @@ class ChatMKAI {
8282
console.log("ChatMK AI: Model loaded successfully!");
8383

8484
// Update UI to show AI is ready
85-
this.updateLoadingStatus("AI ready!");
85+
this.updateLoadingStatus("Language model ready!");
8686

8787
return true;
8888
} catch (error) {
8989
console.error("ChatMK AI: Failed to initialize model:", error);
9090
this.isLoading = false;
9191

9292
// For now, disable AI if it fails to load
93-
this.updateLoadingStatus("AI unavailable - using search only");
93+
this.updateLoadingStatus("Language model unavailable - using search only");
9494
return false;
9595
}
9696
}
@@ -100,7 +100,7 @@ class ChatMKAI {
100100
*/
101101
async generateResponse(query, searchResults = []) {
102102
if (!this.isLoaded || !this.wllama) {
103-
throw new Error("AI model not loaded. Please wait for initialization.");
103+
throw new Error("Language model not loaded. Please wait for initialization.");
104104
}
105105

106106
try {
@@ -156,7 +156,7 @@ class ChatMKAI {
156156
// Provide a fallback response based on search results
157157
if (searchResults.length > 0) {
158158
throw new Error(
159-
`AI generation failed, but here are relevant results: ${searchResults
159+
`Language model generation failed, but here are relevant results: ${searchResults
160160
.map((r) => r.title)
161161
.join(", ")}`
162162
);
@@ -211,7 +211,9 @@ ${userMessage}
211211
const modal = document.getElementById("chatmk-modal");
212212
if (modal && modal.classList.contains("is-active")) {
213213
// Add a system message about AI loading progress
214-
const progressMsg = `AI model loading: ${percent}% (${mbLoaded}/${mbTotal}MB)`;
214+
const progressMsg = percent === 100
215+
? `Language model loaded: SmolLM2-360M-Q8`
216+
: `Language model loading: ${percent}% (${mbLoaded}/${mbTotal} MB)`;
215217

216218
// Check if there's already a progress message and update it
217219
const messages = document.getElementById("chatmk-messages");

assets/js/chatmkModal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function createChatMKModal() {
138138
</div>
139139
140140
<div class="chatmk-status" id="chatmk-status">
141-
<span class="status-text">This is just a simple POC, so don't trust it much.</span>
141+
<span class="status-text">This is just a (mostly useless) experiment.</span>
142142
</div>
143143
</div>
144144
</div>

assets/js/chatmkSearch.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,23 @@ class ChatMKSearch {
8282
// Update existing progress message
8383
const content = existingProgress.querySelector('.message-content');
8484
if (content) {
85-
content.innerHTML = `<p>Embedding model loading: ${percent}% (${mbLoaded}/${mbTotal}MB)</p>`;
85+
if (percent === 100) {
86+
content.innerHTML = `<p>Embedding model loaded: MiniLM-L6-v2</p>`;
87+
} else {
88+
content.innerHTML = `<p>Embedding model loading: ${percent}% (${mbLoaded}/${mbTotal} MB)</p>`;
89+
}
8690
}
8791
} else {
8892
// Create new progress message
8993
const messageDiv = document.createElement('div');
9094
messageDiv.className = 'chatmk-message system embedding-loading';
95+
const messageContent = percent === 100
96+
? `<p>Embedding model loaded: MiniLM-L6-v2</p>`
97+
: `<p>Embedding model loading: ${percent}% (${mbLoaded}/${mbTotal} MB)</p>`;
98+
9199
messageDiv.innerHTML = `
92100
<div class="message-content">
93-
<p>Embedding model loading: ${percent}% (${mbLoaded}/${mbTotal}MB)</p>
101+
${messageContent}
94102
</div>
95103
`;
96104

0 commit comments

Comments
 (0)