Browse Source

Add image prompt language def and theme

pull/165/head
Ionite 1 year ago
parent
commit
d5c3472d7b
No known key found for this signature in database
  1. 6
      StabilityMatrix.Avalonia/Assets.cs
  2. 149
      StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json
  3. 659
      StabilityMatrix.Avalonia/Assets/ThemeMatrixDark.json
  4. 81
      StabilityMatrix.Avalonia/Assets/sdprompt.xshd
  5. 41
      StabilityMatrix.Avalonia/Extensions/TextMateExtensions.cs
  6. 4
      StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj
  7. 30
      StabilityMatrix.Core/Models/Api/Comfy/ComfySampler.cs

6
StabilityMatrix.Avalonia/Assets.cs

@ -24,6 +24,12 @@ internal static class Assets
public static AvaloniaResource LicensesJson => new( public static AvaloniaResource LicensesJson => new(
"avares://StabilityMatrix.Avalonia/Assets/licenses.json"); "avares://StabilityMatrix.Avalonia/Assets/licenses.json");
public static AvaloniaResource ImagePromptLanguageJson => new(
"avares://StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json");
public static AvaloniaResource ThemeMatrixDarkJson =>
new("avares://StabilityMatrix.Avalonia/Assets/ThemeMatrixDark.json");
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
[SupportedOSPlatform("linux")] [SupportedOSPlatform("linux")]

149
StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json

@ -0,0 +1,149 @@
{
"name": "Image Prompt",
"scopeName": "source.prompt",
"patterns": [
{
"include": "#value"
}
],
"repository": {
"comment": {
"captures": {
"1": {
"name": "punctuation.definition.comment.prompt"
}
},
"match": "(#).*$\\n?",
"name": "comment.line.number-sign.prompt"
},
"parenthesized": {
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.array.begin.prompt"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.array.end.prompt"
}
},
"name": "meta.structure.array.prompt",
"patterns": [
{
"include": "#colon"
},
{
"include": "#number"
},
{
"include": "#value"
},
{
"match": "[^\\s\\)]",
"name": "invalid.illegal.expected-array-separator.prompt"
}
]
},
"array": {
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "punctuation.definition.array.begin.prompt"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.array.end.prompt"
}
},
"name": "meta.structure.array.prompt",
"patterns": [
{
"include": "#value"
},
{
"match": "[^\\s\\]]",
"name": "invalid.illegal.expected-array-separator.prompt"
}
]
},
"network": {
"begin": "<",
"beginCaptures": {
"0": {
"name": "punctuation.definition.network.begin.prompt"
}
},
"end": ">",
"endCaptures": {
"0": {
"name": "punctuation.definition.network.end.prompt"
}
},
"name": "meta.structure.network.prompt",
"patterns": [
{
"include": "#colon"
},
{
"include": "#number"
},
{
"include": "#text"
},
{
"match": "[^\\s\\>]",
"name": "invalid.illegal.expected-array-separator.prompt"
}
]
},
"number": {
"match": "(?x) # turn on extended mode\n -? # an optional minus\n (?:\n 0 # a zero\n | # ...or...\n [1-9] # a 1-9 character\n \\d* # followed by zero or more digits\n )\n (?:\n (?:\n \\. # a period\n \\d+ # followed by one or more digits\n )?\n (?:\n [eE] # an e character\n [+-]? # followed by an option +/-\n \\d+ # followed by one or more digits\n )? # make exponent optional\n )? # make decimal portion optional",
"name": "constant.numeric"
},
"separator": {
"match": ",\\s*",
"name": "punctuation.separator.variable.prompt"
},
"colon": {
"match": ":",
"name": "punctuation.separator.variable.prompt"
},
"keyword": {
"match": "\\b(?:BREAK|AND)\\b",
"name": "keyword.control"
},
"text": {
"match": "[^,:\\[\\]\\(\\)]+",
"name": "meta.embedded"
},
"value": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#parenthesized"
},
{
"include": "#array"
},
{
"include": "#network"
},
{
"include": "#separator"
},
{
"include": "#keyword"
},
{
"include": "#text"
}
]
}
}
}

659
StabilityMatrix.Avalonia/Assets/ThemeMatrixDark.json

