mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 03:53:47 +00:00
Rename message tables to message files
This commit is contained in:
5 files changed
+24
-24
No files matched your search
+2
-2
@@ -1,7 +1,7 @@
|
||||
namespace AIStudio.Tools;
|
||||
|
||||
/// <summary>
|
||||
/// A table found in a message, ready to be written to a file.
|
||||
/// A file found in a message, ready to be written: a table the model wrote.
|
||||
/// </summary>
|
||||
/// <param name="Ordinal">Which table of the message this is, counting from one. The same table
|
||||
/// appears once per format we offer for it, so this is what tells two tables apart even when they
|
||||
@@ -9,4 +9,4 @@ namespace AIStudio.Tools;
|
||||
/// <param name="Caption">What the table is about, taken from its first column heading.</param>
|
||||
/// <param name="Format">The format this content is written as.</param>
|
||||
/// <param name="Content">The finished file content.</param>
|
||||
public sealed record MessageTable(int Ordinal, string Caption, FileExportFormat Format, string Content);
|
||||
public sealed record MessageFile(int Ordinal, string Caption, FileExportFormat Format, string Content);
|
||||
@@ -27,7 +27,7 @@ public static class PlainFileExport
|
||||
/// <param name="markdown">The Markdown text of the message.</param>
|
||||
/// <param name="separator">The separator to write a Markdown table with, see CsvWriter.SeparatorFor.</param>
|
||||
/// <returns>The tables, or an empty list when the message holds none.</returns>
|
||||
public static IReadOnlyList<MessageTable> ExtractTables(string markdown, char separator)
|
||||
public static IReadOnlyList<MessageFile> ExtractFiles(string markdown, char separator)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(markdown))
|
||||
return [];
|
||||
@@ -59,7 +59,7 @@ public static class PlainFileExport
|
||||
return tables.Concat(codeBlocks)
|
||||
.Where(entry => entry.Content is not null)
|
||||
.OrderBy(entry => entry.Line)
|
||||
.Select((entry, index) => new MessageTable(
|
||||
.Select((entry, index) => new MessageFile(
|
||||
index + 1,
|
||||
Caption: HeadingAbove(entry.Line) is { Length: > 0 } heading ? heading : entry.Content!.Value.Fallback,
|
||||
entry.Content!.Value.Format,
|
||||
|
||||
Reference in new issue
Block a user