From 2cf744b31688582aa093c06942b8f0dbb6c32ed5 Mon Sep 17 00:00:00 2001 From: elioat Date: Mon, 6 Jan 2025 17:08:40 -0500 Subject: * --- html/matt-chat/index.html | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'html/matt-chat') diff --git a/html/matt-chat/index.html b/html/matt-chat/index.html index 8ccc9be..2bc8119 100644 --- a/html/matt-chat/index.html +++ b/html/matt-chat/index.html @@ -721,16 +721,29 @@ // Set the base url for the ollama api, and then list all the models you want to use // The context window size is the number of previous exchanges to keep... // though this is relatively naive at the moment - const config = { + + const config = {} + + const localConfig = { apiUrl: "http://localhost:11434/v1", completionsEndpoint: "http://localhost:11434/v1/chat/completions", modelsEndpoint: "http://localhost:11434/v1/models", - contextWindowSize: 6, // Number of previous exchanges to remember - systemMessage: "You are a helpful assistant. If you don't know something you'll let me know. Your name is Matt.", // Set the mood and personality for the LLM's responses - maxTokens: 4096, // Approximate max tokens for most models - summarizeThreshold: 3584, // When to trigger summarization + contextWindowSize: 6, + systemMessage: "You are a helpful assistant. If you don't know something you'll let me know. Your name is Matt.", + maxTokens: 4096, + summarizeThreshold: 3584, }; + const mattConfig = { + apiUrl: "http://100.108.91.106:11434/v1", + completionsEndpoint: "http://100.108.91.106:11434/v1/chat/completions", + modelsEndpoint: "http://100.108.91.106:11434/v1/models", + contextWindowSize: 6, + systemMessage: "You are a helpful assistant. If you don't know something you'll let me know. Your name is Matt.", + maxTokens: 4096, + summarizeThreshold: 3584, + } + let conversationHistory = { summary: null, current: [], @@ -917,6 +930,24 @@ return; } + if (userMessage.toLowerCase() === '/matt') { + Object.assign(config, mattConfig); + addMessage("Switched to Matt's config", "bot"); + userInput.value = ""; + updateCounter(); + populateModelSelect(); // Refresh the model list for the new endpoint + return; + } + + if (userMessage.toLowerCase() === '/local') { + Object.assign(config, localConfig); + addMessage("Switched to local config", "bot"); + userInput.value = ""; + updateCounter(); + populateModelSelect(); // Refresh the model list for the new endpoint + return; + } + addMessage(userMessage, "user"); userInput.value = ""; // Clear input after sending the message @@ -1070,6 +1101,8 @@ Available commands:\n /help - Show this message /theme [theme-name] - Switch theme (available themes: ${Object.keys(AVAILABLE_THEMES).join(', ')}) without a theme name, this will show all available themes, too + /local - Switch to local Ollama instance + /matt - Switch to Matt's Ollama instance `; addMessage(helpMessage, "bot"); } @@ -1225,6 +1258,9 @@ Available commands:\n localStorage.setItem('selectedTheme', themeName); addMessage(`Theme switched to: ${AVAILABLE_THEMES[themeName]}`, "bot"); } + + // Initialize with localConfig + Object.assign(config, localConfig); -- cgit 1.4.1-2-gfad0