mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 18:53:48 +00:00
Check image counts against the limits vendors state
This commit is contained in:
10 files changed
+561
-283
No files matched your search
@@ -35,4 +35,21 @@ public readonly record struct ImageLimits(int? MaxPerMessage, int? MaxPerRequest
|
||||
/// Whether either of the two numbers is known.
|
||||
/// </summary>
|
||||
public bool IsKnown => this.MaxPerMessage.HasValue || this.MaxPerRequest.HasValue;
|
||||
|
||||
/// <summary>
|
||||
/// How many images may travel in one message, as far as anybody has said.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A message is part of a request, so a message cannot carry more than a whole request may --
|
||||
/// whichever of the two numbers is smaller decides, and a number nobody stated does not decide
|
||||
/// anything. Null means nobody stated either, which is a gap and never a limit of zero.
|
||||
/// </remarks>
|
||||
public int? MaxInOneMessage => (this.MaxPerMessage, this.MaxPerRequest) switch
|
||||
{
|
||||
({ } perMessage, { } perRequest) => Math.Min(perMessage, perRequest),
|
||||
({ } perMessage, null) => perMessage,
|
||||
(null, { } perRequest) => perRequest,
|
||||
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user