@ -0,0 +1,659 @@
{
"type": "dark",
"colors": {
"dropdown.background": "#525252",
"list.activeSelectionBackground": "#707070",
"quickInputList.focusBackground": "#707070",
"list.inactiveSelectionBackground": "#4e4e4e",
"list.hoverBackground": "#444444",
"list.highlightForeground": "#e58520",
"button.background": "#565656",
"editor.background": "#1e1e1e",
"editor.foreground": "#c5c8c6",
"editor.selectionBackground": "#676b7180",
"minimap.selectionHighlight": "#676b7180",
"editor.selectionHighlightBackground": "#575b6180",
"editor.lineHighlightBackground": "#303030",
"editorLineNumber.activeForeground": "#949494",
"editor.wordHighlightBackground": "#4747a180",
"editor.wordHighlightStrongBackground": "#6767ce80",
"editorCursor.foreground": "#c07020",
"editorWhitespace.foreground": "#505037",
"editorIndentGuide.background": "#505037",
"editorIndentGuide.activeBackground": "#707057",
"editorGroupHeader.tabsBackground": "#282828",
"tab.inactiveBackground": "#404040",
"tab.border": "#303030",
"tab.inactiveForeground": "#d8d8d8",
"tab.lastPinnedBorder": "#505050",
"peekView.border": "#3655b5",
"panelTitle.activeForeground": "#ffffff",
"statusBar.background": "#505050",
"statusBar.debuggingBackground": "#505050",
"statusBar.noFolderBackground": "#505050",
"titleBar.activeBackground": "#505050",
"statusBarItem.remoteBackground": "#3655b5",
"ports.iconRunningProcessForeground": "#CCCCCC",
"activityBar.background": "#353535",
"activityBar.foreground": "#ffffff",
"activityBarBadge.background": "#3655b5",
"sideBar.background": "#272727",
"sideBarSectionHeader.background": "#505050",
"menu.background": "#272727",
"menu.foreground": "#CCCCCC",
"pickerGroup.foreground": "#b0b0b0",
"inputOption.activeBorder": "#3655b5",
"focusBorder": "#3655b5",
"terminal.ansiBlack": "#1e1e1e",
"terminal.ansiRed": "#C4265E",
"terminal.ansiGreen": "#86B42B",
"terminal.ansiYellow": "#B3B42B",
"terminal.ansiBlue": "#6A7EC8",
"terminal.ansiMagenta": "#8C6BC8",
"terminal.ansiCyan": "#56ADBC",
"terminal.ansiWhite": "#e3e3dd",
"terminal.ansiBrightBlack": "#666666",
"terminal.ansiBrightRed": "#f92672",
"terminal.ansiBrightGreen": "#A6E22E",
"terminal.ansiBrightYellow": "#e2e22e",
"terminal.ansiBrightBlue": "#819aff",
"terminal.ansiBrightMagenta": "#AE81FF",
"terminal.ansiBrightCyan": "#66D9EF",
"terminal.ansiBrightWhite": "#f8f8f2"
},
"tokenColors": [
{
"settings": {
"foreground": "#C5C8C6"
}
},
{
"scope": [
"meta.embedded",
"source.groovy.embedded"
],
"settings": {
"foreground": "#C5C8C6"
}
},
{
"name": "Comment",
"scope": "comment",
"settings": {
"fontStyle": "",
"foreground": "#9A9B99"
}
},
{
"name": "String",
"scope": "string",
"settings": {
"fontStyle": "",
"foreground": "#9AA83A"
}
},
{
"name": "String Embedded Source",
"scope": "string source",
"settings": {
"fontStyle": "",
"foreground": "#D08442"
}
},
{
"name": "Number",
"scope": "constant.numeric",
"settings": {
"fontStyle": "",
"foreground": "#6089B4"
}
},
{
"name": "Built-in constant",
"scope": "constant.language",
"settings": {
"fontStyle": "",
"foreground": "#408080"
}
},
{
"name": "User-defined constant",
"scope": "constant.character, constant.other",
"settings": {
"fontStyle": "",
"foreground": "#8080FF"
}
},
{
"name": "Keyword",
"scope": "keyword",
"settings": {
"fontStyle": "",
"foreground": "#6089B4"
}
},
{
"name": "Support",
"scope": "support",
"settings": {
"fontStyle": "",
"foreground": "#C7444A"
}
},
{
"name": "Storage",
"scope": "storage",
"settings": {
"fontStyle": "",
"foreground": "#9872A2"
}
},
{
"name": "Class name",
"scope": "entity.name.class, entity.name.type, entity.name.namespace, entity.name.scope-resolution",
"settings": {
"fontStyle": "",
"foreground": "#9B0000"
}
},
{
"name": "Inherited class",
"scope": "entity.other.inherited-class",
"settings": {
"fontStyle": "",
"foreground": "#C7444A"
}
},
{
"name": "Function name",
"scope": "entity.name.function",
"settings": {
"fontStyle": "",
"foreground": "#CE6700"
}
},
{
"name": "Function argument",
"scope": "variable.parameter",
"settings": {
"fontStyle": "",
"foreground": "#6089B4"
}
},
{
"name": "Tag name",
"scope": "entity.name.tag",
"settings": {
"fontStyle": "",
"foreground": "#9872A2"
}
},
{
"name": "Tag attribute",
"scope": "entity.other.attribute-name",
"settings": {
"fontStyle": "",
"foreground": "#9872A2"
}
},
{
"name": "Library function",
"scope": "support.function",
"settings": {
"fontStyle": "",
"foreground": "#9872A2"
}
},
{
"name": "Keyword",
"scope": "keyword",
"settings": {
"fontStyle": "italic",
"foreground": "#676867"
}
},
{
"name": "Class Variable",
"scope": "variable.other, variable.js, punctuation.separator.variable",
"settings": {
"fontStyle": "",
"foreground": "#6089B4"
}
},
{
"name": "Meta Brace",
"scope": "punctuation.section.embedded -(source string source punctuation.section.embedded), meta.brace.erb.html",
"settings": {
"fontStyle": "",
"foreground": "#008200"
}
},
{
"name": "Invalid",
"scope": "invalid",
"settings": {
"fontStyle": "underline",
"foreground": "#FF0B00"
}
},
{
"name": "Normal Variable",
"scope": "variable.other.php, variable.other.normal",
"settings": {
"fontStyle": "",
"foreground": "#6089B4"
}
},
{
"name": "Function Object",
"scope": "meta.function-call.object",
"settings": {
"fontStyle": "",
"foreground": "#9872A2"
}
},
{
"name": "Function Call Variable",
"scope": "variable.other.property",
"settings": {
"fontStyle": "",
"foreground": "#9872A2"
}
},
{
"name": "Keyword Control / Special",
"scope": [
"keyword.control",
"keyword.operator.new.cpp",
"keyword.operator.delete.cpp",
"keyword.other.using",
"keyword.other.operator"
],
"settings": {
"fontStyle": "italic",
"foreground": "#9872A2"
}
},
{
"name": "Tag",
"scope": "meta.tag",
"settings": {
"fontStyle": "",
"foreground": "#D0B344"
}
},
{
"name": "Tag Name",
"scope": "entity.name.tag",
"settings": {
"fontStyle": "",
"foreground": "#6089B4"
}
},
{
"name": "Doctype",
"scope": "meta.doctype, meta.tag.sgml-declaration.doctype, meta.tag.sgml.doctype",
"settings": {
"fontStyle": "",
"foreground": "#9AA83A"
}
},
{
"name": "Tag Inline Source",
"scope": "meta.tag.inline source, text.html.php.source",
"settings": {
"fontStyle": "",
"foreground": "#9AA83A"
}
},
{
"name": "Tag Other",
"scope": "meta.tag.other, entity.name.tag.style, entity.name.tag.script, meta.tag.block.script, source.js.embedded punctuation.definition.tag.html, source.css.embedded punctuation.definition.tag.html",
"settings": {
"fontStyle": "",
"foreground": "#9872A2"
}
},
{
"name": "Tag Attribute",
"scope": "entity.other.attribute-name, meta.tag punctuation.definition.string",
"settings": {
"fontStyle": "",
"foreground": "#D0B344"
}
},
{
"name": "Tag Value",
"scope": "meta.tag string -source -punctuation, text source text meta.tag string -punctuation",
"settings": {
"fontStyle": "",
"foreground": "#6089B4"
}
},
{
"name": "Meta Brace",
"scope": "punctuation.section.embedded -(source string source punctuation.section.embedded), meta.brace.erb.html",
"settings": {
"fontStyle": "",
"foreground": "#D0B344"
}
},
{
"name": "HTML ID",
"scope": "meta.toc-list.id",
"settings": {
"foreground": "#9AA83A"
}
},
{
"name": "HTML String",
"scope": "string.quoted.double.html, punctuation.definition.string.begin.html, punctuation.definition.string.end.html, punctuation.definition.string.end.html source, string.quoted.double.html source",
"settings": {
"fontStyle": "",
"foreground": "#9AA83A"
}
},
{
"name": "HTML Tags",
"scope": "punctuation.definition.tag.html, punctuation.definition.tag.begin, punctuation.definition.tag.end",
"settings": {
"fontStyle": "",
"foreground": "#6089B4"
}
},
{
"name": "CSS ID",
"scope": "meta.selector.css entity.other.attribute-name.id",
"settings": {
"fontStyle": "",
"foreground": "#9872A2"
}
},
{
"name": "CSS Property Name",
"scope": "support.type.property-name.css",
"settings": {
"fontStyle": "",
"foreground": "#676867"
}
},
{
"name": "CSS Property Value",
"scope": "meta.property-group support.constant.property-value.css, meta.property-value support.constant.property-value.css",
"settings": {
"fontStyle": "",
"foreground": "#C7444A"
}
},
{
"name": "JavaScript Variable",
"scope": "variable.language.js",
"settings": {
"foreground": "#CC555A"
}
},
{
"name": "Template Definition",
"scope": [
"punctuation.definition.template-expression",
"punctuation.section.embedded.coffee"
],
"settings": {
"foreground": "#D08442"
}
},
{
"name": "Reset JavaScript string interpolation expression",
"scope": [
"meta.template.expression"
],
"settings": {
"foreground": "#C5C8C6"
}
},
{
"name": "PHP Function Call",
"scope": "meta.function-call.object.php",
"settings": {
"fontStyle": "",
"foreground": "#D0B344"
}
},
{
"name": "PHP Single Quote HMTL Fix",
"scope": "punctuation.definition.string.end.php, punctuation.definition.string.begin.php",
"settings": {
"foreground": "#9AA83A"
}
},
{
"name": "PHP Parenthesis HMTL Fix",
"scope": "source.php.embedded.line.html",
"settings": {
"foreground": "#676867"
}
},
{
"name": "PHP Punctuation Embedded",
"scope": "punctuation.section.embedded.begin.php, punctuation.section.embedded.end.php",
"settings": {
"fontStyle": "",
"foreground": "#D08442"
}
},
{
"name": "Ruby Symbol",
"scope": "constant.other.symbol.ruby",
"settings": {
"fontStyle": "",
"foreground": "#9AA83A"
}
},
{
"name": "Ruby Variable",
"scope": "variable.language.ruby",
"settings": {
"fontStyle": "",
"foreground": "#D0B344"
}
},
{
"name": "Ruby Special Method",
"scope": "keyword.other.special-method.ruby",
"settings": {
"fontStyle": "",
"foreground": "#D9B700"
}
},
{
"name": "Ruby Embedded Source",
"scope": [
"punctuation.section.embedded.begin.ruby",
"punctuation.section.embedded.end.ruby"
],
"settings": {
"foreground": "#D08442"
}
},
{
"name": "SQL",
"scope": "keyword.other.DML.sql",
"settings": {
"fontStyle": "",
"foreground": "#D0B344"
}
},
{
"name": "diff: header",
"scope": "meta.diff, meta.diff.header",
"settings": {
"fontStyle": "italic",
"foreground": "#E0EDDD"
}
},
{
"name": "diff: deleted",
"scope": "markup.deleted",
"settings": {
"fontStyle": "",
"foreground": "#dc322f"
}
},
{
"name": "diff: changed",
"scope": "markup.changed",
"settings": {
"fontStyle": "",
"foreground": "#cb4b16"
}
},
{
"name": "diff: inserted",
"scope": "markup.inserted",
"settings": {
"foreground": "#219186"
}
},
{
"name": "Markup Quote",
"scope": "markup.quote",
"settings": {
"foreground": "#9872A2"
}
},
{
"name": "Markup Lists",
"scope": "markup.list",
"settings": {
"foreground": "#9AA83A"
}
},
{
"name": "Markup Styling",
"scope": "markup.bold, markup.italic",
"settings": {
"foreground": "#6089B4"
}
},
{
"name": "Markup Inline",
"scope": "markup.inline.raw",
"settings": {
"fontStyle": "",
"foreground": "#FF0080"
}
},
{
"name": "Markup Headings",
"scope": "markup.heading",
"settings": {
"foreground": "#D0B344"
}
},
{
"name": "Markup Setext Header",
"scope": "markup.heading.setext",
"settings": {
"fontStyle": "",
"foreground": "#D0B344"
}
},
{
"name": "Markdown Headings",
"scope": "markup.heading.markdown",
"settings": {
"fontStyle": "bold"
}
},
{
"name": "Markdown Quote",
"scope": "markup.quote.markdown",
"settings": {
"fontStyle": "italic",
"foreground": ""
}
},
{
"name": "Markdown Bold",
"scope": "markup.bold.markdown",
"settings": {
"fontStyle": "bold"
}
},
{
"name": "Markdown Link Title/Description",
"scope": "string.other.link.title.markdown,string.other.link.description.markdown",
"settings": {
"foreground": "#AE81FF"
}
},
{
"name": "Markdown Underline Link/Image",
"scope": "markup.underline.link.markdown,markup.underline.link.image.markdown",
"settings": {
"foreground": ""
}
},
{
"name": "Markdown Emphasis",
"scope": "markup.italic.markdown",
"settings": {
"fontStyle": "italic"
}
},
{
"scope": "markup.strikethrough",
"settings": {
"fontStyle": "strikethrough"
}
},
{
"name": "Markdown Punctuation Definition Link",
"scope": "markup.list.unnumbered.markdown, markup.list.numbered.markdown",
"settings": {
"foreground": ""
}
},
{
"name": "Markdown List Punctuation",
"scope": [
"punctuation.definition.list.begin.markdown"
],
"settings": {
"foreground": ""
}
},
{
"scope": "token.info-token",
"settings": {
"foreground": "#6796e6"
}
},
{
"scope": "token.warn-token",
"settings": {
"foreground": "#cd9731"
}
},
{
"scope": "token.error-token",
"settings": {
"foreground": "#f44747"
}
},
{
"scope": "token.debug-token",
"settings": {
"foreground": "#b267e6"
}
},
{
"name": "this.self",
"scope": "variable.language",
"settings": {
"foreground": "#c7444a"
}
}
],
"semanticHighlighting": true
}

