mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-01-01 17:09:59 +01:00
Updated function for setting up the convo in playground
This commit is contained in:
@@ -9,13 +9,26 @@ async function fill_playground(messages) {
|
||||
if (system_messages.length > 0) {
|
||||
let system_message_textarea = document.querySelector('.chat-pg-instructions').querySelector('textarea');
|
||||
system_message_textarea.focus();
|
||||
system_message_textarea.value = '';
|
||||
document.execCommand("insertText", false, system_messages[0].content);
|
||||
await sleep(100);
|
||||
}
|
||||
|
||||
// Remove all previous messages
|
||||
let remove_buttons = document.querySelectorAll('.chat-message-remove-button');
|
||||
for (let j = 0; j < 10; j++) {
|
||||
for (let i = 0; i < remove_buttons.length; i++) {
|
||||
let clickEvent = new Event('click', {
|
||||
'bubbles': true,
|
||||
'cancelable': true
|
||||
});
|
||||
remove_buttons[i].dispatchEvent(clickEvent);
|
||||
}
|
||||
}
|
||||
|
||||
let other_messages = messages.filter(msg => msg.role !== 'system');
|
||||
|
||||
for (let i = 0; i < other_messages.length - 1; i++) {
|
||||
for (let i = 0; i < other_messages.length; i++) {
|
||||
document.querySelector('.add-message').click()
|
||||
await sleep(100);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class AgentConvo:
|
||||
print(f"{content}\n")
|
||||
logger.info(f"{print_msg}: {content}\n")
|
||||
|
||||
def to_playground(self, path):
|
||||
def to_playground(self):
|
||||
with open('const/convert_to_playground_convo.js', 'r', encoding='utf-8') as file:
|
||||
content = file.read()
|
||||
process = subprocess.Popen('pbcopy', stdin=subprocess.PIPE)
|
||||
|
||||
Reference in New Issue
Block a user