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