SimpleChat:ODS:Move restore/load saved chat btn setup to Me
This also allows being able to set the common system prompt ui element to loaded chat's system prompt.
This commit is contained in:
parent
5d408660f2
commit
4abcfde4e7
1 changed files with 20 additions and 9 deletions
|
@ -189,15 +189,7 @@ class SimpleChat {
|
||||||
} else {
|
} else {
|
||||||
if (bClear) {
|
if (bClear) {
|
||||||
div.innerHTML = gUsageMsg;
|
div.innerHTML = gUsageMsg;
|
||||||
div.innerHTML += `<p class="role-system">Restore</p>`;
|
gMe.setup_load(div, this);
|
||||||
let btn = ui.el_create_button(this.ods_key(), (ev)=>{
|
|
||||||
console.log("DBUG:SimpleChat:SC:Load", this);
|
|
||||||
this.load();
|
|
||||||
queueMicrotask(()=>{
|
|
||||||
this.show(div);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
div.appendChild(btn);
|
|
||||||
gMe.show_info(div);
|
gMe.show_info(div);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -768,6 +760,25 @@ class Me {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the load saved chat ui.
|
||||||
|
* @param {HTMLDivElement} div
|
||||||
|
* @param {SimpleChat} chat
|
||||||
|
*/
|
||||||
|
setup_load(div, chat) {
|
||||||
|
div.innerHTML += `<p class="role-system">Restore</p>
|
||||||
|
<p>Load previously saved chat session, if available</p>`;
|
||||||
|
let btn = ui.el_create_button(chat.ods_key(), (ev)=>{
|
||||||
|
console.log("DBUG:SimpleChat:SC:Load", chat);
|
||||||
|
chat.load();
|
||||||
|
queueMicrotask(()=>{
|
||||||
|
chat.show(div);
|
||||||
|
this.multiChat.elInSystem.value = chat.get_system_latest();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
div.appendChild(btn);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the configurable parameters info in the passed Div element.
|
* Show the configurable parameters info in the passed Div element.
|
||||||
* @param {HTMLDivElement} elDiv
|
* @param {HTMLDivElement} elDiv
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue