:gem: [Feature] Render content markdown as HTML
Browse files
apps/llm_mixer/index.html
CHANGED
@@ -17,6 +17,7 @@
|
|
17 |
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
|
18 |
/>
|
19 |
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js"></script>
|
|
|
20 |
</head>
|
21 |
<body>
|
22 |
<div class="container">
|
|
|
17 |
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
|
18 |
/>
|
19 |
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js"></script>
|
20 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
|
21 |
</head>
|
22 |
<body>
|
23 |
<div class="container">
|
apps/llm_mixer/js/chat_operator.js
CHANGED
@@ -4,6 +4,7 @@ let messagers_container = $("#messagers-container");
|
|
4 |
let messager_list = new MessagerList(messagers_container);
|
5 |
let available_models_select = $("#available-models-select");
|
6 |
let temperature_select = $("#temperature-select");
|
|
|
7 |
|
8 |
export function create_messager(
|
9 |
role,
|
@@ -84,12 +85,20 @@ export function update_message(json_chunks, content_displayer = null) {
|
|
84 |
}
|
85 |
if (content) {
|
86 |
console.log(content);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
if (finish_reason === "stop") {
|
89 |
console.log("[STOP]");
|
90 |
}
|
91 |
console.log(item);
|
92 |
-
content_displayer.append(content);
|
93 |
});
|
94 |
return json_chunks;
|
95 |
}
|
|
|
4 |
let messager_list = new MessagerList(messagers_container);
|
5 |
let available_models_select = $("#available-models-select");
|
6 |
let temperature_select = $("#temperature-select");
|
7 |
+
let md_to_html_converter = new showdown.Converter();
|
8 |
|
9 |
export function create_messager(
|
10 |
role,
|
|
|
85 |
}
|
86 |
if (content) {
|
87 |
console.log(content);
|
88 |
+
content_displayer.attr(
|
89 |
+
"raw_text",
|
90 |
+
content_displayer.attr("raw_text") + content
|
91 |
+
);
|
92 |
+
content_displayer.html(
|
93 |
+
md_to_html_converter.makeHtml(
|
94 |
+
content_displayer.attr("raw_text")
|
95 |
+
)
|
96 |
+
);
|
97 |
}
|
98 |
if (finish_reason === "stop") {
|
99 |
console.log("[STOP]");
|
100 |
}
|
101 |
console.log(item);
|
|
|
102 |
});
|
103 |
return json_chunks;
|
104 |
}
|
apps/llm_mixer/js/default.css
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
}
|
31 |
|
32 |
.chat-assistant {
|
33 |
-
color: blue;
|
34 |
border: lightgray 1px solid;
|
35 |
}
|
36 |
|
|
|
30 |
}
|
31 |
|
32 |
.chat-assistant {
|
33 |
+
/* color: blue; */
|
34 |
border: lightgray 1px solid;
|
35 |
}
|
36 |
|
apps/llm_mixer/js/messager.js
CHANGED
@@ -31,6 +31,7 @@ export class MessagerViewer {
|
|
31 |
.addClass("content-displayer")
|
32 |
.addClass(`chat-${this.message.role}`)
|
33 |
.append(this.message.content);
|
|
|
34 |
}
|
35 |
create_button_group() {
|
36 |
this.button_group = $("<div>")
|
|
|
31 |
.addClass("content-displayer")
|
32 |
.addClass(`chat-${this.message.role}`)
|
33 |
.append(this.message.content);
|
34 |
+
this.content_displayer.attr("raw_text", "");
|
35 |
}
|
36 |
create_button_group() {
|
37 |
this.button_group = $("<div>")
|