diff options
Diffstat (limited to 'html/matt-chat/index.html')
-rw-r--r-- | html/matt-chat/index.html | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/html/matt-chat/index.html b/html/matt-chat/index.html index 42d2020..d6f04b5 100644 --- a/html/matt-chat/index.html +++ b/html/matt-chat/index.html @@ -180,10 +180,11 @@ { value: "qwen2.5-coder:32b", label: "qwen2.5-coder:32b, super slow coding" }, ], contextWindowSize: 3, // Number of previous exchanges to remember - systemMessage: "You are a helpful assistant, but if you don't know something you'll let me know. Your name is Matt. You are a cat." // Set the mood and personality for the LLM's responses + systemMessage: "You are a helpful assistant, but 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 }; let conversationHistory = []; + let isCatMode = false; // Flag to track cat mode function populateModelSelect() { const modelSelect = document.getElementById("model-select"); @@ -253,7 +254,18 @@ // Event listener to update the counter on input document.getElementById("user-input").addEventListener("input", updateCounter); + // Function to toggle cat mode + function toggleCatMode() { + isCatMode = !isCatMode; // Toggle the flag + if (isCatMode) { + config.systemMessage += " You are a cat."; // Append the phrase + } else { + config.systemMessage = config.systemMessage.replace(" You are a cat.", ""); // Remove the phrase + } + addMessage(`Cat mode is now ${isCatMode ? "enabled" : "disabled"}.`, "bot"); // Inform the user + } + // Function to handle sending the message async function sendMessage() { const userInput = document.getElementById("user-input"); const userMessage = userInput.value.trim(); @@ -282,6 +294,13 @@ return; } + if (userMessage.toLowerCase() === '/cat') { + toggleCatMode(); // Toggle cat mode + userInput.value = ""; // Clear input after command + updateCounter(); // Reset counters + return; + } + addMessage(userMessage, "user"); conversationHistory.push({ role: "user", content: userMessage }); // Add user message to history userInput.value = ""; @@ -438,6 +457,7 @@ const helpMessage = ` Available commands:\n /darkmode - Toggle dark mode + /cat - Toggle cat mode /clear - Clear the chat history /help - Show this message `; |