mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Add the option to disable OpenAI moderation for Nora
This commit is contained in:
@@ -110,6 +110,10 @@ public class NoraCommand : ICommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 1: Moderate the content
|
// Step 1: Moderate the content
|
||||||
|
var moderationEnabled =
|
||||||
|
(await SettingsProvider.GetValueAsync(BuiltIn.Keys.OpenAiModerationEnabled)).ToBoolean();
|
||||||
|
if (moderationEnabled)
|
||||||
|
{
|
||||||
var moderationResult = await OpenAiModeration.ModerateContentAsync(userMessage);
|
var moderationResult = await OpenAiModeration.ModerateContentAsync(userMessage);
|
||||||
|
|
||||||
if (moderationResult == null)
|
if (moderationResult == null)
|
||||||
@@ -136,6 +140,7 @@ public class NoraCommand : ICommand
|
|||||||
{
|
{
|
||||||
Logger.Info($"User {user.KfUsername} sent flagged but allowed content (profanity/offensive): {userMessage}");
|
Logger.Info($"User {user.KfUsername} sent flagged but allowed content (profanity/offensive): {userMessage}");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Step 2: Build conversation context and get Grok AI response
|
// Step 2: Build conversation context and get Grok AI response
|
||||||
var basePrompt = (await SettingsProvider.GetValueAsync(BuiltIn.Keys.GrokNoraPrompt)).Value;
|
var basePrompt = (await SettingsProvider.GetValueAsync(BuiltIn.Keys.GrokNoraPrompt)).Value;
|
||||||
|
|||||||
@@ -557,6 +557,8 @@ public static class BuiltIn
|
|||||||
public static string ShuffleBmjUserId = "Shuffle.BmjUserId";
|
public static string ShuffleBmjUserId = "Shuffle.BmjUserId";
|
||||||
[BuiltInSetting("Bossman's current VIP level for reducing GraphQL hits", SettingValueType.Text, "SAPPHIRE_5")]
|
[BuiltInSetting("Bossman's current VIP level for reducing GraphQL hits", SettingValueType.Text, "SAPPHIRE_5")]
|
||||||
public static string ShuffleBmjVipLevel = "Shuffle.BmjVipLevel";
|
public static string ShuffleBmjVipLevel = "Shuffle.BmjVipLevel";
|
||||||
|
[BuiltInSetting("Whether OpenAI moderation is enabled", SettingValueType.Boolean, "false", BooleanRegex)]
|
||||||
|
public static string OpenAiModerationEnabled = "OpenAI.ModerationEnabled";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user