Skip to content

Commit efe4d91

Browse files
committed
更新版本V0.0.54
更新版本V0.0.54
1 parent f1f0a6e commit efe4d91

31 files changed

+3838
-584
lines changed

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,41 @@
2828

2929
# 版本更新介绍
3030

31-
> 最新更新:2025-04-30
31+
> 最新更新:2025-05-07
3232
33-
> 0.0.53 公测版本介绍 如果你要使用本插件请务必进我们的官方 QQ 群(1018231382)!
33+
> 0.0.54 公测版本介绍 如果你要使用本插件请务必进我们的官方 QQ 群(1018231382)!
3434
>
35-
> 1. 功能优化:修复了在日间模式下的Lora详细内容的按钮样式看不到问题
35+
> 1. 修复了已知BUG
3636
>
37-
> 2. 修复了issues [#14](https://github.com/weilin9999/WeiLin-Comfyui-Tools/issues/14#issuecomment-2840561525) 当第一行只有一个Tag的时候会触发换行不添加末尾逗号
37+
> 2. 修改Lora悬浮卡片的大小了位置
38+
>
39+
> 3. 功能升级:悬浮球可自定义皮肤和颜色
40+
>
41+
> 4. 功能优化:历史记录信息简化显示
42+
>
43+
> 5. 新增功能:随机Tag功能,可以设定模板,一键随机Tag
44+
>
45+
> 6. 功能优化:Tag管理器的分类栏可以修改顺序和位置
46+
>
47+
> 7. 功能优化:Tag管理器搜索的匹配结果更精确
48+
>
49+
> 8. 小功能:输入框左下角添加了Token长度显示
50+
>
51+
> 9. 修复输入框记录高度小概率触发高度变成很矮的情况
52+
>
53+
> 10. 插件有新版本时窗口左下角会提示更新
3854
>
3955
4056
<details>
4157
<summary>点击查看往期更多更新内容</summary>
4258

59+
> 0.0.53 公测版本介绍 2025-04-30
60+
>
61+
> 1. 功能优化:修复了在日间模式下的Lora详细内容的按钮样式看不到问题
62+
>
63+
> 2. 修复了issues [#14](https://github.com/weilin9999/WeiLin-Comfyui-Tools/issues/14#issuecomment-2840561525) 当第一行只有一个Tag的时候会触发换行不添加末尾逗号
64+
>
65+
4366
> 0.0.52 公测版本介绍 2025-04-28
4467
>
4568
> 1. 新增功能:Lora详细界面内可以自定义自己的字段

README_EN.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,41 @@ Due to limited personal time, the frequency of updating plug-ins will not be ver
2424

2525
# Version update introduction
2626

27-
> Last updated: 2025-04-30
27+
> Last updated: 2025-05-07
2828
29-
> 0.0.53 Public Beta Version Introduction: If you want to use this plugin, please be sure to join our official QQ group (1018231382)!
29+
> 0.0.54 Public Beta Version Introduction: If you want to use this plugin, please be sure to join our official QQ group (1018231382)!
3030
>
31-
> 1. Feature optimization: Fixed the issue that Lora details button style could not be seen in daytime mode
31+
> 1. Fixed known bugs
3232
>
33-
> 2. Repair the issues [#14](https://github.com/weilin9999/WeiLin-Comfyui-Tools/issues/14#issuecomment-2840561525) When the first line has only one Tag, a newline is triggered without the trailing comma
33+
> 2. Changed the size and position of the Lora hover card
34+
>
35+
> 3. Feature upgrade: The hover ball can be customized with skin and color
36+
>
37+
> 4. Function optimization: History information simplified display
38+
>
39+
> 5. New function: random Tag function, you can set the template, one key random Tag
40+
>
41+
> 6. Feature optimization: The category bar of the Tag manager can be changed in order and position
42+
>
43+
> 7. Feature optimization: Tag Manager searches for more accurate matches
44+
>
45+
> 8. Small feature: Added Token length display in bottom left corner of input field
46+
>
47+
> 9. Fixed the case where the input field record height had a low probability of triggering the height to be very low
48+
>
49+
> 10. The lower left corner of the window will prompt for updates when a new version of the plugin is available
3450
>
3551
3652
<details>
3753
<summary>Click here for more updates from the past</summary>
3854

55+
> 0.0.53 Public Beta Version 2025-04-30
56+
>
57+
> 1. Feature optimization: Fixed the issue that Lora details button style could not be seen in daytime mode
58+
>
59+
> 2. Repair the issues [#14](https://github.com/weilin9999/WeiLin-Comfyui-Tools/issues/14#issuecomment-2840561525) When the first line has only one Tag, a newline is triggered without the trailing comma
60+
>
61+
3962
> 0.0.52 Public Beta Version Last updated: 2025-04-28
4063
>
4164
> 1. New feature: Within the Lora detailed interface, you can customize your own fields

app/server/dao/dao.py

Lines changed: 95 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -278,65 +278,38 @@ def add_column_if_not_exists(table, column, column_type):
278278
conn.commit()
279279
conn.close()
280280

281-
# 添加版本3的迁移(移除外键)
282-
# if current_version < 3:
283-
# conn = sqlite3.connect(tags_db_path)
284-
# cursor = conn.cursor()
285-
286-
# # 重建表结构(移除外键)
287-
# cursor.execute('''
288-
# CREATE TABLE IF NOT EXISTS tag_groups_new (
289-
# id_index INTEGER PRIMARY KEY AUTOINCREMENT,
290-
# name TEXT,
291-
# color TEXT,
292-
# create_time INTEGER,
293-
# p_uuid TEXT(128)
294-
# )
295-
# ''')
296-
297-
# cursor.execute('''
298-
# CREATE TABLE IF NOT EXISTS tag_subgroups_new (
299-
# id_index INTEGER PRIMARY KEY AUTOINCREMENT,
300-
# group_id INTEGER,
301-
# name TEXT,
302-
# color TEXT,
303-
# create_time INTEGER,
304-
# p_uuid TEXT(128),
305-
# g_uuid TEXT(128)
306-
# )
307-
# ''')
281+
# 添加版本3的迁移
282+
if current_version < 3:
283+
print("检测到数据库版本变动 版本V3 正在升级中...")
284+
conn = sqlite3.connect(tags_db_path)
285+
cursor = conn.cursor()
308286

309-
# cursor.execute('''
310-
# CREATE TABLE IF NOT EXISTS tag_tags_new (
311-
# id_index INTEGER PRIMARY KEY AUTOINCREMENT,
312-
# subgroup_id INTEGER,
313-
# text TEXT,
314-
# desc TEXT,
315-
# color TEXT,
316-
# create_time INTEGER,
317-
# t_uuid TEXT(128),
318-
# g_uuid TEXT(128)
319-
# )
320-
# ''')
287+
# 检查并添加新字段(如果不存在)
288+
def add_column_if_not_exists(table, column, column_type):
289+
cursor.execute(f"PRAGMA table_info({table})")
290+
columns = [info[1] for info in cursor.fetchall()]
291+
if column not in columns:
292+
cursor.execute(f"ALTER TABLE {table} ADD COLUMN {column} {column_type}")
321293

322-
# # 迁移数据
323-
# cursor.execute('INSERT INTO tag_groups_new SELECT * FROM tag_groups')
324-
# cursor.execute('INSERT INTO tag_subgroups_new SELECT * FROM tag_subgroups')
325-
# cursor.execute('INSERT INTO tag_tags_new SELECT * FROM tag_tags')
294+
# 确保所有表都有UUID字段
295+
add_column_if_not_exists('tag_groups', 'p_uuid', 'TEXT(128)')
296+
add_column_if_not_exists('tag_subgroups', 'p_uuid', 'TEXT(128)')
297+
add_column_if_not_exists('tag_subgroups', 'g_uuid', 'TEXT(128)')
298+
add_column_if_not_exists('tag_tags', 't_uuid', 'TEXT(128)')
299+
add_column_if_not_exists('tag_tags', 'g_uuid', 'TEXT(128)')
326300

327-
# # 删除旧表
328-
# cursor.execute('DROP TABLE tag_groups')
329-
# cursor.execute('DROP TABLE tag_subgroups')
330-
# cursor.execute('DROP TABLE tag_tags')
301+
# 更新所有UUID字段
302+
update_uuids_v3(conn)
331303

332-
# # 重命名新表
333-
# cursor.execute('ALTER TABLE tag_groups_new RENAME TO tag_groups')
334-
# cursor.execute('ALTER TABLE tag_subgroups_new RENAME TO tag_subgroups')
335-
# cursor.execute('ALTER TABLE tag_tags_new RENAME TO tag_tags')
304+
# 添加唯一索引
305+
cursor.execute('CREATE UNIQUE INDEX IF NOT EXISTS idx_tag_groups_p_uuid ON tag_groups(p_uuid)')
306+
cursor.execute('CREATE UNIQUE INDEX IF NOT EXISTS idx_tag_subgroups_g_uuid ON tag_subgroups(g_uuid)')
307+
cursor.execute('CREATE UNIQUE INDEX IF NOT EXISTS idx_tag_tags_t_uuid ON tag_tags(t_uuid)')
336308

337-
# conn.commit()
338-
# conn.close()
339-
# update_version('tags', 3)
309+
update_version('tags', 3)
310+
conn.commit()
311+
conn.close()
312+
print("升级完成")
340313

341314
# history数据库迁移
342315
current_version = get_current_version('history')
@@ -453,6 +426,74 @@ def update_uuids(conn):
453426
conn.rollback()
454427
raise
455428

429+
def update_uuids_v3(conn):
430+
"""根据SQL文件中的固定UUID更新所有表的UUID字段"""
431+
cursor = conn.cursor()
432+
print("开始更新Tag数据 V3...")
433+
try:
434+
# 1. 确保所有tag_groups都有p_uuid
435+
cursor.execute("SELECT id_index FROM tag_groups WHERE p_uuid IS NULL OR p_uuid = ''")
436+
empty_groups = cursor.fetchall()
437+
for group in empty_groups:
438+
group_id = group[0]
439+
new_uuid = getUUID()
440+
cursor.execute("UPDATE tag_groups SET p_uuid = ? WHERE id_index = ?", (new_uuid, group_id))
441+
442+
# 2. 更新tag_subgroups的p_uuid和g_uuid
443+
cursor.execute('''
444+
SELECT sg.id_index, g.p_uuid
445+
FROM tag_subgroups sg
446+
LEFT JOIN tag_groups g ON sg.group_id = g.id_index
447+
WHERE sg.p_uuid IS NULL OR sg.p_uuid = '' OR sg.g_uuid IS NULL OR sg.g_uuid = ''
448+
''')
449+
subgroups = cursor.fetchall()
450+
for subgroup in subgroups:
451+
subgroup_id, group_p_uuid = subgroup
452+
new_g_uuid = getUUID()
453+
if group_p_uuid: # 如果找到对应的group
454+
cursor.execute('''
455+
UPDATE tag_subgroups
456+
SET p_uuid = ?, g_uuid = ?
457+
WHERE id_index = ?
458+
''', (group_p_uuid, new_g_uuid, subgroup_id))
459+
else: # 如果没有对应的group,只设置g_uuid
460+
cursor.execute('''
461+
UPDATE tag_subgroups
462+
SET g_uuid = ?
463+
WHERE id_index = ?
464+
''', (new_g_uuid, subgroup_id))
465+
466+
# 3. 更新tag_tags的g_uuid和t_uuid
467+
cursor.execute('''
468+
SELECT t.id_index, sg.g_uuid
469+
FROM tag_tags t
470+
LEFT JOIN tag_subgroups sg ON t.subgroup_id = sg.id_index
471+
WHERE t.g_uuid IS NULL OR t.g_uuid = '' OR t.t_uuid IS NULL OR t.t_uuid = ''
472+
''')
473+
tags = cursor.fetchall()
474+
for tag in tags:
475+
tag_id, subgroup_g_uuid = tag
476+
new_t_uuid = getUUID()
477+
if subgroup_g_uuid: # 如果找到对应的subgroup
478+
cursor.execute('''
479+
UPDATE tag_tags
480+
SET g_uuid = ?, t_uuid = ?
481+
WHERE id_index = ?
482+
''', (subgroup_g_uuid, new_t_uuid, tag_id))
483+
else: # 如果没有对应的subgroup,只设置t_uuid
484+
cursor.execute('''
485+
UPDATE tag_tags
486+
SET t_uuid = ?
487+
WHERE id_index = ?
488+
''', (new_t_uuid, tag_id))
489+
490+
conn.commit()
491+
print("Tag数据更新完成。")
492+
except Exception as e:
493+
print(f"更新UUID时出错: {e}")
494+
conn.rollback()
495+
raise
496+
456497
def migrate_old_db():
457498
if os.path.exists(db_path):
458499
try:

0 commit comments

Comments
 (0)