Skip to content

Commit 4b51231

Browse files
authored
Clean up the chatbot module (#1274)
1 parent abb9533 commit 4b51231

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

pgml-dashboard/src/components/chatbot/chatbot_controller.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,15 @@ export default class extends Controller {
174174
this.handleKnowledgeBaseChange(); // This will set our initial knowledge base
175175
this.handleBrainChange(); // This will set our initial brain
176176
this.handleResize();
177+
this.openConnection();
178+
this.getHistory();
179+
}
177180

181+
openConnection() {
178182
const url = ((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.hostname + (((window.location.port != 80) && (window.location.port != 443)) ? ":" + window.location.port : "") + window.location.pathname + "/get-answer";
179183
this.socket = new WebSocket(url);
180184
this.socket.onmessage = (message) => {
181185
let result = JSON.parse(message.data);
182-
console.log(result);
183-
184186
if (result.error) {
185187
this.showChatbotAlert("Error", "Error getting chatbot answer");
186188
console.log(result.error);
@@ -201,7 +203,6 @@ export default class extends Controller {
201203
this.socket.onclose = () => {
202204
window.setTimeout(() => this.openConnection(), 500);
203205
};
204-
this.getHistory();
205206
}
206207

207208
async clearHistory() {

pgml-dashboard/src/components/chatbot/mod.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,31 @@ impl KnowledgeBaseWithLogo {
7272
}
7373
}
7474

75-
const CHATBOT_BRAINS: [ChatbotBrain; 4] = [
76-
ChatbotBrain::new(
77-
"teknium/OpenHermes-2.5-Mistral-7B",
78-
"OpenHermes",
79-
"teknium/OpenHermes-2.5-Mistral-7B",
80-
"/dashboard/static/images/logos/openhermes.webp",
81-
),
82-
ChatbotBrain::new(
83-
"Gryphe/MythoMax-L2-13b",
84-
"MythoMax",
85-
"Gryphe/MythoMax-L2-13b",
86-
"/dashboard/static/images/logos/mythomax.webp",
87-
),
75+
const CHATBOT_BRAINS: [ChatbotBrain; 1] = [
76+
// ChatbotBrain::new(
77+
// "teknium/OpenHermes-2.5-Mistral-7B",
78+
// "OpenHermes",
79+
// "teknium/OpenHermes-2.5-Mistral-7B",
80+
// "/dashboard/static/images/logos/openhermes.webp",
81+
// ),
82+
// ChatbotBrain::new(
83+
// "Gryphe/MythoMax-L2-13b",
84+
// "MythoMax",
85+
// "Gryphe/MythoMax-L2-13b",
86+
// "/dashboard/static/images/logos/mythomax.webp",
87+
// ),
8888
ChatbotBrain::new(
8989
"openai",
9090
"OpenAI",
9191
"ChatGPT",
9292
"/dashboard/static/images/logos/openai.webp",
9393
),
94-
ChatbotBrain::new(
95-
"berkeley-nest/Starling-LM-7B-alpha",
96-
"Starling",
97-
"berkeley-nest/Starling-LM-7B-alpha",
98-
"/dashboard/static/images/logos/starling.webp",
99-
),
94+
// ChatbotBrain::new(
95+
// "berkeley-nest/Starling-LM-7B-alpha",
96+
// "Starling",
97+
// "berkeley-nest/Starling-LM-7B-alpha",
98+
// "/dashboard/static/images/logos/starling.webp",
99+
// ),
100100
];
101101

102102
struct ChatbotBrain {
@@ -125,7 +125,7 @@ impl ChatbotBrain {
125125
#[derive(TemplateOnce)]
126126
#[template(path = "chatbot/template.html")]
127127
pub struct Chatbot {
128-
brains: &'static [ChatbotBrain; 4],
128+
brains: &'static [ChatbotBrain; 1],
129129
example_questions: &'static ExampleQuestions,
130130
knowledge_bases_with_logo: &'static [KnowledgeBaseWithLogo; 4],
131131
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy