refactor(autocomplete): remove unused custom_words and embeddings modelTypes

This commit is contained in:
Will Miao
2026-08-06 15:28:58 +08:00
parent 186ef4da78
commit 027b504fe8
5 changed files with 20 additions and 32 deletions

View File

@@ -45,7 +45,7 @@ export interface AutocompleteTextWidgetInterface {
const props = defineProps<{ const props = defineProps<{
widget: AutocompleteTextWidgetInterface widget: AutocompleteTextWidgetInterface
node: { id: number } node: { id: number }
modelType?: 'loras' | 'embeddings' | 'custom_words' | 'prompt' modelType?: 'loras' | 'prompt'
placeholder?: string placeholder?: string
showPreview?: boolean showPreview?: boolean
spellcheck?: boolean spellcheck?: boolean

View File

@@ -3,7 +3,7 @@ import { ref, onMounted, onUnmounted, type Ref } from 'vue'
// Dynamic import type for AutoComplete class // Dynamic import type for AutoComplete class
type AutoCompleteClass = new ( type AutoCompleteClass = new (
inputElement: HTMLTextAreaElement, inputElement: HTMLTextAreaElement,
modelType: 'loras' | 'embeddings' | 'custom_words' | 'prompt', modelType: 'loras' | 'prompt',
options?: AutocompleteOptions options?: AutocompleteOptions
) => AutoCompleteInstance ) => AutoCompleteInstance
@@ -29,7 +29,7 @@ export interface UseAutocompleteOptions {
export function useAutocomplete( export function useAutocomplete(
textareaRef: Ref<HTMLTextAreaElement | null>, textareaRef: Ref<HTMLTextAreaElement | null>,
modelType: 'loras' | 'embeddings' | 'custom_words' | 'prompt' = 'loras', modelType: 'loras' | 'prompt' = 'loras',
options: UseAutocompleteOptions = {} options: UseAutocompleteOptions = {}
) { ) {
const autocompleteInstance = ref<AutoCompleteInstance | null>(null) const autocompleteInstance = ref<AutoCompleteInstance | null>(null)

View File

@@ -718,7 +718,7 @@ function createLoraInfoWidget(node: any) {
function createAutocompleteTextWidgetFactory( function createAutocompleteTextWidgetFactory(
node: any, node: any,
widgetName: string, widgetName: string,
modelType: 'loras' | 'embeddings' | 'prompt', modelType: 'loras' | 'prompt',
inputOptions: { placeholder?: string } = {} inputOptions: { placeholder?: string } = {}
) { ) {
const metadataWidgetName = `__lm_autocomplete_meta_${widgetName}` const metadataWidgetName = `__lm_autocomplete_meta_${widgetName}`
@@ -964,13 +964,7 @@ app.registerExtension({
const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {} const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {}
return createAutocompleteTextWidgetFactory(node, 'text', 'loras', options) return createAutocompleteTextWidgetFactory(node, 'text', 'loras', options)
}, },
// Autocomplete text widget for embeddings (used by Prompt node) // Autocomplete text widget for prompt (used by Prompt and Text nodes)
// @ts-ignore
AUTOCOMPLETE_TEXT_EMBEDDINGS(node) {
const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {}
return createAutocompleteTextWidgetFactory(node, 'text', 'embeddings', options)
},
// Autocomplete text widget for prompt (supports both embeddings and custom words)
// @ts-ignore // @ts-ignore
AUTOCOMPLETE_TEXT_PROMPT(node) { AUTOCOMPLETE_TEXT_PROMPT(node) {
const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {} const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {}

View File

@@ -2118,14 +2118,14 @@ to { transform: rotate(360deg);
padding: 20px 0; padding: 20px 0;
} }
.autocomplete-text-widget[data-v-3f3d7a1a] { .autocomplete-text-widget[data-v-55e3316e] {
background: transparent; background: transparent;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-sizing: border-box; box-sizing: border-box;
} }
.input-wrapper[data-v-3f3d7a1a] { .input-wrapper[data-v-55e3316e] {
position: relative; position: relative;
flex: 1; flex: 1;
display: flex; display: flex;
@@ -2133,7 +2133,7 @@ to { transform: rotate(360deg);
} }
/* Canvas mode styles (default) - matches built-in comfy-multiline-input */ /* Canvas mode styles (default) - matches built-in comfy-multiline-input */
.text-input[data-v-3f3d7a1a] { .text-input[data-v-55e3316e] {
flex: 1; flex: 1;
width: 100%; width: 100%;
background-color: var(--comfy-input-bg, #222); background-color: var(--comfy-input-bg, #222);
@@ -2152,7 +2152,7 @@ to { transform: rotate(360deg);
} }
/* Vue DOM mode styles - matches built-in p-textarea in Vue DOM mode */ /* Vue DOM mode styles - matches built-in p-textarea in Vue DOM mode */
.text-input.vue-dom-mode[data-v-3f3d7a1a] { .text-input.vue-dom-mode[data-v-55e3316e] {
background-color: var(--color-charcoal-400, #313235); background-color: var(--color-charcoal-400, #313235);
color: #fff; color: #fff;
padding: 8px 12px 30px 12px; /* Reserve bottom space for clear button */ padding: 8px 12px 30px 12px; /* Reserve bottom space for clear button */
@@ -2161,12 +2161,12 @@ to { transform: rotate(360deg);
font-size: 12px; font-size: 12px;
font-family: inherit; font-family: inherit;
} }
.text-input[data-v-3f3d7a1a]:focus { .text-input[data-v-55e3316e]:focus {
outline: none; outline: none;
} }
/* Clear button styles */ /* Clear button styles */
.clear-button[data-v-3f3d7a1a] { .clear-button[data-v-55e3316e] {
position: absolute; position: absolute;
right: 6px; right: 6px;
bottom: 6px; /* Changed from top to bottom */ bottom: 6px; /* Changed from top to bottom */
@@ -2189,31 +2189,31 @@ to { transform: rotate(360deg);
} }
/* Show clear button when hovering over input wrapper */ /* Show clear button when hovering over input wrapper */
.input-wrapper:hover .clear-button[data-v-3f3d7a1a] { .input-wrapper:hover .clear-button[data-v-55e3316e] {
opacity: 0.7; opacity: 0.7;
pointer-events: auto; pointer-events: auto;
} }
.clear-button[data-v-3f3d7a1a]:hover { .clear-button[data-v-55e3316e]:hover {
opacity: 1; opacity: 1;
background: rgba(255, 100, 100, 0.8); background: rgba(255, 100, 100, 0.8);
} }
.clear-button svg[data-v-3f3d7a1a] { .clear-button svg[data-v-55e3316e] {
width: 12px; width: 12px;
height: 12px; height: 12px;
} }
/* Vue DOM mode adjustments for clear button */ /* Vue DOM mode adjustments for clear button */
.text-input.vue-dom-mode ~ .clear-button[data-v-3f3d7a1a] { .text-input.vue-dom-mode ~ .clear-button[data-v-55e3316e] {
right: 8px; right: 8px;
bottom: 10px; /* Changed from top to bottom, adjusted for Vue DOM padding */ bottom: 10px; /* Changed from top to bottom, adjusted for Vue DOM padding */
width: 20px; width: 20px;
height: 20px; height: 20px;
background: rgba(107, 114, 128, 0.6); background: rgba(107, 114, 128, 0.6);
} }
.text-input.vue-dom-mode ~ .clear-button[data-v-3f3d7a1a]:hover { .text-input.vue-dom-mode ~ .clear-button[data-v-55e3316e]:hover {
background: oklch(62% 0.18 25); background: oklch(62% 0.18 25);
} }
.text-input.vue-dom-mode ~ .clear-button svg[data-v-3f3d7a1a] { .text-input.vue-dom-mode ~ .clear-button svg[data-v-55e3316e] {
width: 14px; width: 14px;
height: 14px; height: 14px;
} }
@@ -15316,7 +15316,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
}; };
} }
}); });
const AutocompleteTextWidget = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3f3d7a1a"]]); const AutocompleteTextWidget = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-55e3316e"]]);
const _hoisted_1 = { class: "lora-info-tabs" }; const _hoisted_1 = { class: "lora-info-tabs" };
const _hoisted_2 = { class: "tab-content notes-tab" }; const _hoisted_2 = { class: "tab-content notes-tab" };
const _hoisted_3 = { class: "info-field" }; const _hoisted_3 = { class: "info-field" };
@@ -16747,13 +16747,7 @@ app$1.registerExtension({
const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {}; const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {};
return createAutocompleteTextWidgetFactory(node, "text", "loras", options); return createAutocompleteTextWidgetFactory(node, "text", "loras", options);
}, },
// Autocomplete text widget for embeddings (used by Prompt node) // Autocomplete text widget for prompt (used by Prompt and Text nodes)
// @ts-ignore
AUTOCOMPLETE_TEXT_EMBEDDINGS(node) {
const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {};
return createAutocompleteTextWidgetFactory(node, "text", "embeddings", options);
},
// Autocomplete text widget for prompt (supports both embeddings and custom words)
// @ts-ignore // @ts-ignore
AUTOCOMPLETE_TEXT_PROMPT(node) { AUTOCOMPLETE_TEXT_PROMPT(node) {
const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {}; const options = widgetInputOptions.get(`${node.comfyClass}:text`) || {};

File diff suppressed because one or more lines are too long