mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-08-21 03:52:57 +00:00
Applied optimizations
This commit is contained in:
parent
175a3e0402
commit
314a7876d3
@ -12,7 +12,7 @@ public partial class CodeBlock : ComponentBase
|
|||||||
public string? Title { get; set; } = string.Empty;
|
public string? Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public bool IsInline { get; set; } = false;
|
public bool IsInline { get; set; }
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
public CodeTabs? ParentTabs { get; set; }
|
public CodeTabs? ParentTabs { get; set; }
|
||||||
@ -21,14 +21,15 @@ public partial class CodeBlock : ComponentBase
|
|||||||
{
|
{
|
||||||
if (this.ParentTabs is not null && this.Title is not null)
|
if (this.ParentTabs is not null && this.Title is not null)
|
||||||
{
|
{
|
||||||
RenderFragment blockSelf = builder =>
|
void BlockSelf(RenderTreeBuilder builder)
|
||||||
{
|
{
|
||||||
builder.OpenComponent<CodeBlock>(0);
|
builder.OpenComponent<CodeBlock>(0);
|
||||||
builder.AddAttribute(1, "Title", this.Title);
|
builder.AddAttribute(1, "Title", this.Title);
|
||||||
builder.AddAttribute(2, "ChildContent", this.ChildContent);
|
builder.AddAttribute(2, "ChildContent", this.ChildContent);
|
||||||
builder.CloseComponent();
|
builder.CloseComponent();
|
||||||
};
|
}
|
||||||
this.ParentTabs.RegisterBlock(this.Title, blockSelf);
|
|
||||||
|
this.ParentTabs.RegisterBlock(this.Title, BlockSelf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ public partial class CodeTabs : ComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public RenderFragment? ChildContent { get; set; }
|
public RenderFragment? ChildContent { get; set; }
|
||||||
|
|
||||||
private List<CodeTabItem> blocks = new();
|
private readonly List<CodeTabItem> blocks = new();
|
||||||
private int selectedIndex = 0;
|
private int selectedIndex;
|
||||||
|
|
||||||
internal void RegisterBlock(string title, RenderFragment fragment)
|
internal void RegisterBlock(string title, RenderFragment fragment)
|
||||||
{
|
{
|
||||||
@ -17,12 +17,14 @@ public partial class CodeTabs : ComponentBase
|
|||||||
Title = title,
|
Title = title,
|
||||||
Fragment = fragment,
|
Fragment = fragment,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.StateHasChanged();
|
this.StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CodeTabItem
|
private class CodeTabItem
|
||||||
{
|
{
|
||||||
public string Title { get; init; } = string.Empty;
|
public string Title { get; init; } = string.Empty;
|
||||||
|
|
||||||
public RenderFragment Fragment { get; init; } = null!;
|
public RenderFragment Fragment { get; init; } = null!;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,12 +9,13 @@ namespace AIStudio.Tools;
|
|||||||
|
|
||||||
public static partial class Pandoc
|
public static partial class Pandoc
|
||||||
{
|
{
|
||||||
|
private const string CPU_ARCHITECTURE = "win-x64";
|
||||||
|
private const string DOWNLOAD_URL = "https://github.com/jgm/pandoc/releases/download";
|
||||||
|
private const string LATEST_URL = "https://github.com/jgm/pandoc/releases/latest";
|
||||||
|
|
||||||
private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger("PandocService");
|
private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger("PandocService");
|
||||||
private static readonly string DOWNLOAD_URL = "https://github.com/jgm/pandoc/releases/download";
|
|
||||||
private static readonly string LATEST_URL = "https://github.com/jgm/pandoc/releases/latest";
|
|
||||||
private static readonly Version MINIMUM_REQUIRED_VERSION = new (3, 6);
|
private static readonly Version MINIMUM_REQUIRED_VERSION = new (3, 6);
|
||||||
private static readonly Version FALLBACK_VERSION = new (3, 7, 0, 1);
|
private static readonly Version FALLBACK_VERSION = new (3, 7, 0, 1);
|
||||||
private static readonly string CPU_ARCHITECTURE = "win-x64";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if pandoc is available on the system and can be started as a process or present in AiStudio's data dir
|
/// Checks if pandoc is available on the system and can be started as a process or present in AiStudio's data dir
|
||||||
|
Loading…
Reference in New Issue
Block a user