this repo has been put into chatkit
, you can find more about it in chat-play/packages/chatkit/chatgpt
getSubmitButton, getTextarea, getRegenerateButton, getNewChatButton...
just copy and paste the code below
function getSubmitButton() {
const form = document.querySelector('form');
const buttons = form.querySelectorAll('button');
const result = buttons[buttons.length - 1];
return result;
};
function getTextarea() {
const form = document.querySelector('form');
const textareas = form.querySelectorAll('textarea');
const result = textareas[0];
return result;
};
function getRegenerateButton() {
const form = document.querySelector('form');
const buttons = form.querySelectorAll('button');
const result = Array.from(buttons).find(button => button.textContent.trim().toLowerCase().includes('regenerate'));
return result;
};
function getStopGeneratingButton() {
const form = document.querySelector('form');
const buttons = form.querySelectorAll('button');
return Array.from(buttons).find(button => button.textContent.trim().toLowerCase().includes('stop generating'));
}
function getNewChatButton() {
const aElements = document.getElementsByTagName('a');
const result = Array.from(aElements).find(a => a.textContent === 'New chat');
return result;
};
Contributions, issues and feature requests are welcome!
This project is licensed under the terms of the MIT license.