diff --git a/index.mjs b/index.mjs index 41832e5..10eb2dd 100644 --- a/index.mjs +++ b/index.mjs @@ -13,14 +13,14 @@ import ollama from 'ollama' // Promisify exec for using async/await const execPromise = promisify(exec); -const modelfilePath = "/Volumes/AGI/agi-mf" - const systemSavePath = "/Volumes/AGI/agi-save" const modelID = "local-agsamantha" const maxDepthCount = 11 +let ags_modelfile; + function ask(q) { return new Promise((resolve) => { const rl = readline.createInterface({ @@ -37,14 +37,7 @@ function ask(q) { // Function to run the publishing commands async function runPublishCommands() { try { - // Execute the 'ollama create' command - const createCommand = `ollama create ${modelID} -f ${modelfilePath}`; - //console.log(`Running command: ${createCommand}`); - const { stdout: createStdout, stderr: createStderr } = await execPromise(createCommand); - //console.log('Create Command Output:', createStdout); - if (createStderr) { - console.error('Create Command Error:', createStderr); - } + ollama.create({ model: 'example', modelfile: ags_modelfile }) // Execute the 'ollama push' command //const pushCommand = `killall ollama && ollama push ${modelID}`; @@ -182,7 +175,6 @@ let userAGIInput = ` `; async function generateModelfile(c) { - let ags_modelfile; try { ags_modelfile = await readFile(systemSavePath, { encoding: 'utf8' }) || ags_template_part1; } catch (err) { @@ -196,16 +188,10 @@ async function generateModelfile(c) { } ags_modelfile += createUserContextPart(userAGIInput); await writeFile(systemSavePath, ags_modelfile) - .then(() => {}) .catch(err => { console.error('Error writing file:', err); }); ags_modelfile += ags_template_finalpart; - await writeFile(modelfilePath, ags_modelfile) - .then(() => {}) - .catch(err => { - console.error('Error writing file:', err); - }); return ags_modelfile; } @@ -235,13 +221,13 @@ async function learningLoop() { async function talkLoop() { while (true) { let q = await ask(`To ${modelID}: `); - userAGIInput += ` + userAGIInput += await ` USER: ${q}`; let a = await ollama.chat({ model: `${modelID}`, messages: [{ role: 'user', content: `${q}` }], }); - userAGIInput += ` + userAGIInput += await ` AI: ${a.message.content}`; console.log(`${a.message.content}`);