bugfix
This commit is contained in:
parent
a17d7f7a94
commit
bff3e1726c
@ -1,5 +1,18 @@
|
|||||||
var bricks = window.bricks || {}
|
var bricks = window.bricks || {}
|
||||||
|
|
||||||
|
bricks.escapeSpecialChars = function(s){
|
||||||
|
return s
|
||||||
|
.replace(/\\/g, '\\\\') // escape backslashes
|
||||||
|
.replace(/"/g, '\\"') // escape double quotes
|
||||||
|
// .replace(/'/g, '\\\'') // escape single quotes
|
||||||
|
.replace(/\n/g, '\\n') // escape newlines
|
||||||
|
.replace(/\r/g, '\\r') // escape carriage returns
|
||||||
|
.replace(/\t/g, '\\t') // escape tabs
|
||||||
|
.replace(/\f/g, '\\f') // escape form feeds
|
||||||
|
.replace(/\v/g, '\\v') // escape vertical tabs
|
||||||
|
.replace(/\0/g, '\\0'); // escape null bytes
|
||||||
|
}
|
||||||
|
|
||||||
bricks.UserMsgBox = class extends bricks.HBox {
|
bricks.UserMsgBox = class extends bricks.HBox {
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
@ -65,7 +78,9 @@ bricks.LlmMsgBox = class extends bricks.HBox {
|
|||||||
}
|
}
|
||||||
chunk_ended(){
|
chunk_ended(){
|
||||||
var msg = this.llm_msg_format();
|
var msg = this.llm_msg_format();
|
||||||
var lmsg = bricks.apply_data(msg, {content:this.w.md_content});
|
var txt = this.w.md_content;
|
||||||
|
txt = bricks.escapeSpecialChars(txt);
|
||||||
|
var lmsg = bricks.apply_data(msg, {content:txt});
|
||||||
this.messages.push(lmsg);
|
this.messages.push(lmsg);
|
||||||
}
|
}
|
||||||
async set_prompt(prompt){
|
async set_prompt(prompt){
|
||||||
@ -145,6 +160,7 @@ bricks.LlmDialog = class extends bricks.VBox {
|
|||||||
this.add_widget(filler);
|
this.add_widget(filler);
|
||||||
}
|
}
|
||||||
async set_prompt(prompt){
|
async set_prompt(prompt){
|
||||||
|
prompt = bricks.escapeSpecialChars(prompt);
|
||||||
var box = new bricks.UserMsgBox({
|
var box = new bricks.UserMsgBox({
|
||||||
width:'100%',
|
width:'100%',
|
||||||
icon:this.user_icon,
|
icon:this.user_icon,
|
||||||
|
Loading…
Reference in New Issue
Block a user