modified: newver.js
This commit is contained in:
36
newver.js
36
newver.js
@@ -4,14 +4,14 @@ const { Ollama } = require("ollama");
|
||||
const clc = require("cli-color");
|
||||
const fs = require('fs');
|
||||
|
||||
const ollama = new Ollama({ host: "http://127.0.0.1:11434" });
|
||||
const discordHook = new Webhook("https://discord.com/api/webhooks/1328616300544786444/oCwaJ1HQW_Hk0_BQB6lWfuLSikhGOzEJqaOr37MNb6lkICk0Bllk7izVPdmXHKm1JhAN");
|
||||
|
||||
const modelName = "qwen2.5:7b";
|
||||
const sessionName = modelName.replace(".", "").replace(":", "")//+ "_" + (Math.floor(new Date().getTime() / 1000)).toString();
|
||||
|
||||
const messageHistory = [];
|
||||
|
||||
const ollama = new Ollama({ host: "http://127.0.0.1:11434" });
|
||||
const discordHook = new Webhook("https://discord.com/api/webhooks/1328616300544786444/oCwaJ1HQW_Hk0_BQB6lWfuLSikhGOzEJqaOr37MNb6lkICk0Bllk7izVPdmXHKm1JhAN");
|
||||
|
||||
function discordMessage(args) {
|
||||
try {
|
||||
discordHook.setUsername("@Nyamma");
|
||||
@@ -31,10 +31,23 @@ function getRandomQuote(args) {
|
||||
}
|
||||
|
||||
|
||||
function googleSearch(args) {
|
||||
return new Promise((resolve) => {
|
||||
console.log("Starting Google search...");
|
||||
setTimeout(() => {
|
||||
const searchResult = `Hatsune Miku, the virtual Diva`;
|
||||
console.log("Google search complete:", searchResult);
|
||||
resolve(searchResult);
|
||||
}, 10000); // Simulate 5 seconds delay
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const availableFunctions = {
|
||||
sendMessage: discordMessage,
|
||||
getRandomCharacter: getRandomCharacter,
|
||||
getRandomQuote: getRandomQuote
|
||||
getRandomQuote: getRandomQuote,
|
||||
googleSearch: googleSearch
|
||||
}
|
||||
|
||||
const availableTools = [
|
||||
@@ -79,9 +92,24 @@ const availableTools = [
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
function: {
|
||||
name: 'googleSearch',
|
||||
description: 'Search in google for a query, this might take som undefined amount of time so, wait for a late response',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
required: ['query'],
|
||||
properties: {
|
||||
query: { type: 'string', description: 'Query to search for' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
async function getUserInput() {
|
||||
return new Promise((resolve) => {
|
||||
const rl = readline.createInterface({
|
||||
|
||||
Reference in New Issue
Block a user