Added guidelines from the organization to the BeyondFacts Lab (#1204)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-15 11:40:15 +01:00
1 parent cb54ad297d
commit 1361b984eb
38 files changed
+967 -255

No files matched your search

@@ -523,6 +523,7 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
ManagedConfiguration.TryProcessConfiguration(x => x.BeyondFactsLab, x => x.PreselectedProvider, Guid.Empty, this.Id, settingsTable, dryRun);
ManagedConfiguration.TryProcessConfiguration(x => x.BeyondFactsLab, x => x.MinimumProviderConfidence, this.Id, settingsTable, dryRun);
ManagedConfiguration.TryProcessConfiguration(x => x.BeyondFactsLab, x => x.AllowPromptOverrides, this.Id, settingsTable, dryRun);
ManagedConfiguration.TryProcessConfiguration(x => x.BeyondFactsLab, x => x.OrganizationRules, this.Id, settingsTable, dryRun, convert: text => this.CheckBeyondFactsLabRules(text, dryRun));
// Config: Model Comparison defaults?
ManagedConfiguration.TryProcessConfiguration(x => x.ModelComparison, x => x.PreselectOptions, this.Id, settingsTable, dryRun);
@@ -584,6 +585,25 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
return null;
}
/// <summary>
/// Checks the notes this plugin sets for public appearances in the BeyondFacts Lab: with LF line breaks, without
/// spaces around them, and no longer than the lab takes.
/// </summary>
/// <param name="text">The notes as the plugin wrote them.</param>
/// <param name="dryRun">Whether this is the dry run, which comes before the actual one and reports nothing.</param>
/// <returns>The notes to store, or null when they are too long, which leaves the lab without notes of this plugin.</returns>
private string? CheckBeyondFactsLabRules(string text, bool dryRun)
{
var rules = text.ReplaceLineEndings("\n").Trim();
if (rules.Length <= DataBeyondFactsLab.ORGANIZATION_RULES_MAX_CHARACTERS)
return rules;
if (!dryRun)
LOG.LogWarning("The configuration plugin '{PluginName}' sets notes of {Characters} characters for the BeyondFacts Lab, which takes at most {MaxCharacters}. Ignoring them.", this.Name, rules.Length, DataBeyondFactsLab.ORGANIZATION_RULES_MAX_CHARACTERS);
return null;
}
private static bool TryValidateMinimumProviderConfidenceConfiguration(LuaTable settingsTable, out string message)
{
const string SETTING_NAME = "DataTools.MinimumProviderConfidenceByToolId";