removing non needed code
This commit is contained in:
parent
2924822a49
commit
8ce9e18656
128
llamabot.js
128
llamabot.js
@ -290,79 +290,75 @@ async function generateResponse(conversation, message) {
|
||||
|
||||
if (process.env.GPU == 1) {
|
||||
smi(function (err, data) {
|
||||
if (err) {
|
||||
// Handle error if smi function fails
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
let utilization = data.nvidia_smi_log.gpu.utilization;
|
||||
let gpuUtilization = utilization.gpu_util;
|
||||
let memoryUtilization = utilization.memory_util;
|
||||
let gpuTemp = data.nvidia_smi_log.gpu.temperature.gpu_temp;
|
||||
|
||||
// These are not used until nvidia-docker fixes their support
|
||||
let gpuTarget = data.nvidia_smi_log.gpu.temperature.gpu_target_temperature;
|
||||
let gpuFanSpeed = data.nvidia_smi_log.gpu.fan_speed;
|
||||
|
||||
let filedsData = [
|
||||
{
|
||||
name: 'System Load',
|
||||
value: `${systemLoad.toFixed(2)}%`,
|
||||
},
|
||||
{
|
||||
name: 'Memory Usage',
|
||||
value: `${usedMemory.toFixed(2)} GB / ${totalMemory.toFixed(2)} GB`,
|
||||
},
|
||||
{
|
||||
name: 'GPU Utilization',
|
||||
value: `${gpuUtilization}`,
|
||||
},
|
||||
{
|
||||
name: 'Memory Utilization',
|
||||
value: `${memoryUtilization}`,
|
||||
},
|
||||
{
|
||||
name: 'GPU Temperature',
|
||||
value: `${gpuTemp}`,
|
||||
},
|
||||
{
|
||||
name: 'Time',
|
||||
value: `~${time} seconds.`,
|
||||
},
|
||||
];
|
||||
|
||||
const embedData = {
|
||||
if (err) {
|
||||
// Handle error if smi function fails
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
let utilization = data.nvidia_smi_log.gpu.utilization;
|
||||
let gpuUtilization = utilization.gpu_util;
|
||||
let memoryUtilization = utilization.memory_util;
|
||||
let gpuTemp = data.nvidia_smi_log.gpu.temperature.gpu_temp;
|
||||
|
||||
// These are not used until nvidia-docker fixes their support
|
||||
let gpuTarget = data.nvidia_smi_log.gpu.temperature.gpu_target_temperature;
|
||||
let gpuFanSpeed = data.nvidia_smi_log.gpu.fan_speed;
|
||||
|
||||
let filedsData = [
|
||||
{
|
||||
name: 'System Load',
|
||||
value: `${systemLoad.toFixed(2)}%`,
|
||||
},
|
||||
{
|
||||
name: 'Memory Usage',
|
||||
value: `${usedMemory.toFixed(2)} GB / ${totalMemory.toFixed(2)} GB`,
|
||||
},
|
||||
{
|
||||
name: 'GPU Utilization',
|
||||
value: `${gpuUtilization}`,
|
||||
},
|
||||
{
|
||||
name: 'Memory Utilization',
|
||||
value: `${memoryUtilization}`,
|
||||
},
|
||||
{
|
||||
name: 'GPU Temperature',
|
||||
value: `${gpuTemp}`,
|
||||
},
|
||||
{
|
||||
name: 'Time',
|
||||
value: `~${time} seconds.`,
|
||||
},
|
||||
];
|
||||
|
||||
const embedData = {
|
||||
color: 0x0099ff,
|
||||
title: 'Please wait.. I am thinking...',
|
||||
fields: filedsData,
|
||||
};
|
||||
|
||||
// if the message object doesn't exist, create it
|
||||
if (!botMessage) {
|
||||
botMessage = message.channel.send({ embeds: [embedData] });
|
||||
} else {
|
||||
botMessage.edit({ embeds: [embedData] }); // otherwise, update the message
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const embedData = {
|
||||
color: 0x0099ff,
|
||||
title: 'Please wait.. I am thinking...',
|
||||
fields: filedsData,
|
||||
};
|
||||
|
||||
// if the message object doesn't exist, create it
|
||||
if (!botMessage) {
|
||||
(async () => {
|
||||
botMessage = await message.channel.send({ embeds: [embedData] });
|
||||
})();
|
||||
} else {
|
||||
botMessage.edit({ embeds: [embedData] }); // otherwise, update the message
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const embedData = {
|
||||
color: 0x0099ff,
|
||||
title: 'Please wait.. I am thinking...',
|
||||
fields: filedsData, // It seems like a typo, it should be `filedsData` instead of `filedsData`
|
||||
fields: filedsData, // It seems like a typo, it should be `filedsData` instead of `filedsData`
|
||||
};
|
||||
|
||||
|
||||
// if the message object doesn't exist, create it
|
||||
if (!botMessage) {
|
||||
(async () => {
|
||||
botMessage = await message.channel.send({ embeds: [embedData] });
|
||||
})();
|
||||
botMessage = message.channel.send({ embeds: [embedData] });
|
||||
} else {
|
||||
botMessage.edit({ embeds: [embedData] }); // otherwise, update the message
|
||||
botMessage.edit({ embeds: [embedData] }); // otherwise, update the message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user