new file: newnewnewver.js
modified: newver.js
This commit is contained in:
10
newver.js
10
newver.js
@@ -37,11 +37,11 @@ function googleSearch(args) {
|
||||
return `Starting google search for ${args.query}, please wait a few minutes`;
|
||||
}
|
||||
|
||||
async function googleResult(query) {
|
||||
function googleResult(query) {
|
||||
const result = "hatsune miku";
|
||||
|
||||
messageHistory.push({ role: "tool", content: `googleSearch: ${result}` });
|
||||
await getResponse();
|
||||
getResponse();
|
||||
}
|
||||
|
||||
const availableFunctions = {
|
||||
@@ -147,14 +147,12 @@ async function handleToolCall(toolCalls) {
|
||||
}
|
||||
|
||||
try {
|
||||
// Execute the tool function
|
||||
console.log(`Calling function: ${name}`);
|
||||
console.log(`Arguments:`, args);
|
||||
|
||||
const output = await functionToCall(args);
|
||||
console.log(`Function output: ${output}`);
|
||||
|
||||
// Update message history with tool output
|
||||
messageHistory.push({ role: "tool", content: `${name}: ${output}` });
|
||||
|
||||
} catch (error) {
|
||||
@@ -163,7 +161,6 @@ async function handleToolCall(toolCalls) {
|
||||
}
|
||||
}
|
||||
|
||||
// Process follow-up responses from the model after all tool calls are executed
|
||||
await getResponse();
|
||||
}
|
||||
|
||||
@@ -175,8 +172,6 @@ async function getResponse() {
|
||||
});
|
||||
messageHistory.push(response.message);
|
||||
|
||||
|
||||
// Handle additional tool calls, if any
|
||||
if (response.message.tool_calls) {
|
||||
await handleToolCall(response.message.tool_calls);
|
||||
} else {
|
||||
@@ -187,6 +182,7 @@ async function getResponse() {
|
||||
|
||||
async function runModel() {
|
||||
messageHistory.push({ role: "system", content: "You are Nyamma, a cheerful and cute anime character with a playful, cat-like personality. You often use adorable expressions like \"nya~\" and love making others smile. You’re kind-hearted, energetic, and always eager to help, but can also be a bit mischievous in a charming way. You speak in a light, bubbly tone and sometimes mix in cat-like sounds, especially when you're excited or curious." });
|
||||
|
||||
//while (true) {
|
||||
try {
|
||||
//const userMessage = await getUserInput();
|
||||
|
||||
Reference in New Issue
Block a user