81
StabilityMatrix.Avalonia/Assets/sdprompt.xshd

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8" ?>
<SyntaxDefinition name="ImagePrompt" extensions=".prompt" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<!-- Colors -->
<Color name="punctuation" foreground="DarkGreen"/>
<Color name="comment" foreground="#008000"/>
<Color name="keyword" foreground="#0000FF" fontWeight="bold"/>
<Color name="string" foreground="#A31515"/>
<Color name="charescape" foreground="#6A8759"/>
<Color name="invalid" foreground="#FF0000" background="#FFD0D0"/>
<Color name="number" foreground="#FF0000"/>
<Color name="operator" foreground="#808080"/>
<Color name="extranetwork" foreground="#2B91AF"/>
<Color name="promptstep" foreground="#2B91AF"/>
<Color name="promptweight" foreground="#2B91AF"/>
<Color name="promptvariable" foreground="#2B91AF"/>
<Color name="dynamicselection" foreground="#2B91AF"/>
<Color name="wildcard" foreground="#2B91AF"/>
<Color name="whitespace" foreground="#808080"/>
<Color name="qualitytag" foreground="#2B91AF"/>
<Color name="split" foreground="#808080"/>
<Color name="csscolor" foreground="#FF00FF"/>
<Color name="promptkeyword" foreground="#2B91AF"/>
<Color name="supercmd" foreground="#2B91AF"/>
<!-- Rules -->
<RuleSet ignoreCase="false">
<Rule color="punctuation">
[?,.()\[\]{}+\-/%*&lt;&gt;^!|]+
</Rule>
<Span color="comment" begin="#"/>
<!-- <Span color="string" multiline="true" begin="&quot;" end="&quot;"/>-->
<Span color="charescape" begin="\\u" end=".*"/>
<!-- <Span color="invalid" begin=">"/>
<Span color="invalid" begin="\\)"/>
<Span color="invalid" begin="\\]"/>
<Span color="invalid" begin="\\}"/>-->
<!-- <MarkFollowing color="operator" bold="true" begin=":"/>
<MarkPrevious color="operator" bold="true" begin=","/>-->
<!-- <Span color="extranetwork" begin="&lt;" end="&gt;"/>
<Span color="promptstep">
<Begin>\[</Begin>
<End>\]</End>
</Span>
<Span color="promptweight">
<Begin>\(</Begin>
<End>\)</End>
</Span>-->
<!-- <Span color="promptvariable" begin="\\$\\{" end="\\}"/>
<Span color="dynamicselection" begin="\\{" end="\\}"/>-->
<!-- <Span color="wildcard" begin="__" end="__"/>
<Span color="whitespace" begin="\\s+"/>-->
<!-- <Span color="qualitytag" begin="\\{\\{" end="\\}\\}"/>-->
<!-- <Span color="split" begin="|"/>-->
<!-- <MarkPrevious color="csscolor" begin="#"/>-->
<Keywords color="keyword" ignoreCase="false">
<Word>AND</Word>
<Word>BREAK</Word>
</Keywords>
<Keywords color="promptkeyword">
<Word>PROMPT</Word>
<Word>WEIGHT</Word>
</Keywords>
<Keywords color="supercmd">
<Word>SELECT</Word>
<Word>DYNAMIC</Word>
</Keywords>
<Rule color="number">\b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?</Rule>
<!-- <Rule color="invalid">\b\d+[a-zA-Z_]+\b</Rule>
<Rule color="invalid">[a-zA-Z_]+\d+\b</Rule>-->
</RuleSet>
</SyntaxDefinition>

