diff --git a/apps/ollama/ollama.js b/apps/ollama/ollama.js index bddd9ec..9fc6dba 100644 --- a/apps/ollama/ollama.js +++ b/apps/ollama/ollama.js @@ -1,5 +1,5 @@ /* - * Copyright 2024 Inclusive Design Research Centre, OCAD University + * Copyright 2024-2026 Inclusive Design Research Centre, OCAD University * All rights reserved. * * Licensed under the New BSD license. You may not use this file except in @@ -8,31 +8,13 @@ * You may obtain a copy of the License at * https://github.com/inclusive-design/adaptive-palette/blob/main/LICENSE */ - -import ollama from "ollama/browser"; +import { getModelNames, queryChat } from "../../src/client/ollamaApi"; // Default name of model used (aka, none). Set in setSelectedModel() handler. let nameOfModelToUse = ""; const USE_ALL_MODELS = "useAllModels"; const NO_AVAILABLE_MODELS = "No Available Models"; - -/** - * Retrieve a list of LLMs available from the service - * @return {Array} - Array of the names of the available models. - */ -async function getModelNames () { - let modelNames = []; - try { - const list = await ollama.list(); - list.models.forEach( (model) => { - modelNames.push(model.name); - }); - } - catch (error) { - console.debug(error); - } - return modelNames; -} +const STREAM_RESPONSE = true; /** * Initialize the model and the