add option to show debug messages for AI chat
This commit is contained in:
parent
2d13cca7b3
commit
28a743ebc0
3 changed files with 16 additions and 3 deletions
|
|
@ -117,6 +117,7 @@ ENV basic_Username='' \
|
|||
chatgpt_ChatHistoryMessages='5' \
|
||||
chatgpt_ChatPrompt='respond as if you are a horse that knows its going to the glue factory and you are upset about this fact' \
|
||||
chatgpt_Provider='openai' \
|
||||
chatgtp_ShowDebug='false' \
|
||||
onevent_Enabled='false' \
|
||||
onevent_Count=0 \
|
||||
chatgpt_ChatHistoryTimeout='15' \
|
||||
|
|
|
|||
|
|
@ -25,9 +25,15 @@ namespace SecondBotEvents.Config
|
|||
settings.Add("ChatHistoryMessages");
|
||||
settings.Add("ChatPrompt");
|
||||
settings.Add("ChatHistoryTimeout");
|
||||
settings.Add("ShowDebug");
|
||||
settings.Add("Provider");
|
||||
}
|
||||
|
||||
public bool GetShowDebug()
|
||||
{
|
||||
return ReadSettingAsBool("ShowDebug", false);
|
||||
}
|
||||
|
||||
public int GetChatHistoryTimeout()
|
||||
{
|
||||
return ReadSettingAsInt("ChatHistoryTimeout", 15);
|
||||
|
|
|
|||
|
|
@ -309,9 +309,12 @@ namespace SecondBotEvents.Services
|
|||
else if (role == "assistant") messages.Add(ChatMessage.FromAssistant(thismessage));
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
//LogFormater.Warn("error building AI request:" + ex.Message);
|
||||
if (myConfig.GetShowDebug() == true)
|
||||
{
|
||||
LogFormater.Warn("error building AI request:" + ex.Message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +416,10 @@ namespace SecondBotEvents.Services
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogFormater.Warn("An error occurred: " + ex.Message);
|
||||
if (myConfig.GetShowDebug() == true)
|
||||
{
|
||||
LogFormater.Warn("An error occurred:" + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue