diff --git a/Dockerfile b/Dockerfile
index e8af814..100c685 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -113,7 +113,7 @@ ENV basic_Username='' \
chatgpt_GroupReplyRateLimiter='3' \
chatgpt_LocalchatReply='false' \
chatgpt_LocalchatRateLimiter='3' \
- chatgpt_UseModel='gpt3' \
+ chatgpt_UseModel='gpt-3.5-turbo' \
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' \
diff --git a/LibreMetaverse/LibreMetaverse.csproj b/LibreMetaverse/LibreMetaverse.csproj
index e79a5e0..e7faecc 100644
--- a/LibreMetaverse/LibreMetaverse.csproj
+++ b/LibreMetaverse/LibreMetaverse.csproj
@@ -43,7 +43,7 @@
True
-
+
diff --git a/SecondBotEvents/Config/ChatGptConfig.cs b/SecondBotEvents/Config/ChatGptConfig.cs
index ed9749b..d3d14eb 100644
--- a/SecondBotEvents/Config/ChatGptConfig.cs
+++ b/SecondBotEvents/Config/ChatGptConfig.cs
@@ -24,6 +24,12 @@ namespace SecondBotEvents.Config
settings.Add("UseModel");
settings.Add("ChatHistoryMessages");
settings.Add("ChatPrompt");
+ settings.Add("Provider");
+ }
+
+ public string GetProvider()
+ {
+ return ReadSettingAsString("Provider", "openai");
}
public string GetChatPrompt()
@@ -49,7 +55,7 @@ namespace SecondBotEvents.Config
}
public string GetUseModel()
{
- return ReadSettingAsString("UseModel", "gpt3");
+ return ReadSettingAsString("UseModel", "gpt-3.5-turbo");
}
public bool GetEnabled()
{
diff --git a/SecondBotEvents/SecondBotEvents.csproj b/SecondBotEvents/SecondBotEvents.csproj
index a234a8f..d49678e 100644
--- a/SecondBotEvents/SecondBotEvents.csproj
+++ b/SecondBotEvents/SecondBotEvents.csproj
@@ -13,18 +13,18 @@
-
-
-
+
+
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/SecondBotEvents/Services/ChatGptService.cs b/SecondBotEvents/Services/ChatGptService.cs
index ec00633..9d91bf8 100644
--- a/SecondBotEvents/Services/ChatGptService.cs
+++ b/SecondBotEvents/Services/ChatGptService.cs
@@ -17,6 +17,7 @@ using OpenAI.ObjectModels.RequestModels;
using OpenAI.ObjectModels;
using OpenAI.ObjectModels.ResponseModels;
using System.Threading.Tasks;
+using OpenAI.Interfaces;
namespace SecondBotEvents.Services
{
@@ -332,38 +333,32 @@ namespace SecondBotEvents.Services
Organization = myConfig.GetOrganizationId(),
});
}
+ if(myConfig.GetProvider() != "openai")
+ {
+ openAiService = new OpenAIService(new OpenAiOptions()
+ {
+ ApiKey = myConfig.GetApiKey(),
+ Organization = myConfig.GetOrganizationId(),
+ BaseDomain= myConfig.GetProvider(),
+ });
+ }
ChatCompletionCreateResponse completionResult = null;
- if (myConfig.GetUseModel() == "gpt3")
+ if (myConfig.GetProvider() != "openai")
{
completionResult = await openAiService.ChatCompletion.CreateCompletion(new ChatCompletionCreateRequest
{
Messages = messages,
- Model = Models.Gpt_3_5_Turbo
+ Model = myConfig.GetUseModel(),
});
}
- else if (myConfig.GetUseModel() == "gpt-3.5-turbo")
+ else
{
completionResult = await openAiService.ChatCompletion.CreateCompletion(new ChatCompletionCreateRequest
{
Messages = messages,
- Model = Models.Gpt_3_5_Turbo
- });
- }
- else if(myConfig.GetUseModel() == "gpt-4-mini")
- {
- completionResult = await openAiService.ChatCompletion.CreateCompletion(new ChatCompletionCreateRequest
- {
- Messages = messages,
- Model = Models.Gpt_4o_mini
- });
- }
- else if (myConfig.GetUseModel() == "gpt-4-turbo")
- {
- completionResult = await openAiService.ChatCompletion.CreateCompletion(new ChatCompletionCreateRequest
- {
- Messages = messages,
- Model = Models.Gpt_4_turbo
+ Model = openAI_Models.GetModel(myConfig.GetUseModel())
});
+
}
if(completionResult == null)
{
@@ -475,4 +470,24 @@ namespace SecondBotEvents.Services
LogFormater.Info("ChatGpt [accepting chat input]");
}
}
+
+ public class openAI_Models
+ {
+ public static string GetModel(string input)
+ {
+ if (input == "gpt-3.5-turbo")
+ {
+ return Models.Gpt_3_5_Turbo;
+ }
+ else if (input == "gpt-4-mini")
+ {
+ return Models.Gpt_4o_mini;
+ }
+ else if (input == "gpt-4-turbo")
+ {
+ return Models.Gpt_4_turbo;
+ }
+ return input;
+ }
+ }
}