mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-05-02 18:39:47 +00:00
Ensure that the bias workspace is present
This commit is contained in:
parent
0b367a4542
commit
893be39935
@ -37,6 +37,7 @@ public partial class Workspaces : ComponentBase
|
|||||||
|
|
||||||
private const Placement WORKSPACE_ITEM_TOOLTIP_PLACEMENT = Placement.Bottom;
|
private const Placement WORKSPACE_ITEM_TOOLTIP_PLACEMENT = Placement.Bottom;
|
||||||
|
|
||||||
|
private static readonly Guid WORKSPACE_ID_BIAS = Guid.Parse("82050a4e-ee92-43d7-8ee5-ab512f847e02");
|
||||||
private static readonly JsonSerializerOptions JSON_OPTIONS = new()
|
private static readonly JsonSerializerOptions JSON_OPTIONS = new()
|
||||||
{
|
{
|
||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
@ -64,6 +65,7 @@ public partial class Workspaces : ComponentBase
|
|||||||
//
|
//
|
||||||
|
|
||||||
await this.LoadTreeItems();
|
await this.LoadTreeItems();
|
||||||
|
await this.EnsureBiasWorkspace();
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,6 +436,19 @@ public partial class Workspaces : ComponentBase
|
|||||||
|
|
||||||
await this.LoadTreeItems();
|
await this.LoadTreeItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task EnsureBiasWorkspace()
|
||||||
|
{
|
||||||
|
var workspacePath = Path.Join(SettingsManager.DataDirectory, "workspaces", WORKSPACE_ID_BIAS.ToString());
|
||||||
|
|
||||||
|
if(Path.Exists(workspacePath))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Directory.CreateDirectory(workspacePath);
|
||||||
|
var workspaceNamePath = Path.Join(workspacePath, "name");
|
||||||
|
await File.WriteAllTextAsync(workspaceNamePath, "Bias of the Day", Encoding.UTF8);
|
||||||
|
await this.LoadTreeItems();
|
||||||
|
}
|
||||||
|
|
||||||
private async Task DeleteWorkspace(string? workspacePath)
|
private async Task DeleteWorkspace(string? workspacePath)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user