Skip to content

Commit

Permalink
o1-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasPereirah committed Nov 20, 2024
1 parent 97a2d63 commit 084e0a8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,23 @@ To do this, click on "Options" -> Plugins and paste the JavaScript code provided


```javascript
let page_url = window.location.origin + window.location.pathname;

let proxy_url = window.location.origin + window.location.pathname + "/proxy.php";
// This assumes that the proxy url is on the same host, if not enter it here
if(chosen_platform === "sambanova" || chosen_platform === "nvidia"){
endpoint = page_url+"/proxy.php?platform="+chosen_platform;
endpoint = proxy_url+"?platform="+chosen_platform;
}
function setProxyEndpoint(){
function setProxyEndpoint(event){
if(chosen_platform === "sambanova" || chosen_platform === "nvidia"){
let proxy_endpoint = page_url+"/proxy.php?platform="+chosen_platform;
let proxy_endpoint = proxy_url+"/proxy.php?platform="+chosen_platform;
if(proxy_endpoint !== endpoint){
endpoint = proxy_endpoint;
removeLastMessage();
let ra = `<p>You have changed platforms and are now using <b>${chosen_platform}</b> which requires proxy usage.
To activate the proxy, reload the page.</p><p><button onclick="reloadPage()">Reload Page</button></p>`;
addWarning(ra,false, 'fail_dialog')
}
}
}


let button_send = document.querySelector("#send");
chat_textarea.addEventListener('keyup', (event) => {
if (event.key === 'Enter' && !event.shiftKey) {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<script src="js/4devs.js?v=1.0.0"></script>
<script src="js/prompts.js?v=1.0.3"></script>
<script src="js/tools_list.js?v=1.1.1"></script>
<script src="js/script.js?v=2.2.6"></script>
<script src="js/script.js?v=2.2.8"></script>
<script src="js/beta.js?v=1.0"></script>
</body>
</html>
27 changes: 15 additions & 12 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ let converter = new showdown.Converter();
let PLATFORM_DATA = {
openai: {
models: [
"o1",
"o1-mini",
"gpt-4o",
"gpt-4o-mini",
"o1-mini",
"o1-preview"
],
name: "OpenAI",
endpoint: "https://api.openai.com/v1/chat/completions"
Expand Down Expand Up @@ -69,14 +69,12 @@ let PLATFORM_DATA = {
},
groq: {
models: [
"llama-3.2-90b-text-preview",
"llama-3.2-90b-vision-preview",
"llama3-groq-70b-8192-tool-use-preview",
"llama-3.1-70b-versatile",
"llama3-70b-8192",
"mixtral-8x7b-32768",
"llama-3.2-11b-vision-preview",
"llama3-groq-8b-8192-tool-use-preview",
"gemma2-9b-it",
"llama3-groq-70b-8192-tool-use-preview"
],
name: "Groq",
endpoint: "https://api.groq.com/openai/v1/chat/completions"
Expand Down Expand Up @@ -170,7 +168,7 @@ let settings = document.querySelector("#settings");
settings.onclick = () => {
let conversations = document.querySelector(".conversations");
conversations.style.display = 'block';
localStorage.setItem("hide_conversations", '0');
//localStorage.setItem("hide_conversations", '0');
let hasTopic = document.querySelector(".conversations .topic");
if (!hasTopic) {
let ele = document.createElement('div');
Expand Down Expand Up @@ -204,7 +202,7 @@ new_chat.addEventListener('click', () => {
jsClose = document.querySelector(".jsClose");
jsClose.onclick = () => {
document.querySelector('.conversations').style.display = 'none';
localStorage.setItem("hide_conversations", '1');
//localStorage.setItem("hide_conversations", '1');
}


Expand Down Expand Up @@ -408,14 +406,14 @@ function removeChat(div, id) {
* Starts a new chat without any context from past conversation
**/
function newChat() {
toggleAnimation(true);
document.title = SITE_TITLE;
chat_id = new Date().getTime(); // generate a new chat_id
let new_url = document.URL;
new_url = new_url.split('?')[0];
new_url = new_url.split("#")[0];
new_url += "#"+chat_id;
history.pushState({url: new_url}, '', new_url);

removeScreenConversation();
conversations.messages = []; // clean old conversation

Expand Down Expand Up @@ -542,7 +540,7 @@ function getSystemPrompt() {
if(!system_prompt) {
return system_prompt;
}
let today = new Date();
let today = whatTimeIsIt();
system_prompt = system_prompt.replaceAll("{{date}}", today);
system_prompt = system_prompt.replaceAll("{{lang}}", navigator.language)
return system_prompt;
Expand Down Expand Up @@ -1363,10 +1361,10 @@ function saveModel() {

let hc = localStorage.getItem("hide_conversations");
if (hc === '1') {
document.querySelector('.conversations').style.display = 'none';
// document.querySelector('.conversations').style.display = 'none';
} else {
if (!is_mobile) {
document.querySelector('.conversations').style.display = 'block';
// document.querySelector('.conversations').style.display = 'block';
}
}

Expand Down Expand Up @@ -2443,6 +2441,11 @@ function unlockScroll(){
}
unlockScroll();

function whatTimeIsIt(){
const today = new Date();
return today.toLocaleDateString('en-US') +" "+today.toLocaleTimeString();
// ex: 11/19/2024 10:18:57
}

function extractVideoId(text) {
let video_id = text.match(/youtube.com\/watch\?v=(.*)/)[1] ?? null;
Expand Down

0 comments on commit 084e0a8

Please sign in to comment.