41
StabilityMatrix.Avalonia/Extensions/TextMateExtensions.cs

@ -0,0 +1,41 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using TextMateSharp.Grammars;
using TextMateSharp.Internal.Grammars;
using TextMateSharp.Internal.Grammars.Reader;
using TextMateSharp.Internal.Types;
using TextMateSharp.Registry;
namespace StabilityMatrix.Avalonia.Extensions;
public static class TextMateExtensions
{
public static IGrammar LoadGrammarFromStream(
this Registry registry,
Stream stream,
int? initialLanguage = default,
Dictionary<string, int>? embeddedLanguages = default)
{
IRawGrammar rawGrammar;
using (var sr = new StreamReader(stream))
{
rawGrammar = GrammarReader.ReadGrammarSync(sr);
}
var locatorField = typeof(Registry).GetField("locator", BindingFlags.NonPublic | BindingFlags.Instance);
var locator = (IRegistryOptions) locatorField!.GetValue(registry)!;
var injections = locator.GetInjections(rawGrammar.GetScopeName());
var syncRegistryField = typeof(Registry).GetField("syncRegistry", BindingFlags.NonPublic | BindingFlags.Instance);
var syncRegistry = (SyncRegistry) syncRegistryField!.GetValue(registry)!;
syncRegistry.AddGrammar(rawGrammar, injections);
return registry.GrammarForScopeName(
rawGrammar.GetScopeName(),
initialLanguage ?? 0,
embeddedLanguages ?? new Dictionary<string, int>());
}
}

