提交 662d2f1e 编写于 作者: A Abdullah Alfaraj

add textural inversion menu

上级 df868ddb
......@@ -284,6 +284,18 @@ class SDTab extends React.Component<{}> {
})
}}
></SpMenu>
<SpMenu
title="use textual inversion in your prompt"
style={{ ...styles.spMenu }}
items={helper_store.data.embeddings}
label_item="Select Textual Inversion"
onChange={(id: any, value: any) => {
const prompt = multiPrompts.getPrompt().positive
multiPrompts.setPrompt({
positive: `${prompt} ${value.item}`,
})
}}
></SpMenu>
<sp-checkbox
title="use {keyword} form the prompts library"
......
......@@ -174,6 +174,7 @@ export const helper_store = new AStore({
b_show_sampler: false, //false when off, true when on,
models: [] as any[],
loras: [] as any[],
embeddings: [] as any[],
sampler_list: [] as any[],
hr_upscaler_list: [] as string[],
previous_width: 512,
......@@ -366,6 +367,7 @@ export async function refreshUI() {
await refreshModels()
helper_store.data.loras = await requestLoraModels()
helper_store.data.embeddings = await requestEmbeddings()
await refreshExtraUpscalers()
await setInpaintMaskWeight(1.0) //set the inpaint conditional mask to 1 when the on plugin start
......@@ -433,6 +435,18 @@ export async function requestLoraModels() {
return lora_models
}
export async function requestEmbeddings() {
try {
const full_url = `${g_sd_url}/sdapi/v1/embeddings`
let results = (await requestGet(full_url)) || {}
let embeddings = Object.keys(results?.loaded || {})
return embeddings
} catch (e) {
console.error(e)
return []
}
}
export function getLoraModelPrompt(lora_model_name: string) {
return `<lora:${lora_model_name}:1>`
}
......
......@@ -499,7 +499,7 @@ const Viewer = observer(() => {
title="expand the Photoshop masking by x pixels"
>
<sp-label slot="label">
{Locale('Expand by')}
{Locale('Expand by')}{' '}
</sp-label>
<sp-label slot="label">
{mask_store.data.expand_by}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册