Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 101 additions & 96 deletions dist/javascript/main.entry.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/javascript/main.entry.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/style.css

Large diffs are not rendered by default.

41 changes: 33 additions & 8 deletions js_node/weilin_prompt_ui_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ app.registerExtension({

const thisNodeName = nodeData.name // 存储当前的节点名称
let nodeTextAreaList = [] // 按顺序载入element,name="positive" || "lora_str" || "temp_str"
let nodeWidgetList = [] // ✅ 新增:保存widget引用,用于同步更新widget.value
const thisNodeSeed = generateUUID(); // 随机唯一种子ID

if (nodeData.name === "WeiLinPromptUI" || nodeData.name === "WeiLinPromptUIWithoutLora") {
Expand All @@ -133,22 +134,27 @@ app.registerExtension({
let thisInputElement = widgetItem.element
// thisInputElement.readOnly = true
nodeTextAreaList[0] = thisInputElement
nodeWidgetList[0] = widgetItem // ✅ 保存widget引用
} else if (widgetItem.name == "lora_str") {
let thisInputElement = widgetItem.element
thisInputElement.readOnly = true
nodeTextAreaList[1] = thisInputElement
nodeWidgetList[1] = widgetItem // ✅ 保存widget引用
} else if (widgetItem.name == "temp_str") {
let thisInputElement = widgetItem.element
thisInputElement.readOnly = true
nodeTextAreaList[2] = thisInputElement
nodeWidgetList[2] = widgetItem // ✅ 保存widget引用
} else if (widgetItem.name == "temp_lora_str") {
let thisInputElement = widgetItem.element
thisInputElement.readOnly = true
nodeTextAreaList[3] = thisInputElement
nodeWidgetList[3] = widgetItem // ✅ 保存widget引用
} else if (widgetItem.name == "random_template") {
let thisInputElement = widgetItem.element
thisInputElement.readOnly = true
nodeTextAreaList[4] = thisInputElement
nodeWidgetList[4] = widgetItem // ✅ 保存widget引用
}
}

Expand Down Expand Up @@ -313,27 +319,35 @@ app.registerExtension({
const jsonReponse = JSON.parse(event.data.data)
// console.log(jsonReponse)
nodeTextAreaList[0].value = jsonReponse.prompt;
// ✅ 修复:同时更新widget.value,确保序列化时获取最新值
if (nodeWidgetList[0]) nodeWidgetList[0].value = jsonReponse.prompt;

if (nodeData.name === "WeiLinPromptUI") {
// console.log(jsonReponse.lora.length)
if (jsonReponse.lora && jsonReponse.lora.length > 0 && jsonReponse.lora != "") {
nodeTextAreaList[1].value = JSON.stringify(jsonReponse.lora);
if (nodeWidgetList[1]) nodeWidgetList[1].value = JSON.stringify(jsonReponse.lora);
} else {
nodeTextAreaList[1].value = "";
if (nodeWidgetList[1]) nodeWidgetList[1].value = "";
}
}

if (jsonReponse.temp_prompt && jsonReponse.temp_prompt != "") {
nodeTextAreaList[2].value = JSON.stringify(jsonReponse.temp_prompt);
if (nodeWidgetList[2]) nodeWidgetList[2].value = JSON.stringify(jsonReponse.temp_prompt);
}else {
nodeTextAreaList[2].value = "";
if (nodeWidgetList[2]) nodeWidgetList[2].value = "";
}

if (nodeData.name === "WeiLinPromptUI") {
if (jsonReponse.temp_lora && jsonReponse.temp_lora != "") {
nodeTextAreaList[3].value = JSON.stringify(jsonReponse.temp_lora);
if (nodeWidgetList[3]) nodeWidgetList[3].value = JSON.stringify(jsonReponse.temp_lora);
}else {
nodeTextAreaList[3].value = "";
if (nodeWidgetList[3]) nodeWidgetList[3].value = "";
}
}

Expand Down Expand Up @@ -381,14 +395,18 @@ app.registerExtension({
// console.log(jsonReponse.lora.length)
if (jsonReponse.lora && jsonReponse.lora.length > 0 && jsonReponse.lora != "") {
nodeTextAreaList[1].value = JSON.stringify(jsonReponse.lora);
if (nodeWidgetList[1]) nodeWidgetList[1].value = JSON.stringify(jsonReponse.lora);
} else {
nodeTextAreaList[1].value = "";
if (nodeWidgetList[1]) nodeWidgetList[1].value = "";
}

if (jsonReponse.temp_lora && jsonReponse.temp_lora != "") {
nodeTextAreaList[3].value = JSON.stringify(jsonReponse.temp_lora);
if (nodeWidgetList[3]) nodeWidgetList[3].value = JSON.stringify(jsonReponse.temp_lora);
}else{
nodeTextAreaList[3].value = "";
if (nodeWidgetList[3]) nodeWidgetList[3].value = "";
}

if (nodeTextAreaList[3].value.length > 0) {
Expand All @@ -405,19 +423,24 @@ app.registerExtension({
if (nodeData.name === "WeiLinPromptUIOnlyLoraStack") {
if (jsonReponse.lora && jsonReponse.lora.length > 0 && jsonReponse.lora != "") {
nodeTextAreaList[1].value = JSON.stringify(jsonReponse.lora);
if (nodeWidgetList[1]) nodeWidgetList[1].value = JSON.stringify(jsonReponse.lora);
} else {
nodeTextAreaList[1].value = "";
if (nodeWidgetList[1]) nodeWidgetList[1].value = "";
}
if (jsonReponse.temp_lora && jsonReponse.temp_lora != "") {
nodeTextAreaList[3].value = JSON.stringify(jsonReponse.temp_lora);
if (nodeWidgetList[3]) nodeWidgetList[3].value = JSON.stringify(jsonReponse.temp_lora);
}else{
nodeTextAreaList[3].value = "";
if (nodeWidgetList[3]) nodeWidgetList[3].value = "";
}
}
}else if (event.data.type === "weilin_prompt_ui_selectLora_stack_node_"+thisNodeSeed) {
addLora(thisNodeSeed,event.data.lora)
}else if (event.data.type === "weilin_prompt_ui_update_template_"+randomID) {
nodeTextAreaList[4].value = event.data.data
if (nodeWidgetList[4]) nodeWidgetList[4].value = event.data.data
}else if (event.data.type === "weilin_prompt_ui_get_template_"+randomID) {
window.parent.postMessage({ type: 'weilin_prompt_ui_get_template_response', id: randomID, data: nodeTextAreaList[4].value }, '*')
}else if (event.data.type === "weilin_prompt_ui_get_template_go_random_"+randomID) {
Expand All @@ -433,14 +456,16 @@ app.registerExtension({
const onExecuted = nodeType.prototype.onExecuted;
nodeType.prototype.onExecuted = function (message) {
onExecuted?.apply(this, arguments);
const positiveWidget = this.widgets.find(w => w.name === "positive");
if (positiveWidget && message.positive) {
positiveWidget.element.value = message.positive;
// 触发input事件以更新全局状态
const event = new Event('input', { bubbles: true });
positiveWidget.element.dispatchEvent(event);
}
// console.log(message.positive)
// ✅ 修复:禁用 onExecuted 中的覆盖逻辑
// 前端已经通过 postMessageToWindowsPrompt 同步数据到节点
// 不再需要用后端返回的旧值覆盖前端
// if (!message) return;
// const positiveWidget = this.widgets.find(w => w.name === "positive");
// if (positiveWidget && message.positive) {
// positiveWidget.element.value = message.positive;
// const event = new Event('input', { bubbles: true });
// positiveWidget.element.dispatchEvent(event);
// }
};
}
},
Expand Down
5 changes: 5 additions & 0 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/src/view/prompt_box/prompt_index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1858,10 +1858,11 @@ const processInput = async () => {
if (proceTimeout.value) {
clearTimeout(proceTimeout.value);
}
// ✅ 修复:减少延迟时间从1000ms到100ms
proceTimeout.value = setTimeout(() => {
// console.log('处理历史记录');
finishPromptPutItHistory();
}, 1000);
}, 100); // 从1000改为100
postMessageToWindowsPrompt();
// 处理翻译
Expand Down Expand Up @@ -3180,6 +3181,11 @@ const handleMessage = (event) => {
lastInputValue.value = inputText.value; // 更新上一次的输入内容
// 触发输入事件以更新词组
processInput()
// ✅ 修复:确保数据立即同步到节点
nextTick(() => {
finishPromptPutItHistory();
});
} else if (event.data.type === 'weilin_prompt_ui_user_history_tag') {
const tagText = event.data.tagText
tempInputText.value = tagText
Expand Down
64 changes: 52 additions & 12 deletions src/src/view/tag_manager/tag_index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<!-- 高级设置 -->
<div class="toolbar-bottom">
<div class="group-edit-mode">
<div class="auto-add-checkbox">
<label>
<input type="checkbox" v-model="isAutoAddSearchTag" :true-value="1" :false-value="0" />
{{ t('tagManager.autoAddSearchTag') }}
Expand Down Expand Up @@ -1607,30 +1607,36 @@ const resetTabSizeConfig = () => {
.tag-manager {
display: flex;
flex-direction: column;
padding: 0 16px 16px 16px;
padding: 0;
background: var(--weilin-prompt-ui-primary-bg);
height: 100%;
box-sizing: border-box;
overflow-y: auto;
overflow-x: hidden;
}

.category-tabs {
display: flex;
flex-direction: column;
gap: 16px;
margin-bottom: 16px;
margin-top: 0;
flex-shrink: 0;
padding-top: 8px;
}

.tabs-wrapper {
position: relative;
border-bottom: 1px solid var(--weilin-prompt-ui-border-color);
margin-top: 0;
}

.tabs-scroll {
display: flex;
gap: 2px;
padding: 0 2px 2px;
flex-wrap: wrap;
align-items: flex-end;
align-items: center;
}

/* 自定义滚动条样式 */
Expand Down Expand Up @@ -2212,6 +2218,8 @@ const resetTabSizeConfig = () => {
.search-container {
position: relative;
z-index: 100;
flex: 1;
min-width: 0;
}

.search-input {
Expand All @@ -2222,6 +2230,13 @@ const resetTabSizeConfig = () => {
background: var(--weilin-prompt-ui-input-bg);
color: var(--weilin-prompt-ui-primary-text);
font-size: 14px;
height: 32px;
box-sizing: border-box;
}

.search-input::placeholder {
color: var(--weilin-prompt-ui-secondary-text);
opacity: 1;
}

.search-input:focus {
Expand All @@ -2232,9 +2247,6 @@ const resetTabSizeConfig = () => {

.search-results {
position: fixed;
top: 60px;
left: 0;
right: 0;
max-height: 300px;
overflow-y: auto;
background: var(--weilin-prompt-ui-primary-bg);
Expand Down Expand Up @@ -2301,8 +2313,14 @@ const resetTabSizeConfig = () => {
}

.toolbar {
display: flex;
flex-direction: column;
padding: 12px 16px;
padding: 0 0 12px 0;
flex-shrink: 0;
margin-bottom: 16px;
border-bottom: 1px solid var(--weilin-prompt-ui-border-color);
min-height: fit-content;
height: auto;
}

.toolbar .toolbar-top {
Expand Down Expand Up @@ -2335,10 +2353,6 @@ const resetTabSizeConfig = () => {
fill: var(--weilin-prompt-ui-primary-text);
}

.search-container {
flex: 1;
}

.tags-actions {
width: fit-content;
display: flex;
Expand All @@ -2362,7 +2376,29 @@ const resetTabSizeConfig = () => {
display: flex;
align-items: center;
gap: 12px;
margin-top: 5px;
margin-top: 8px;
padding-bottom: 8px;
}

.auto-add-checkbox {
display: inline-flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: var(--weilin-prompt-ui-primary-text);
}

.auto-add-checkbox label {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
}

.auto-add-checkbox input[type="checkbox"] {
width: 16px;
height: 16px;
cursor: pointer;
}

.group-edit-mode {
Expand Down Expand Up @@ -2410,6 +2446,10 @@ const resetTabSizeConfig = () => {
color: white;
cursor: pointer;
transition: all 0.3s ease;
height: 32px;
box-sizing: border-box;
white-space: nowrap;
flex-shrink: 0;
}

.import-btn:hover {
Expand Down
9 changes: 9 additions & 0 deletions tag_labels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"items": [],
"settings": {
"sortMode": "time",
"sortTimeDesc": true,
"sortNameAsc": true,
"selectedId": null
}
}