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 headers
}); });
console.log(response.data.answer); console.log(`Prompt: ${prompt.replace("+", " ")}\nResponse: ${response.data.answer}`);
interaction.editReply(response.data.answer); interaction.editReply(response.data.answer);
} catch (err) { } catch (err) {

View File

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

View File

@ -42,8 +42,6 @@ module.exports = {
} }
}); });
console.log(response.data)
if (!response.data.questions) return interaction.editReply("You have no history in this session yet :) "); if (!response.data.questions) return interaction.editReply("You have no history in this session yet :) ");
const result = parseQuestionsAndAnswers(JSON.stringify(response.data)); const result = parseQuestionsAndAnswers(JSON.stringify(response.data));

View File

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