From 39c93f681237df33352bbecabe6bea72e3a76a7f Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Wed, 23 Sep 2026 17:53:51 +0200 Subject: [PATCH] Replaced cref tags with plain names in the token count docs --- app/MindWork AI Studio/Chat/ContentText.cs | 13 +++++++++---- app/MindWork AI Studio/Chat/ConversationParts.cs | 11 ++++++++--- app/MindWork AI Studio/Chat/ConversationTokens.cs | 4 ++-- .../Provider/IResponseStreamLine.cs | 2 +- .../Provider/OpenAI/ChatCompletionUsage.cs | 2 +- app/MindWork AI Studio/Provider/TokenUsage.cs | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/app/MindWork AI Studio/Chat/ContentText.cs b/app/MindWork AI Studio/Chat/ContentText.cs index c931121d..e8e7f96b 100644 --- a/app/MindWork AI Studio/Chat/ContentText.cs +++ b/app/MindWork AI Studio/Chat/ContentText.cs @@ -63,13 +63,18 @@ public sealed class ContentText : IContent /// exists. Null for every answer written before this was recorded, and at every provider which /// reports nothing. /// - /// Two plain numbers rather than a : that type only ever comes out of - /// its own factory, which is what keeps an impossible usage from existing, and a stored field - /// has to be readable back by the serializer. + /// Two plain numbers rather than a TokenUsage: that type only ever comes out of its own + /// factory, which is what keeps an impossible usage from existing, and a stored field has to be + /// readable back by the serializer. /// public int? ReportedPromptTokens { get; set; } - /// + /// + /// What the provider said the answer itself cost, where it said anything. + /// + /// + /// Stored, kept, and dropped together with ReportedPromptTokens, for the reasons given there. + /// public int? ReportedCompletionTokens { get; set; } /// diff --git a/app/MindWork AI Studio/Chat/ConversationParts.cs b/app/MindWork AI Studio/Chat/ConversationParts.cs index 6db25fb3..f2010b55 100644 --- a/app/MindWork AI Studio/Chat/ConversationParts.cs +++ b/app/MindWork AI Studio/Chat/ConversationParts.cs @@ -61,15 +61,20 @@ public sealed record ConversationParts /// Which of the texts above are the message being written right now. /// /// - /// A marker, not a further part: everything named here also stands in , - /// and counting the parts counts each of them exactly once. It exists because the two halves of + /// A marker, not a further part: everything named here also stands in GrowingTexts, and + /// counting the parts counts each of them exactly once. It exists because the two halves of /// the number answer different questions. What the conversation has cost so far can be had /// exactly, from the provider which charged for it; what is about to be added to it can only be /// estimated. Told as one number, nobody can see which half they are looking at. /// public IReadOnlyList DraftTexts { get; init; } = []; - /// + /// + /// Which of the documents above are attached to the message being written right now. + /// + /// + /// A marker in the same way as DraftTexts: everything named here also stands in Documents. + /// public IReadOnlyList DraftDocuments { get; init; } = []; /// diff --git a/app/MindWork AI Studio/Chat/ConversationTokens.cs b/app/MindWork AI Studio/Chat/ConversationTokens.cs index abb2da1d..17b0277c 100644 --- a/app/MindWork AI Studio/Chat/ConversationTokens.cs +++ b/app/MindWork AI Studio/Chat/ConversationTokens.cs @@ -46,13 +46,13 @@ public readonly record struct ConversationTokens public bool IsEstimate { get; init; } /// - /// How much of is the message being written right now. + /// How much of Tokens is the message being written right now. /// /// /// Kept apart from the rest for the same reason the statements above are kept apart: what the /// conversation has already cost is something a provider can be asked about, while a sentence /// nobody has sent yet can only be estimated. What the conversation costs without it is this - /// subtracted from . + /// subtracted from Tokens. /// public int DraftTokens { get; init; } diff --git a/app/MindWork AI Studio/Provider/IResponseStreamLine.cs b/app/MindWork AI Studio/Provider/IResponseStreamLine.cs index f5b31528..e09e1e71 100644 --- a/app/MindWork AI Studio/Provider/IResponseStreamLine.cs +++ b/app/MindWork AI Studio/Provider/IResponseStreamLine.cs @@ -30,6 +30,6 @@ public interface IResponseStreamLine : IAnnotationStreamLine /// /// Gets what the provider said the request cost. /// - /// The usage, or when the line carries none. + /// The usage, or TokenUsage.UNKNOWN when the line carries none. public TokenUsage GetUsage() => TokenUsage.UNKNOWN; } \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionUsage.cs b/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionUsage.cs index ed9550c8..fbfc99df 100644 --- a/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionUsage.cs +++ b/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionUsage.cs @@ -7,7 +7,7 @@ namespace AIStudio.Provider.OpenAI; /// /// Every number is optional because this is somebody else's JSON: the block arrives only when the /// request asked for it, and the providers which follow the shape loosely leave fields out. Reading -/// it is one thing, believing it another -- decides that. +/// it is one thing, believing it another -- TokenUsage.OfReported decides that. /// public sealed record ChatCompletionUsage { diff --git a/app/MindWork AI Studio/Provider/TokenUsage.cs b/app/MindWork AI Studio/Provider/TokenUsage.cs index 750cfc44..21986d67 100644 --- a/app/MindWork AI Studio/Provider/TokenUsage.cs +++ b/app/MindWork AI Studio/Provider/TokenUsage.cs @@ -73,7 +73,7 @@ public readonly record struct TokenUsage /// /// What the request carried, as the provider stated it. /// What the answer cost, as the provider stated it. - /// The usage, or . + /// The usage, or UNKNOWN. public static TokenUsage OfReported(int? promptTokens, int? completionTokens) => promptTokens is > 0 ? Of(promptTokens.Value, completionTokens is > 0 ? completionTokens.Value : 0)