mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 19:13:48 +00:00
Rework of the file export (#894)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
f14c69b938
commit
c66a61713d
33 files changed
+1212
-266
No files matched your search
@@ -17,4 +17,27 @@ public static class IContentExtensions
|
||||
content.StreamingEvent = IContent.NO_STREAMING_HANDLER;
|
||||
content.StreamingDone = IContent.NO_STREAMING_HANDLER;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads this content as the Markdown text the AI produced.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only text content carries Markdown. Everything else, an image for example, has no text
|
||||
/// representation at all, which is why this reports failure instead of returning a placeholder:
|
||||
/// a caller which writes files must not put an excuse into the file it writes.
|
||||
/// </remarks>
|
||||
/// <param name="content">The content to read.</param>
|
||||
/// <param name="markdown">The Markdown text, or an empty string when there is none.</param>
|
||||
/// <returns>True, when this content carries Markdown text.</returns>
|
||||
public static bool TryGetMarkdownText(this IContent content, out string markdown)
|
||||
{
|
||||
if (content is ContentText text)
|
||||
{
|
||||
markdown = text.Text;
|
||||
return true;
|
||||
}
|
||||
|
||||
markdown = string.Empty;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user