@@ -45,7 +45,7 @@ namespace StabilityMatrix.Avalonia.ViewModels.Inference;
4545
4646[ View ( typeof ( PromptCard ) ) ]
4747[ ManagedService ]
48- [ RegisterScoped < PromptCardViewModel > ]
48+ [ RegisterTransient < PromptCardViewModel > ]
4949public partial class PromptCardViewModel
5050 : DisposableLoadableViewModelBase ,
5151 IParametersLoadableState ,
@@ -337,15 +337,15 @@ public void ApplyStep(ModuleApplyStepEventArgs e)
337337 {
338338 Name = $ "PositiveCLIP_{ modelConnections . Name } ",
339339 Clip = e . Builder . Connections . Base . Clip ! ,
340- Text = e . Builder . Connections . PositivePrompt
340+ Text = e . Builder . Connections . PositivePrompt ,
341341 }
342342 ) ;
343343 var negativeClip = e . Nodes . AddTypedNode (
344344 new ComfyNodeBuilder . CLIPTextEncode
345345 {
346346 Name = $ "NegativeCLIP_{ modelConnections . Name } ",
347347 Clip = e . Builder . Connections . Base . Clip ! ,
348- Text = e . Builder . Connections . NegativePrompt
348+ Text = e . Builder . Connections . NegativePrompt ,
349349 }
350350 ) ;
351351
@@ -419,60 +419,60 @@ public async Task<bool> ValidatePrompts()
419419 private async Task ShowHelpDialog ( )
420420 {
421421 var md = $$ """
422- ## {{ Resources . Label_Emphasis }}
423- You can also use (`Ctrl+Up`/`Ctrl+Down`) in the editor to adjust the
424- weight emphasis of the token under the caret or the currently selected text.
425- ```prompt
426- (keyword)
427- (keyword:1.0)
428- ```
429-
430- ## {{ Resources . Label_Deemphasis }}
431- ```prompt
432- [keyword]
433- ```
434-
435- ## {{ Resources . Label_EmbeddingsOrTextualInversion }}
436- They may be used in either the positive or negative prompts.
437- Essentially they are text presets, so the position where you place them
438- could make a difference.
439- ```prompt
440- <embedding:model>
441- <embedding:model:1.0>
442- ```
443-
444- ## {{ Resources . Label_NetworksLoraOrLycoris }}
445- Unlike embeddings, network tags do not get tokenized to the model,
446- so the position in the prompt where you place them does not matter.
447- ```prompt
448- <lora:model>
449- <lora:model:1.0>
450- <lyco:model>
451- <lyco:model:1.0>
452- ```
453-
454- ## {{ Resources . Label_Comments }}
455- Inline comments can be marked by a hashtag ' # '.
456- All text after a ' # ' on a line will be disregarded during generation.
457- ```prompt
458- # comments
459- a red cat # also comments
460- detailed
461- ```
462-
463- ## {{ Resources . Label_Wildcards }}
464- Wildcards can be used to select a random value from a list of options.
465- ```prompt
466- {red|green|blue} cat
467- ```
468- In this example, a color will be randomly chosen at the start of each generation.
469- The final output could be "red cat", "green cat", or "blue cat".
470-
471- You can also use networks and embeddings in wildcards. For example:
472- ```prompt
473- {<lora:model:1>|<embedding:model>} cat
474- ```
475- """ ;
422+ ## {{ Resources . Label_Emphasis }}
423+ You can also use (`Ctrl+Up`/`Ctrl+Down`) in the editor to adjust the
424+ weight emphasis of the token under the caret or the currently selected text.
425+ ```prompt
426+ (keyword)
427+ (keyword:1.0)
428+ ```
429+
430+ ## {{ Resources . Label_Deemphasis }}
431+ ```prompt
432+ [keyword]
433+ ```
434+
435+ ## {{ Resources . Label_EmbeddingsOrTextualInversion }}
436+ They may be used in either the positive or negative prompts.
437+ Essentially they are text presets, so the position where you place them
438+ could make a difference.
439+ ```prompt
440+ <embedding:model>
441+ <embedding:model:1.0>
442+ ```
443+
444+ ## {{ Resources . Label_NetworksLoraOrLycoris }}
445+ Unlike embeddings, network tags do not get tokenized to the model,
446+ so the position in the prompt where you place them does not matter.
447+ ```prompt
448+ <lora:model>
449+ <lora:model:1.0>
450+ <lyco:model>
451+ <lyco:model:1.0>
452+ ```
453+
454+ ## {{ Resources . Label_Comments }}
455+ Inline comments can be marked by a hashtag ' # '.
456+ All text after a ' # ' on a line will be disregarded during generation.
457+ ```prompt
458+ # comments
459+ a red cat # also comments
460+ detailed
461+ ```
462+
463+ ## {{ Resources . Label_Wildcards }}
464+ Wildcards can be used to select a random value from a list of options.
465+ ```prompt
466+ {red|green|blue} cat
467+ ```
468+ In this example, a color will be randomly chosen at the start of each generation.
469+ The final output could be "red cat", "green cat", or "blue cat".
470+
471+ You can also use networks and embeddings in wildcards. For example:
472+ ```prompt
473+ {<lora:model:1>|<embedding:model>} cat
474+ ```
475+ """ ;
476476
477477 var dialog = DialogHelper . CreateMarkdownDialog ( md , "Prompt Syntax" , TextEditorPreset . Prompt ) ;
478478 dialog . MinDialogWidth = 800 ;
@@ -531,7 +531,7 @@ private async Task DebugShowTokens()
531531 builder . AppendLine ( $ "## Networks ({ networks . Count } ):") ;
532532 builder . AppendLine ( "```csharp" ) ;
533533 builder . AppendLine (
534- JsonSerializer . Serialize ( networks , new JsonSerializerOptions ( ) { WriteIndented = true , } )
534+ JsonSerializer . Serialize ( networks , new JsonSerializerOptions ( ) { WriteIndented = true } )
535535 ) ;
536536 builder . AppendLine ( "```" ) ;
537537 }
@@ -622,11 +622,10 @@ private async Task AmplifyPrompt()
622622 "illustrious" => [ ModelTags . Illustrious ] ,
623623 _ => [ ] ,
624624 } ;
625- var mode = IsFocused
626- ? PromptExpansionRequestMode . Focused
627- : IsImaginative
628- ? PromptExpansionRequestMode . Imaginative
629- : PromptExpansionRequestMode . Balanced ;
625+ var mode =
626+ IsFocused ? PromptExpansionRequestMode . Focused
627+ : IsImaginative ? PromptExpansionRequestMode . Imaginative
628+ : PromptExpansionRequestMode . Balanced ;
630629 try
631630 {
632631 var expandedPrompt = await promptGenApi . ExpandPrompt (
@@ -636,11 +635,11 @@ private async Task AmplifyPrompt()
636635 {
637636 PositivePrompt = prompt . ProcessedText ?? prompt . RawText ,
638637 NegativePrompt = negativePrompt . ProcessedText ?? negativePrompt . RawText ,
639- Model = selectedModel ? . Local ? . DisplayModelName
638+ Model = selectedModel ? . Local ? . DisplayModelName ,
640639 } ,
641640 Model = IsThinkingEnabled ? "PromptV1ThinkingDev" : "PromptV1Dev" ,
642641 Mode = mode ,
643- ModelTags = modelTags
642+ ModelTags = modelTags ,
644643 }
645644 ) ;
646645
@@ -661,8 +660,8 @@ private async Task AmplifyPrompt()
661660 "Rate Limit Reached"
662661 ) ;
663662 dialog . PrimaryButtonText = "Upgrade" ;
664- dialog . PrimaryButtonCommand = new RelayCommand (
665- ( ) => ProcessRunner . OpenUrl ( "https://patreon.com/join/StabilityMatrix" )
663+ dialog . PrimaryButtonCommand = new RelayCommand ( ( ) =>
664+ ProcessRunner . OpenUrl ( "https://patreon.com/join/StabilityMatrix" )
666665 ) ;
667666 dialog . IsPrimaryButtonEnabled = true ;
668667 dialog . DefaultButton = ContentDialogButton . Primary ;
@@ -753,7 +752,7 @@ public override JsonObject SaveStateToJsonObject()
753752 {
754753 Prompt = PromptDocument . Text ,
755754 NegativePrompt = NegativePromptDocument . Text ,
756- ModulesCardState = ModulesCardViewModel . SaveStateToJsonObject ( )
755+ ModulesCardState = ModulesCardViewModel . SaveStateToJsonObject ( ) ,
757756 }
758757 ) ;
759758 }
@@ -785,7 +784,7 @@ public GenerationParameters SaveStateToParameters(GenerationParameters parameter
785784 return parameters with
786785 {
787786 PositivePrompt = PromptDocument . Text ,
788- NegativePrompt = NegativePromptDocument . Text
787+ NegativePrompt = NegativePromptDocument . Text ,
789788 } ;
790789 }
791790
@@ -799,7 +798,7 @@ private async Task<bool> ShowLoginDialog()
799798 dialog . Buttons =
800799 [
801800 new TaskDialogButton ( Resources . Action_Login , TaskDialogStandardResult . OK ) ,
802- TaskDialogButton . CloseButton
801+ TaskDialogButton . CloseButton ,
803802 ] ;
804803
805804 if ( await dialog . ShowAsync ( true ) is not TaskDialogStandardResult . OK )
@@ -808,7 +807,7 @@ private async Task<bool> ShowLoginDialog()
808807 var vm = vmFactory . Get < OAuthDeviceAuthViewModel > ( ) ;
809808 vm . ChallengeRequest = new OpenIddictClientModels . DeviceChallengeRequest
810809 {
811- ProviderName = OpenIdClientConstants . LykosAccount . ProviderName
810+ ProviderName = OpenIdClientConstants . LykosAccount . ProviderName ,
812811 } ;
813812 await vm . ShowDialogAsync ( ) ;
814813
0 commit comments