File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,18 @@ class SDTab extends React.Component<{}> {
284284 } )
285285 } }
286286 > </ SpMenu >
287+ < SpMenu
288+ title = "use textual inversion in your prompt"
289+ style = { { ...styles . spMenu } }
290+ items = { helper_store . data . embeddings }
291+ label_item = "Select Textual Inversion"
292+ onChange = { ( id : any , value : any ) => {
293+ const prompt = multiPrompts . getPrompt ( ) . positive
294+ multiPrompts . setPrompt ( {
295+ positive : `${ prompt } ${ value . item } ` ,
296+ } )
297+ } }
298+ > </ SpMenu >
287299
288300 < sp-checkbox
289301 title = "use {keyword} form the prompts library"
Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ export const helper_store = new AStore({
174174 b_show_sampler : false , //false when off, true when on,
175175 models : [ ] as any [ ] ,
176176 loras : [ ] as any [ ] ,
177+ embeddings : [ ] as any [ ] ,
177178 sampler_list : [ ] as any [ ] ,
178179 hr_upscaler_list : [ ] as string [ ] ,
179180 previous_width : 512 ,
@@ -366,6 +367,7 @@ export async function refreshUI() {
366367
367368 await refreshModels ( )
368369 helper_store . data . loras = await requestLoraModels ( )
370+ helper_store . data . embeddings = await requestEmbeddings ( )
369371 await refreshExtraUpscalers ( )
370372
371373 await setInpaintMaskWeight ( 1.0 ) //set the inpaint conditional mask to 1 when the on plugin start
@@ -433,6 +435,18 @@ export async function requestLoraModels() {
433435 return lora_models
434436}
435437
438+ export async function requestEmbeddings ( ) {
439+ try {
440+ const full_url = `${ g_sd_url } /sdapi/v1/embeddings`
441+ let results = ( await requestGet ( full_url ) ) || { }
442+ let embeddings = Object . keys ( results ?. loaded || { } )
443+ return embeddings
444+ } catch ( e ) {
445+ console . error ( e )
446+ return [ ]
447+ }
448+ }
449+
436450export function getLoraModelPrompt ( lora_model_name : string ) {
437451 return `<lora:${ lora_model_name } :1>`
438452}
Original file line number Diff line number Diff line change @@ -499,7 +499,7 @@ const Viewer = observer(() => {
499499 title = "expand the Photoshop masking by x pixels"
500500 >
501501 < sp-label slot = "label" >
502- { Locale ( 'Expand by' ) }
502+ { Locale ( 'Expand by' ) } { ' ' }
503503 </ sp-label >
504504 < sp-label slot = "label" >
505505 { mask_store . data . expand_by }
You can’t perform that action at this time.
0 commit comments