fix: hide markdown emphasis markers in chat responses
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 6m22s
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 6m22s
This commit is contained in:
@@ -173,6 +173,10 @@
|
|||||||
.replace(/'/g, "'");
|
.replace(/'/g, "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeMarkdownEmphasis(text) {
|
||||||
|
return text.replace(/\*\*/g, '');
|
||||||
|
}
|
||||||
|
|
||||||
async function sendMessage() {
|
async function sendMessage() {
|
||||||
const text = chatInput.value.trim();
|
const text = chatInput.value.trim();
|
||||||
if (!text || isLoading) return;
|
if (!text || isLoading) return;
|
||||||
@@ -205,6 +209,7 @@
|
|||||||
// 5. 스트림 읽기
|
// 5. 스트림 읽기
|
||||||
const reader = response.body.getReader();
|
const reader = response.body.getReader();
|
||||||
const decoder = new TextDecoder("utf-8");
|
const decoder = new TextDecoder("utf-8");
|
||||||
|
let responseText = '';
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const { done, value } = await reader.read();
|
const { done, value } = await reader.read();
|
||||||
@@ -215,7 +220,8 @@
|
|||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
if (line.startsWith('data:')) {
|
if (line.startsWith('data:')) {
|
||||||
const data = line.substring(5);
|
const data = line.substring(5);
|
||||||
textContainer.innerHTML += escapeHtml(data);
|
responseText += data;
|
||||||
|
textContainer.textContent = removeMarkdownEmphasis(responseText);
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user