Files
h-school/src/HSchool.Content/PromptContribution.cs
T
Leonid PershinandCursor 3c682a2b74 Add scene fragments to portrait prompts after clothing.
Thing, room, yard and climate precipitation can contribute a short prompt when they are in frame, with a budget so chairs stay silent.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 23:35:17 +03:00

62 lines
1.8 KiB
C#

namespace HSchool.Content;
/// <summary>One LoRA or embedding a scene def may add to a portrait. Empty name is ignored.</summary>
public sealed class PromptLoraRef
{
public string Name { get; init; } = "";
public float Weight { get; init; } = 1f;
}
/// <summary>
/// Optional portrait-prompt fragment on a thing, room, yard or precipitation. Missing or empty
/// means the def is silent — a chair does not name itself in the prompt.
/// </summary>
public sealed class PromptContribution
{
public string Positive { get; init; } = "";
public string Negative { get; init; } = "";
public float Weight { get; init; } = 1f;
public IReadOnlyList<PromptLoraRef> PositiveLoras { get; init; } = [];
public IReadOnlyList<PromptLoraRef> NegativeLoras { get; init; } = [];
public IReadOnlyList<PromptLoraRef> PositiveEmbeddings { get; init; } = [];
public IReadOnlyList<PromptLoraRef> NegativeEmbeddings { get; init; } = [];
public bool IsSilent =>
string.IsNullOrWhiteSpace(Positive)
&& string.IsNullOrWhiteSpace(Negative)
&& !HasNamed(PositiveLoras)
&& !HasNamed(NegativeLoras)
&& !HasNamed(PositiveEmbeddings)
&& !HasNamed(NegativeEmbeddings);
private static bool HasNamed(IReadOnlyList<PromptLoraRef> entries)
{
foreach (var entry in entries)
{
if (!string.IsNullOrWhiteSpace(entry.Name))
{
return true;
}
}
return false;
}
}
/// <summary>Clear / rain / snow fragments on a climate preset. Outdoor portraits pick one.</summary>
public sealed class ClimatePromptSet
{
public PromptContribution? Clear { get; init; }
public PromptContribution? Rain { get; init; }
public PromptContribution? Snow { get; init; }
}