How to add additional large language model websites that can be displayed as a web apps. There are already existing websites that are displayed as web apps.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Based on the repository content, I can explain how to add additional LLM websites as web apps in GodMode. The process involves creating a new provider class that extends the base Provider class.
Here's a step-by-step guide:
Create a new file in the src/providers directory for your LLM provider (similar to bard.js or bing.js).
Create a new class that extends the base Provider class. Here's a template based on existing providers:
javascript
const Provider = require('./provider');
class YourProvider extends Provider {
static webviewId = 'webviewYOURPROVIDER'; // Unique ID for your provider
static fullName = 'Your Provider Full Name';
static shortName = 'YourProvider';
static url = 'https://your-provider-url.com'; // The URL of the LLM website
static handleInput(input) {
// Implement how to insert text into the provider's input field
this.getWebview().executeJavaScript(`{
// Use appropriate selector for the input element
var inputElement = document.querySelector("your-input-selector");
if (inputElement) {
const inputEvent = new Event('input', { bubbles: true });
inputElement.value = \`${input}\`;
inputElement.dispatchEvent(inputEvent);
}
}`);
}
static handleSubmit() {
// Implement how to trigger the submit action
this.getWebview().executeJavaScript(`{
// Use appropriate selector for the submit button
var btn = document.querySelector("your-submit-button-selector");
if (btn) {
btn.click();
}
}`);
}
static handleCss() {
// Optional: Implement custom CSS for your provider
this.getWebview().addEventListener('dom-ready', () => {
this.getWebview().insertCSS(`
/* Your custom CSS here */
`);
});
}
}
module.exports = YourProvider;
Key methods to implement:
handleInput(): Handles how text is inserted into the chat input field
handleSubmit(): Handles how the submit button is clicked
handleCss(): Optional method to customize the appearance
handleDarkMode(): Optional method to implement dark mode support
Important properties to set:
webviewId: A unique identifier for your provider
fullName: The full display name of your provider
shortName: A short name for your provider
url: The website URL for your provider
Looking at the existing implementations in bard.js and bing.js, you can see real examples of how these are implemented. For instance, Bing uses shadow DOM selectors to access elements, while Bard uses simpler querySelector methods.
Example from Bard's implementation:
javascript
static handleInput(input) {
this.getWebview().executeJavaScript(`{
var inputElement = document.querySelector(".ql-editor.textarea");
if (inputElement) {
const inputEvent = new Event('input', { bubbles: true });
inputElement.value = \`${input}\`;
inputElement.dispatchEvent(inputEvent);
inputElement.querySelector('p').textContent = \`${input}\`
}
}`);
}
The README shows that GodMode already supports multiple providers including ChatGPT, Claude, Perplexity, Bing, Bard, and others. You can use these existing implementations as references for adding new providers.
Remember to test your implementation thoroughly, especially the input and submit handlers, as different websites may have different DOM structures and event handling requirements.