-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add together.xyz, promote Phind to default, minor dark mode tweaks (#69)
Co-authored-by: swyxio <[email protected]>
- Loading branch information
Showing
8 changed files
with
101 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ class Claude extends Provider { | |
margin: 0 !important; | ||
} | ||
`); | ||
}, 1000); | ||
}, 100); | ||
}); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
const Store = require('electron-store'); | ||
const store = new Store(); | ||
|
||
const Provider = require('./provider'); | ||
|
||
class Together extends Provider { | ||
static webviewId = 'webviewTOGETHER'; | ||
static fullName = 'Together (RedPajama, StarCoder, Falcon, etc)'; | ||
|
||
static url = 'https://api.together.xyz/playground/chat'; | ||
|
||
static handleInput(input) { | ||
this.getWebview().executeJavaScript(` | ||
var inputElement = document.querySelector('form textarea[placeholder*="Enter text here"]'); | ||
var nativeTextAreaValueSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, "value").set; | ||
nativeTextAreaValueSetter.call(inputElement, "${input}"); | ||
var event = new Event('input', { bubbles: true}); | ||
inputElement.dispatchEvent(event); | ||
`); | ||
} | ||
|
||
// inputElement.focus(); | ||
// inputElement.value = "${input}"; | ||
// // try to send keyboard event to trigger the re-enable of the disabled button | ||
// // thanks chatgpt! | ||
// var event = new Event('input', { bubbles: true }); | ||
// event.simulated = true; | ||
// var tracker = inputElement._valueTracker; | ||
// if (tracker) { | ||
// tracker.setValue("${input}"); | ||
// } | ||
// // Dispatch the event after a short delay to fix the button state | ||
// setTimeout(function() { | ||
// inputElement.dispatchEvent(event); | ||
// }, 100); | ||
|
||
static handleSubmit() { | ||
this.getWebview().executeJavaScript(` | ||
var btn = document.querySelector('form button:has(svg)'); // YES we are using the has selector!!!! | ||
btn.focus(); | ||
btn.disabled = false; | ||
btn.click()`); | ||
} | ||
|
||
static handleCss() { | ||
this.getWebview().addEventListener('dom-ready', () => { | ||
// hide message below text input, sidebar, suggestions on new chat | ||
setTimeout(() => { | ||
this.getWebview().insertCSS(` | ||
header, header + div { | ||
background-color: white; | ||
/* single line dark mode ftw */ | ||
filter: invert(100%) hue-rotate(180deg); | ||
} | ||
header { | ||
height: 10px; | ||
margin-top: -5px; | ||
padding-top: 0px; | ||
padding-bottom: 0px; | ||
} | ||
/* the "chat" header is pretty big */ | ||
.mui-style-qe6v0i { | ||
padding-top: 0px; | ||
} | ||
div + h1, h1, h1 + div { | ||
display: none; | ||
} | ||
`); | ||
}, 100); | ||
}); | ||
} | ||
|
||
static isEnabled() { | ||
return store.get(`${this.webviewId}Enabled`, false); | ||
} | ||
} | ||
|
||
module.exports = Together; |