You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
925 B
32 lines
925 B
1 year ago
|
using AvaloniaEdit.Document;
|
||
|
using StabilityMatrix.Avalonia.Controls;
|
||
|
using StabilityMatrix.Avalonia.Models;
|
||
|
using StabilityMatrix.Avalonia.Models.Inference;
|
||
|
using StabilityMatrix.Core.Attributes;
|
||
|
|
||
|
namespace StabilityMatrix.Avalonia.ViewModels.Inference;
|
||
|
|
||
|
[View(typeof(PromptCard))]
|
||
|
public class PromptCardViewModel : ViewModelBase, ILoadableState<PromptCardModel>
|
||
|
{
|
||
|
public TextDocument PromptDocument { get; } = new();
|
||
|
public TextDocument NegativePromptDocument { get; } = new();
|
||
|
|
||
|
/// <inheritdoc />
|
||
|
public void LoadState(PromptCardModel state)
|
||
|
{
|
||
|
PromptDocument.Text = state.Prompt ?? "";
|
||
|
NegativePromptDocument.Text = state.NegativePrompt ?? "";
|
||
|
}
|
||
|
|
||
|
/// <inheritdoc />
|
||
|
public PromptCardModel SaveState()
|
||
|
{
|
||
|
return new PromptCardModel
|
||
|
{
|
||
|
Prompt = PromptDocument.Text,
|
||
|
NegativePrompt = NegativePromptDocument.Text
|
||
|
};
|
||
|
}
|
||
|
}
|