4
StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj

@ -52,6 +52,10 @@
<ItemGroup> <ItemGroup>
<AvaloniaResource Include="Assets\Icon.ico" /> <AvaloniaResource Include="Assets\Icon.ico" />
<AvaloniaResource Include="Assets\Icon.png" /> <AvaloniaResource Include="Assets\Icon.png" />
<None Remove="Assets\ImagePrompt.tmLanguage.json" />
<AvaloniaResource Include="Assets\ImagePrompt.tmLanguage.json" />
<None Remove="Assets\ThemeMatrixDark.json" />
<AvaloniaResource Include="Assets\ThemeMatrixDark.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

30
StabilityMatrix.Core/Models/Api/Comfy/ComfySampler.cs

@ -0,0 +1,30 @@
namespace StabilityMatrix.Core.Models.Api.Comfy;
public readonly record struct ComfySampler(string Name)
{
/// SAMPLERS = ["euler", "euler_ancestral", "heun", "dpm_2", "dpm_2_ancestral",
/// "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_sde", "dpmpp_sde_gpu",
/// "dpmpp_2m", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "ddim", "uni_pc", "uni_pc_bh2"]
private static Dictionary<string, string> ConvertDict { get; } = new()
{
["euler"] = "Euler",
["euler_ancestral"] = "Euler Ancestral",
["heun"] = "Heun",
["dpm_2"] = "DPM 2",
["dpm_2_ancestral"] = "DPM 2 Ancestral",
["lms"] = "LMS",
["dpm_fast"] = "DPM Fast",
["dpm_adaptive"] = "DPM Adaptive",
["dpmpp_2s_ancestral"] = "DPM++ 2S Ancestral",
["dpmpp_sde"] = "DPM++ SDE",
["dpmpp_sde_gpu"] = "DPM++ SDE GPU",
["dpmpp_2m"] = "DPM++ 2M",
["dpmpp_2m_sde"] = "DPM++ 2M SDE",
["dpmpp_2m_sde_gpu"] = "DPM++ 2M SDE GPU",
["ddim"] = "DDIM",
["uni_pc"] = "UniPC",
["uni_pc_bh2"] = "UniPC BH2"
};
public string DisplayName => ConvertDict.TryGetValue(Name, out var displayName) ? displayName : Name;
}
Loading…
Cancel
Save