Better Logging

This commit is contained in:
Raven Scott 2023-04-03 03:11:54 +02:00
parent 8a7e985b59
commit 0f507fb98a
4 changed files with 10 additions and 10 deletions

View File

@ -51,7 +51,7 @@ module.exports = {
headers
});
console.log(response.data.answer);
console.log(`Prompt: ${prompt.replace("+", " ")}\nResponse: ${response.data.answer}`);
interaction.editReply(response.data.answer);
} catch (err) {

View File

@ -52,6 +52,8 @@ module.exports = {
],
run: async (client, interaction) => {
console.log(`--- ${interaction.user.id} has requested a new session! ---`)
const file = './cache/' + interaction.user.id
let options = interaction.options._hoistedOptions;
@ -85,6 +87,7 @@ module.exports = {
console.log("-- No init-prompt provided, using default --");
} else {
initPrompt = userInputInitPrompt;
console.log(`User set initPrompt to ${initPrompt}`)
}
// Modal Setting
@ -93,6 +96,7 @@ module.exports = {
} else {
if (modelList.includes(userInputModel)) {
model = userInputModel;
console.log(`User set initPrompt to ${model}`)
} else {
let modelListStr = modelList.join(", ");
return interaction.followUp(`You may only use one of the following: ${modelListStr}`);
@ -107,6 +111,8 @@ module.exports = {
if (parsedTemperature >= 0.1 && parsedTemperature <= 2) {
// temperature is within range
temperature = parsedTemperature;
console.log(`User set temperature to ${temperature}`)
} else {
// temperature is outside of range
return interaction.followUp(`Temperature must be between 0.1 and 2`);
@ -121,6 +127,7 @@ module.exports = {
if (parsedRepeatPenalty >= 0.1 && parsedRepeatPenalty <= 2) {
// RepeatPenalty is within range
repeatPenalty = parsedRepeatPenalty;
console.log(`User set repeatPenalty to ${repeatPenalty}`)
} else {
// RepeatPenalty is outside of range
return interaction.followUp(`Repeat Penalty must be between 0.1 and 2`);
@ -133,9 +140,6 @@ module.exports = {
})
.send('')
.end(function (response) {
console.log(response.body);
const obj = { id: response.body }
jsonfile.writeFile(file, obj, function (err) {
@ -149,8 +153,7 @@ module.exports = {
.setTimestamp()
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
interaction.followUp({ embeds: [embed] });
console.log(`--- Session created for ${interaction.user.id} ---`)
});
}
};

View File

@ -41,9 +41,7 @@ module.exports = {
password: process.env.PASS
}
});
console.log(response.data)
if (!response.data.questions) return interaction.editReply("You have no history in this session yet :) ");
const result = parseQuestionsAndAnswers(JSON.stringify(response.data));

View File

@ -49,7 +49,6 @@ client.on("interactionCreate", async (interaction) => {
let parsedData = JSON.parse(dataToProcess)
// If the command is private, set ephemeral true else, set false
console.log(parsedData)
if (parsedData.private == true) {
await interaction.deferReply({
ephemeral: true