aboutsummaryrefslogtreecommitdiffstats
path: root/html
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2025-01-05 07:31:22 -0500
committerelioat <elioat@tilde.institute>2025-01-05 07:31:22 -0500
commit9f0f8dc0787596f608051fe661a449eae6b192f0 (patch)
tree802b3e007952a49264e3ba304ba38505bca8557f /html
parentd194750f2fe0b496d558c91992135e7161eaedb4 (diff)
downloadtour-9f0f8dc0787596f608051fe661a449eae6b192f0.tar.gz
*
Diffstat (limited to 'html')
-rw-r--r--html/matt-chat/index.html48
1 files changed, 34 insertions, 14 deletions
diff --git a/html/matt-chat/index.html b/html/matt-chat/index.html
index d987f21..391bb95 100644
--- a/html/matt-chat/index.html
+++ b/html/matt-chat/index.html
@@ -200,16 +200,35 @@
let isCatMode = false; // Flag to track cat mode
- function populateModelSelect() {
+ async function populateModelSelect() {
const modelSelect = document.getElementById("model-select");
modelSelect.innerHTML = ""; // Clear existing options
- config.models.forEach(model => {
- const option = document.createElement("option");
- option.value = model.value;
- option.textContent = model.label;
- modelSelect.appendChild(option);
- });
+ try {
+ const response = await fetch("http://localhost:11434/v1/models"); // Adjust the endpoint as needed
+ if (!response.ok) {
+ throw new Error('Failed to fetch models');
+ }
+ const data = await response.json(); // Get the JSON response
+
+ console.log("API Response:", data); // Log the response for debugging
+
+ // Check if the response contains a data array
+ if (Array.isArray(data.data)) { // Access the data array
+ data.data.forEach(model => {
+ const option = document.createElement("option");
+ option.value = model.id; // Use the id from the model
+ option.textContent = model.id; // Use the id for display (you can customize this)
+ modelSelect.appendChild(option);
+ });
+ } else {
+ console.error("Expected an array of models, but got:", data);
+ addMessage("Error: Expected an array of models, but got an unexpected response.", "bot");
+ }
+ } catch (error) {
+ console.error("Error fetching models:", error);
+ addMessage("Error fetching models. Please check the console for details.", "bot");
+ }
}
document.addEventListener("DOMContentLoaded", () => {
@@ -292,7 +311,7 @@
if (!userMessage) return;
// Check for slash commands
- if (userMessage.toLowerCase() === '/darkmode') {
+ if (userMessage.toLowerCase() === '/dark' || userMessage.toLowerCase() === '/darkmode') {
toggleDarkMode();
userInput.value = ""; // Clear input after command
updateCounter(); // Reset counters
@@ -313,7 +332,7 @@
return;
}
- if (userMessage.toLowerCase() === '/cat') {
+ if (userMessage.toLowerCase() === '/cat' || userMessage.toLowerCase() === '/catmode') {
toggleCatMode(); // Toggle cat mode
userInput.value = ""; // Clear input after command
updateCounter(); // Reset counters
@@ -475,11 +494,12 @@
function displayHelp() {
const helpMessage = `
- Available commands:\n
- /darkmode - Toggle dark mode
- /cat - Toggle cat mode
- /clear - Clear the chat history
- /help - Show this message
+Available commands:\n
+ /darkmode - Toggle dark mode
+ /cat - Toggle cat mode
+ /context - Show the current conversation's context
+ /clear - Clear the chat history
+ /help - Show this message
`;
addMessage(helpMessage, "bot"); // Display help message as a bot message
}