From c5e4543c9a0ed458962eeb79cb3cc9fef1b6d19f Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Tue, 1 Oct 2024 15:56:38 +0100 Subject: [PATCH] improvements adjust docker file to be less spammy with ENV as defaults work most of the time, add support to adjust how fast the chat AI forgets messages that dont go over the X last messages counter --- Dockerfile | 74 +-------------------- SecondBotEvents/Config/BasicConfig.cs | 2 +- SecondBotEvents/Config/ChatGptConfig.cs | 8 ++- SecondBotEvents/Config/CommandsConfig.cs | 4 +- SecondBotEvents/Config/HttpConfig.cs | 8 +-- SecondBotEvents/Config/InteractionConfig.cs | 4 +- SecondBotEvents/Services/ChatGptService.cs | 2 +- 7 files changed, 17 insertions(+), 85 deletions(-) diff --git a/Dockerfile b/Dockerfile index 100c685..d078971 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,86 +22,20 @@ FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENV basic_Username='' \ +ENV + basic_Username='' \ basic_Password='' \ - basic_LoginURI='secondlife' \ - basic_LogCommands='true' \ - basic_DefaultHoverHeight=0.1 \ commands_AllowFundsCommands='false' \ - commands_AllowIMcontrol='false' \ commands_SharedSecret='examplecode' \ - commands_EnableMasterControls='true' \ commands_MastersCSV='Madpeter Zond' \ - commands_EnforceTimeWindow='false' \ - commands_TimeWindowSecs=35 \ - commands_Enabled='true' \ - commands_ObjectMasterOptout='false' \ - commands_AllowServiceControl='false' \ - datastore_AutoCleanAvatars='true' \ - datastore_AvatarsCleanAfterMins=10 \ - datastore_LocalChatHistoryLimit=120 \ - datastore_GroupChatHistoryLimitPerGroup=50 \ - datastore_ImChatHistoryLimit=50 \ - datastore_PrefetchGroupMembers='true' \ - datastore_PrefetchGroupRoles='false' \ - datastore_PrefetchEstateBanlist='true' \ - datastore_AutoCleanKeyValueStore='true' \ - datastore_CleanKeyValueStoreAfterMins=10 \ - datastore_CommandHistoryLimit=30 \ - discord_Enabled='false' \ - discord_ServerID='' \ - discord_ClientToken='' \ - discord_AllowDiscordCommands='false' \ - discord_hideChatterName='false' \ - events_Enabled='false' \ - events_GroupMemberJoins='false' \ - events_GroupMemberLeaves='false' \ - events_GroupMemberEventsGroupUUID='' \ - events_GuestEntersArea='false' \ - events_GuestLeavesArea='false' \ - events_GuestTrackingSimname='' \ - events_GuestTrackingParcelname='' \ - events_SimAlertMessage='false' \ - events_StatusMessage='false' \ - events_MoneyEvent='false' \ - events_ChangeSim='false' \ - events_ChangeParcel='false' \ - events_OutputChannel=-1 \ - events_OutputIMuuid='00000000-0000-0000-0000-000000000000' \ - events_OutputHttpURL='none' \ - events_OutputSecret='notset' \ homebound_Enabled='false' \ homebound_HomeSimSlUrl='' \ homebound_BackupSimSLUrl='' \ - homebound_AtHomeSeekLocation='false' \ - homebound_AtBackupSeekLocation='false' \ homebound_AtHomeAutoSitUuid='00000000-0000-0000-0000-000000000000' \ - homebound_ReturnToHomeSimAfterMins=5 \ - http_Enabled='false' \ - http_Port=80 \ - interaction_Enabled='true' \ - interaction_AcceptTeleports='false' \ - interaction_AcceptGroupInvites='false' \ - interaction_AcceptInventory='false' \ - interaction_AcceptFriendRequests='false' \ - interaction_EnableJsonOutputEvents='false' \ - interaction_JsonOutputEventsTarget='none' \ interaction_FriendRequestLevel='Owner' \ interaction_InventoryTransferLevel='Owner' \ interaction_GroupInviteLevel=Owner'' \ interaction_TeleportRequestLevel='Owner' \ - commands_HideStatusOutput='false' \ - datastore_HideStatusOutput='false' \ - discord_HideStatusOutput='false' \ - events_HideStatusOutput='false' \ - homebound_HideStatusOutput='false' \ - http_HideStatusOutput='false' \ - interaction_HideStatusOutput='false' \ - rlv_Enabled='false' \ - rlv_HideStatusOutput='false' \ - relay_count='0' \ - relay_HideStatusOutput='false' \ - relay_UseShortEncoder='false' \ chatgpt_Enabled='false' \ chatgpt_ApiKey='none' \ chatgpt_OrganizationId='none' \ @@ -117,9 +51,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' \ - onevent_Enabled='false' \ - onevent_Count=0 \ - onevent_HideStatusOutput='false' + chatgpt_ChatHistoryTimeout='15' \ EXPOSE 80 diff --git a/SecondBotEvents/Config/BasicConfig.cs b/SecondBotEvents/Config/BasicConfig.cs index bdf5322..6bb6c25 100644 --- a/SecondBotEvents/Config/BasicConfig.cs +++ b/SecondBotEvents/Config/BasicConfig.cs @@ -23,7 +23,7 @@ namespace SecondBotEvents.Config } public bool GetLogCommands() { - return ReadSettingAsBool("LogCommands"); + return ReadSettingAsBool("LogCommands", true); } public string GetUsername() { diff --git a/SecondBotEvents/Config/ChatGptConfig.cs b/SecondBotEvents/Config/ChatGptConfig.cs index d3d14eb..e95070a 100644 --- a/SecondBotEvents/Config/ChatGptConfig.cs +++ b/SecondBotEvents/Config/ChatGptConfig.cs @@ -24,9 +24,15 @@ namespace SecondBotEvents.Config settings.Add("UseModel"); settings.Add("ChatHistoryMessages"); settings.Add("ChatPrompt"); + settings.Add("ChatHistoryTimeout"); settings.Add("Provider"); } + public int GetChatHistoryTimeout() + { + return ReadSettingAsInt("ChatHistoryTimeout", 15); + } + public string GetProvider() { return ReadSettingAsString("Provider", "openai"); @@ -59,7 +65,7 @@ namespace SecondBotEvents.Config } public bool GetEnabled() { - return ReadSettingAsBool("Enabled"); + return ReadSettingAsBool("Enabled", false); } public string GetApiKey() { diff --git a/SecondBotEvents/Config/CommandsConfig.cs b/SecondBotEvents/Config/CommandsConfig.cs index 1f2b6ca..6ce6c6f 100644 --- a/SecondBotEvents/Config/CommandsConfig.cs +++ b/SecondBotEvents/Config/CommandsConfig.cs @@ -54,7 +54,7 @@ namespace SecondBotEvents.Config public bool GetEnableMasterControls() { - return ReadSettingAsBool("EnableMasterControls", false); + return ReadSettingAsBool("EnableMasterControls", true); } @@ -65,7 +65,7 @@ namespace SecondBotEvents.Config public bool GetAllowIMcontrol() { - return ReadSettingAsBool("AllowIMcontrol", false); + return ReadSettingAsBool("AllowIMcontrol", true); } public string GetSharedSecret() diff --git a/SecondBotEvents/Config/HttpConfig.cs b/SecondBotEvents/Config/HttpConfig.cs index 2d8b129..a85af31 100644 --- a/SecondBotEvents/Config/HttpConfig.cs +++ b/SecondBotEvents/Config/HttpConfig.cs @@ -11,18 +11,12 @@ namespace SecondBotEvents.Config { filename = "http"; settings.Add("Enabled"); - settings.Add("Port"); settings.Add("HideStatusOutput"); } - public int GetPort() - { - return ReadSettingAsInt("Port", 80); - } - public bool GetEnabled() { - return ReadSettingAsBool("Enabled", false); + return ReadSettingAsBool("Enabled", true); } } diff --git a/SecondBotEvents/Config/InteractionConfig.cs b/SecondBotEvents/Config/InteractionConfig.cs index 729cb69..991094a 100644 --- a/SecondBotEvents/Config/InteractionConfig.cs +++ b/SecondBotEvents/Config/InteractionConfig.cs @@ -48,7 +48,7 @@ namespace SecondBotEvents.Config public bool GetAcceptTeleports() { - return ReadSettingAsBool("AcceptTeleports", false); + return ReadSettingAsBool("AcceptTeleports", true); } public bool GetAcceptGroupInvites() @@ -73,7 +73,7 @@ namespace SecondBotEvents.Config public bool GetEnableJsonOutputEvents() { - return ReadSettingAsBool("EnableJsonOutputEvents", true); + return ReadSettingAsBool("EnableJsonOutputEvents", false); } } diff --git a/SecondBotEvents/Services/ChatGptService.cs b/SecondBotEvents/Services/ChatGptService.cs index 4e42744..9a7c309 100644 --- a/SecondBotEvents/Services/ChatGptService.cs +++ b/SecondBotEvents/Services/ChatGptService.cs @@ -208,7 +208,7 @@ namespace SecondBotEvents.Services foreach (KeyValuePair entry in ChatHistoryLastAccessed) { dif = now - entry.Value; - if(dif > (7*60)) + if(dif > (myConfig.GetChatHistoryTimeout()*60)) { needcleaning.Add(entry.Key); }