Oosayam commited on
Commit
4f7e8eb
·
verified ·
1 Parent(s): cf2466b

Upload z_image_json_prompt.py

Browse files
Files changed (1) hide show
  1. z_image_json_prompt.py +1123 -0
z_image_json_prompt.py ADDED
@@ -0,0 +1,1123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import random
3
+ import time
4
+ import json
5
+ import shutil
6
+ from datetime import datetime
7
+
8
+ class ZImageJSONPrompting:
9
+ # 定義所有選項內容(保持雙語內容)
10
+ OPTION_DATA = {
11
+ "scene": {
12
+ "scene_description.txt": [
13
+ "霓虹閃爍的賽博朋克街道 | Neon-lit cyberpunk street",
14
+ "寧靜的日式庭院 | Tranquil Japanese garden",
15
+ "繁忙的現代都市街頭 | Busy modern city street",
16
+ "神秘的遠古遺跡 | Mysterious ancient ruins",
17
+ "夢幻的童話森林 | Enchanted fairy tale forest",
18
+ "科幻的太空站內景 | Sci-fi space station interior",
19
+ "古典的歐洲城堡大廳 | Classical European castle hall",
20
+ "炎熱的沙漠綠洲 | Hot desert oasis",
21
+ "寒冷的北極冰川 | Cold arctic glacier",
22
+ "雨後的都市夜景 | City night scene after rain",
23
+ "霧氣瀰漫的山林小徑 | Misty mountain forest path",
24
+ "繁華的夜市小吃街 | Bustling night market street",
25
+ "廢棄的工業廠房 | Abandoned industrial factory",
26
+ "未來主義的實驗室 | Futuristic laboratory",
27
+ "熱帶海島沙灘 | Tropical island beach",
28
+ "秋天的楓葉公園 | Autumn maple leaf park",
29
+ "星空下的草原 | Grassland under starry sky",
30
+ "水下珊瑚礁世界 | Underwater coral reef world",
31
+ "蒸汽龐克風格城市 | Steampunk-style city",
32
+ "末日後的廢墟都市 | Post-apocalyptic ruined city",
33
+ "魔幻的空中浮島 | Magical floating island in sky",
34
+ "傳統的中式古鎮 | Traditional Chinese ancient town",
35
+ "現代的購物中心 | Modern shopping mall",
36
+ "寧靜的圖書館內景 | Quiet library interior",
37
+ "熱鬧的音樂節現場 | Lively music festival scene"
38
+ ],
39
+ "time_atmosphere.txt": [
40
+ "黃金時刻的溫暖陽光 | Warm sunlight during golden hour",
41
+ "深夜的神秘月光 | Mysterious moonlight late at night",
42
+ "午後的柔和光線 | Soft afternoon light",
43
+ "黎明的曙光微露 | First light of dawn",
44
+ "黃昏的浪漫餘暉 | Romantic glow of dusk",
45
+ "正午的強烈陽光 | Strong midday sunlight",
46
+ "暴風雨前的壓抑氛圍 | Oppressive atmosphere before storm",
47
+ "霧氣瀰漫的清晨 | Misty morning",
48
+ "晴朗無雲的藍天 | Clear cloudless blue sky",
49
+ "多雲的陰天光線 | Cloudy overcast light",
50
+ "暴雨中的模糊景象 | Blurred scene in heavy rain",
51
+ "薄霧籠罩的夜晚 | Thin fog shrouded night",
52
+ "夕陽西下的剪影 | Silhouette at sunset",
53
+ "月光如水灑落 | Moonlight shining like water",
54
+ "清晨露珠晶瑩 | Morning dew sparkling",
55
+ "午後雷陣雨後 | Afternoon after thunderstorm",
56
+ "深夜街燈昏黃 | Late night street lamps dim yellow",
57
+ "極光舞動的天空 | Aurora dancing in the sky",
58
+ "煙火綻放的夜晚 | Fireworks blooming night",
59
+ "燭光搖曳的室內 | Candlelight flickering indoors",
60
+ "霓虹燈閃爍的雨夜 | Neon lights flickering on rainy night",
61
+ "日出時分的寧靜 | Peaceful at sunrise",
62
+ "日落時分的溫暖 | Warm at sunset",
63
+ "午夜的神秘時刻 | Mysterious midnight moment",
64
+ "午夜的寂靜時刻 | Silent midnight moment"
65
+ ],
66
+ "environment_setting.txt": [
67
+ "潮濕的街道反射燈光 | Wet streets reflecting lights",
68
+ "乾燥的沙漠風吹沙粒 | Dry desert with blowing sand",
69
+ "綠意盎然的自然環境 | Lush green natural environment",
70
+ "鋼筋混凝土的都市叢林 | Concrete jungle of the city",
71
+ "水晶般清澈的水下世界 | Crystal clear underwater world",
72
+ "煙霧繚繞的神秘空間 | Smoke-filled mysterious space",
73
+ "積雪覆蓋的冬日景觀 | Snow-covered winter landscape",
74
+ "落葉繽紛的秋季公園 | Autumn park with falling leaves",
75
+ "花卉盛開的春季花園 | Spring garden in full bloom",
76
+ "高科技的未來實驗室 | High-tech futuristic laboratory",
77
+ "藤蔓纏繞的古老建築 | Vine-covered ancient building",
78
+ "玻璃幕牆的現代大樓 | Glass curtain wall modern building",
79
+ "鵝卵石鋪成的古老街道 | Cobblestone ancient street",
80
+ "金屬結構的工業廠房 | Metal structured industrial factory",
81
+ "雲端之上的高樓頂部 | Top of skyscraper above clouds",
82
+ "地下洞穴的神秘空間 | Mysterious underground cave",
83
+ "廢棄車輛堆積的場地 | Abandoned vehicle scrap yard",
84
+ "鮮花裝飾的婚禮現場 | Flower-decorated wedding venue",
85
+ "書籍堆積的古老書房 | Book-filled ancient study",
86
+ "科技感十足的指揮中心 | High-tech command center",
87
+ "原始自然的叢林深處 | Deep in primitive jungle",
88
+ "繁忙的交通十字路口 | Busy traffic intersection",
89
+ "寧靜的湖畔小屋旁 | By peaceful lakeside cabin",
90
+ "擁擠的地鐵站內部 | Crowded subway station interior",
91
+ "開闊的山頂觀景台 | Open mountaintop viewing platform"
92
+ ]
93
+ },
94
+ "subject": {
95
+ "character_features.txt": [
96
+ "年輕的亞洲男性 | Young Asian male",
97
+ "優雅的歐洲女性 | Elegant European female",
98
+ "中年的非裔商人 | Middle-aged African businessman",
99
+ "年長的智者形象 | Elderly wise figure",
100
+ "活潑的拉丁裔青年 | Lively Latino youth",
101
+ "神秘的蒙面人物 | Mysterious masked figure",
102
+ "強壯的運動員體格 | Strong athletic build",
103
+ "纖細的舞者身材 | Slender dancer's physique",
104
+ "華麗的奇幻種族 | Lavish fantasy race",
105
+ "簡約的現代上班族 | Minimalist modern office worker",
106
+ "可愛的兒童形象 | Cute child figure",
107
+ "性感的模特兒身材 | Sexy model physique",
108
+ "威武的軍人形象 | Majestic soldier figure",
109
+ "慈祥的老奶奶 | Kindly old grandmother",
110
+ "叛逆的青少年 | Rebellious teenager",
111
+ "自信的企業家 | Confident entrepreneur",
112
+ "害羞的學生 | Shy student",
113
+ "狂野的搖滾樂手 | Wild rock musician",
114
+ "優雅的芭蕾舞者 | Graceful ballet dancer",
115
+ "強悍的武術家 | Tough martial artist",
116
+ "神秘的巫師 | Mysterious wizard",
117
+ "帥氣的機車騎士 | Handsome motorcycle rider",
118
+ "美麗的精靈族 | Beautiful elf race",
119
+ "強壯的半獸人 | Strong orc race",
120
+ "可愛的獸人族 | Cute beast race"
121
+ ],
122
+ "clothing_style.txt": [
123
+ "黑色皮夾克配牛仔褲 | Black leather jacket with jeans",
124
+ "優雅的晚禮服長裙 | Elegant evening gown",
125
+ "實用的戶外探險裝備 | Practical outdoor exploration gear",
126
+ "傳統的民族服飾 | Traditional ethnic clothing",
127
+ "未來的科技感服裝 | Futuristic tech-style clothing",
128
+ "休閒的運動服套裝 | Casual sportswear set",
129
+ "正式的西裝領帶 | Formal suit and tie",
130
+ "奇幻的魔法師長袍 | Fantasy mage robe",
131
+ "復古的搖滾風格 | Retro rock style",
132
+ "極簡的單色搭配 | Minimalist monochrome outfit",
133
+ "華麗的宮廷禮服 | Lavish court dress",
134
+ "破舊的流浪者服裝 | Tattered流浪者clothing",
135
+ "專業的廚師制服 | Professional chef uniform",
136
+ "性感的比基尼泳裝 | Sexy bikini swimwear",
137
+ "溫暖的冬季大衣 | Warm winter coat",
138
+ "輕便的夏日洋裝 | Light summer dress",
139
+ "軍裝風格外套 | Military style jacket",
140
+ "學生制服 | School uniform",
141
+ "婚紗禮服 | Wedding dress",
142
+ "睡衣家居服 | Pajamas homewear",
143
+ "皮革盔甲裝備 | Leather armor equipment",
144
+ "科幻太空服 | Sci-fi spacesuit",
145
+ "傳統和服 | Traditional kimono",
146
+ "印度紗麗 | Indian sari",
147
+ "阿拉伯長袍 | Arabic thobe"
148
+ ],
149
+ "pose_expression.txt": [
150
+ "站立微笑看向鏡頭 | Standing smiling at camera",
151
+ "坐姿沉思看向遠方 | Sitting contemplating into distance",
152
+ "奔跑中的動態姿勢 | Dynamic pose while running",
153
+ "跳躍的瞬間捕捉 | Mid-jump moment captured",
154
+ "倚靠物體的放鬆姿勢 | Relaxed pose leaning on object",
155
+ "戰鬥準備的緊張姿態 | Tense combat-ready stance",
156
+ "舞蹈中的優雅動作 | Elegant movement while dancing",
157
+ "工作中的專注神情 | Focused expression while working",
158
+ "驚訝的自然反應 | Natural surprised reaction",
159
+ "憤怒的強烈情緒表達 | Strong expression of anger",
160
+ "悲傷的低頭姿勢 | Sad低头pose",
161
+ "快樂的跳躍姿勢 | Happy jumping pose",
162
+ "思考的托腮動作 | Thinking with chin in hand",
163
+ "指揮的專注神情 | Conducting with专注expression",
164
+ "閱讀的安靜姿態 | Quiet reading posture",
165
+ "演奏樂器的投入表情 | Engaged expression playing instrument",
166
+ "繪畫的創作姿勢 | Creative painting posture",
167
+ "瑜伽的伸展動作 | Yoga stretching pose",
168
+ "親吻的浪漫時刻 | Romantic kissing moment",
169
+ "擁抱的溫暖姿勢 | Warm hugging pose",
170
+ "指向前方的動作 | Pointing forward动作",
171
+ "揮手打招呼 | Waving hello",
172
+ "跪下的虔誠姿態 | Kneeling虔诚posture",
173
+ "躺下的放鬆姿勢 | Lying down relaxed pose",
174
+ "飛翔的幻想姿勢 | Flying fantasy pose"
175
+ ]
176
+ },
177
+ "photography": {
178
+ "lens_parameters.txt": [
179
+ "35mm f/1.4 廣角鏡頭 | 35mm f/1.4 wide-angle lens",
180
+ "85mm f/1.8 人像鏡頭 | 85mm f/1.8 portrait lens",
181
+ "24-70mm f/2.8 變焦鏡頭 | 24-70mm f/2.8 zoom lens",
182
+ "50mm f/1.2 標準鏡頭 | 50mm f/1.2 standard lens",
183
+ "135mm f/2.0 長焦鏡頭 | 135mm f/2.0 telephoto lens",
184
+ "16-35mm f/4.0 超廣角 | 16-35mm f/4.0 ultra-wide angle",
185
+ "70-200mm f/2.8 遠攝鏡頭 | 70-200mm f/2.8 telephoto zoom",
186
+ "微距鏡頭 f/2.8 | Macro lens f/2.8",
187
+ "魚眼鏡頭 8mm f/3.5 | Fisheye lens 8mm f/3.5",
188
+ "移軸鏡頭 45mm f/2.8 | Tilt-shift lens 45mm f/2.8",
189
+ "24mm f/1.4 超廣角大光圈 | 24mm f/1.4 ultra-wide aperture",
190
+ "200mm f/2.0 長焦大光圈 | 200mm f/2.0 telephoto大光圈",
191
+ "14mm f/2.8 超廣角鏡頭 | 14mm f/2.8 ultra-wide lens",
192
+ "400mm f/2.8 超長焦鏡頭 | 400mm f/2.8 super telephoto",
193
+ "50mm f/0.95 超大光圈 | 50mm f/0.95超大光圈",
194
+ "100mm f/2.8 微距鏡頭 | 100mm f/2.8 macro lens",
195
+ "28-75mm f/2.8 標準變焦 | 28-75mm f/2.8 standard zoom",
196
+ "150-600mm f/5-6.3 超長變焦 | 150-600mm f/5-6.3 super zoom",
197
+ "20mm f/1.8 廣角大光圈 | 20mm f/1.8 wide-angle大光圈",
198
+ "300mm f/4.0 長焦定焦 | 300mm f/4.0 telephoto prime",
199
+ "10-20mm f/4.5-5.6 超廣變焦 | 10-20mm f/4.5-5.6 ultra-wide zoom",
200
+ "58mm f/1.2 特殊標準鏡 | 58mm f/1.2 special standard lens",
201
+ "180mm f/3.5 微距鏡頭 | 180mm f/3.5 macro lens",
202
+ "8-15mm f/4.0 魚眼變焦 | 8-15mm f/4.0 fisheye zoom",
203
+ "600mm f/4.0 超長焦定焦 | 600mm f/4.0 super telephoto prime"
204
+ ],
205
+ "shooting_angle.txt": [
206
+ "低角度仰拍 | Low angle looking up",
207
+ "高角度俯拍 | High angle looking down",
208
+ "水平視角 | Eye-level perspective",
209
+ "鳥瞰視角 | Bird's-eye view",
210
+ "蟲視角 | Worm's-eye view",
211
+ "傾斜的荷蘭角 | Dutch angle tilt",
212
+ "過肩拍攝角度 | Over-the-shoulder angle",
213
+ "正面特寫角度 | Front close-up angle",
214
+ "側面輪廓角度 | Side profile angle",
215
+ "第一人稱視角 | First-person perspective",
216
+ "微距特寫角度 | Macro close-up angle",
217
+ "廣角全景視角 | Wide-angle panoramic view",
218
+ "長焦壓縮視角 | Telephoto compressed perspective",
219
+ "運動跟拍視角 | Motion tracking shot",
220
+ "滑軌移動視角 | Slider moving perspective",
221
+ "升降鏡頭視角 | Crane shot perspective",
222
+ "搖臂鏡頭視角 | Jib arm shot perspective",
223
+ "手持晃動視角 | Handheld shaky perspective",
224
+ "航拍空中視角 | Aerial drone perspective",
225
+ "水下拍攝視角 | Underwater shooting perspective",
226
+ "窺視視角 | Peeking perspective",
227
+ "反射鏡面視角 | Reflective mirror perspective",
228
+ "框架構圖視角 | Framed composition perspective",
229
+ "傾斜地平線視角 | Tilted horizon perspective",
230
+ "極低角度視角 | Extreme low angle perspective"
231
+ ],
232
+ "film_style.txt": [
233
+ "富士 Velvia 鮮豔色彩 | Fuji Velvia vivid colors",
234
+ "柯達 Portra 柔和膚色 | Kodak Portra soft skin tones",
235
+ "黑白 Tri-X 高對比 | Black & white Tri-X high contrast",
236
+ "電影膠片 5219 電影感 | Motion picture film 5219 cinematic look",
237
+ "復古 Polaroid 即時顯影 | Vintage Polaroid instant film",
238
+ "過期膠片 懷舊色彩 | Expired film nostalgic colors",
239
+ "Ektachrome 幻燈片風格 | Ektachrome slide film style",
240
+ "Cinestill 800T 電影夜拍 | Cinestill 800T cinematic night",
241
+ "Ilford HP5 黑白顆粒 | Ilford HP5 black & white grain",
242
+ "Provia 100F 自然色彩 | Provia 100F natural colors",
243
+ "柯達 Gold 200 溫暖色調 | Kodak Gold 200 warm tones",
244
+ "富士 Pro 400H 柔和對比 | Fuji Pro 400H soft contrast",
245
+ "柯達 Ektar 100 鮮豔飽和 | Kodak Ektar 100 vibrant saturation",
246
+ "黑白 Ilford Delta 3200 高感光 | B&W Ilford Delta 3200 high ISO",
247
+ "電影膠片 500T tungsten平衡 | Movie film 500T tungsten balance",
248
+ "富士 Superia 400 日常色彩 | Fuji Superia 400日常colors",
249
+ "柯達 T-Max 100 細膩顆粒 | Kodak T-Max 100 fine grain",
250
+ "復古 Agfa Vista 鮮明色彩 | Vintage Agfa Vista鲜明colors",
251
+ "電影膠片 250D 日光平衡 | Movie film 250D daylight balance",
252
+ "黑白 Rollei Retro 特殊色調 | B&W Rollei Retro special tones",
253
+ "富士 Natura 1600 高感光 | Fuji Natura 1600 high ISO",
254
+ "柯達 ColorPlus 200 經濟型 | Kodak ColorPlus 200 economical",
255
+ "電影膠片 50D 細膩畫質 | Movie film 50D fine quality",
256
+ "黑白 Fomapan 400 經典顆粒 | B&W Fomapan 400 classic grain",
257
+ "富士 Acros 100II 黑白細膩 | Fuji Acros 100II B&W fine detail"
258
+ ]
259
+ },
260
+ "lighting": {
261
+ "light_source_type.txt": [
262
+ "自然日光 | Natural daylight",
263
+ "月光與星光 | Moonlight and starlight",
264
+ "霓虹燈光 | Neon lights",
265
+ "燭光與火光 | Candlelight and firelight",
266
+ "LED燈帶光線 | LED strip lighting",
267
+ "熒光燈管照明 | Fluorescent tube lighting",
268
+ "鎢絲燈溫暖光 | Tungsten warm lighting",
269
+ "RGB彩色燈光 | RGB colored lighting",
270
+ "聚光燈效果 | Spotlight effect",
271
+ "柔光箱擴散光 | Softbox diffused light",
272
+ "窗戶自然光 | Window natural light",
273
+ "車燈光線 | Car headlights",
274
+ "手機螢幕光 | Smartphone screen light",
275
+ "電視螢幕光 | TV screen light",
276
+ "電腦螢幕光 | Computer monitor light",
277
+ "路燈照明 | Street lamp lighting",
278
+ "舞台燈光 | Stage lighting",
279
+ "攝影棚閃光燈 | Studio strobe lighting",
280
+ "手電筒光束 | Flashlight beam",
281
+ "投影機光線 | Projector light",
282
+ "激光光束 | Laser beam",
283
+ "螢光棒光線 | Glow stick light",
284
+ "油燈光線 | Oil lamp light",
285
+ "煤氣燈光 | Gas lamp light",
286
+ "LED大屏幕光 | LED big screen light"
287
+ ],
288
+ "light_effect.txt": [
289
+ "柔和的擴散光線 | Soft diffused lighting",
290
+ "強烈的直射光線 | Strong direct lighting",
291
+ "戲劇性的側光 | Dramatic side lighting",
292
+ "神秘的逆光效果 | Mysterious backlighting",
293
+ "均勻的正面光 | Even front lighting",
294
+ "創意的輪廓光 | Creative rim lighting",
295
+ "自然的光線衰減 | Natural light falloff",
296
+ "動態的光影變化 | Dynamic light and shadow play",
297
+ "反射的間接光線 | Reflected indirect lighting",
298
+ "多光源混合照明 | Mixed multi-source lighting",
299
+ "漸變過渡光效 | Gradient transition lighting",
300
+ "斑駁的光影效果 | Dappled light and shadow",
301
+ "強烈的對比光影 | Strong contrast light and shadow",
302
+ "柔和的過渡陰影 | Soft transitional shadows",
303
+ "硬朗的清晰陰影 | Hard clear shadows",
304
+ "霧氣中的漫射光 | Diffused light in fog",
305
+ "水面的反射光 | Reflective light on water",
306
+ "玻璃的折射光 | Refracted light through glass",
307
+ "金屬的反光效果 | Metallic reflective effect",
308
+ "皮膚的次表面散射 | Skin subsurface scattering",
309
+ "頭髮的邊緣光 | Hair rim light",
310
+ "眼睛的反射光 | Eye reflection light",
311
+ "衣服的材質光感 | Clothing material lighting",
312
+ "環境的全局照明 | Environmental global illumination",
313
+ "體積光的上帝光 | Volumetric god rays"
314
+ ],
315
+ "contrast_level.txt": [
316
+ "高對比強光影 | High contrast with strong shadows",
317
+ "低對比柔和過渡 | Low contrast with soft transitions",
318
+ "中等對比平衡 | Medium contrast balanced",
319
+ "極高對比黑白 | Extreme contrast black and white",
320
+ "細膩的微對比 | Subtle micro-contrast",
321
+ "動態範圍廣 | Wide dynamic range",
322
+ "壓縮的暗部細節 | Compressed shadow details",
323
+ "保留亮部細節 | Preserved highlight details",
324
+ "S曲線對比調整 | S-curve contrast adjustment",
325
+ "自然對比還原 | Natural contrast reproduction",
326
+ "柔和的低對比 | Soft low contrast",
327
+ "鮮明的中高對比 | Distinct medium-high contrast",
328
+ "強烈的戲劇對比 | Strong dramatic contrast",
329
+ "細膩的高光過渡 | Subtle highlight transition",
330
+ "深沉的陰影層次 | Deep shadow gradation",
331
+ "明亮的整體調性 | Bright overall tonality",
332
+ "暗調的氛圍感 | Dark tone atmosphere",
333
+ "中灰色調平衡 | Medium gray tone balance",
334
+ "高動態範圍保留 | High dynamic range preservation",
335
+ "膠片曲線對比 | Film curve contrast",
336
+ "數位平面對比 | Digital flat contrast",
337
+ "電影風格對比 | Cinematic style contrast",
338
+ "復古褪色對比 | Vintage faded contrast",
339
+ "清新通透對比 | Fresh transparent contrast",
340
+ "厚重質感對比 | Heavy texture contrast"
341
+ ]
342
+ },
343
+ "style": {
344
+ "art_style.txt": [
345
+ "賽博朋克風格 | Cyberpunk style",
346
+ "蒸汽龐克風格 | Steampunk style",
347
+ "奇幻藝術風格 | Fantasy art style",
348
+ "超現實主義 | Surrealism style",
349
+ "極簡主義風格 | Minimalist style",
350
+ "印象派風格 | Impressionist style",
351
+ "寫實主義風格 | Realism style",
352
+ "卡通動畫風格 | Cartoon animation style",
353
+ "油畫藝術風格 | Oil painting style",
354
+ "水彩藝術風格 | Watercolor style",
355
+ "像素藝術風格 | Pixel art style",
356
+ "塗鴉藝術風格 | Graffiti art style",
357
+ "復古插畫風格 | Retro illustration style",
358
+ "科幻未來風格 | Sci-fi futuristic style",
359
+ "恐怖驚悚風格 | Horror thriller style",
360
+ "浪漫唯美風格 | Romantic aesthetic style",
361
+ "抽象藝術風格 | Abstract art style",
362
+ "概念藝術風格 | Concept art style",
363
+ "日式動漫風格 | Japanese anime style",
364
+ "美式漫畫風格 | American comic style",
365
+ "迪士尼動畫風格 | Disney animation style",
366
+ "吉卜力動畫風格 | Ghibli animation style",
367
+ "新藝術運動風格 | Art Nouveau style",
368
+ "裝飾藝術風格 | Art Deco style",
369
+ "巴洛克藝術風格 | Baroque art style"
370
+ ],
371
+ "color_scheme.txt": [
372
+ "青橙配色方案 | Teal and orange color scheme",
373
+ "霓虹色彩搭配 | Neon color palette",
374
+ "單色調配方案 | Monochromatic color scheme",
375
+ "柔和粉彩色調 | Soft pastel colors",
376
+ "鮮豔飽和色彩 | Vibrant saturated colors",
377
+ "復古褪色色彩 | Vintage faded colors",
378
+ "黑白高對比 | Black and white high contrast",
379
+ "冷暖色調對比 | Warm and cool color contrast",
380
+ "金屬色系搭配 | Metallic color palette",
381
+ "自然大地色調 | Natural earth tones",
382
+ "糖果色系搭配 | Candy color palette",
383
+ "莫蘭迪色系 | Morandi color palette",
384
+ "馬卡龍色系 | Macaron color palette",
385
+ "賽博朋克色系 | Cyberpunk color scheme",
386
+ "蒸汽龐克色系 | Steampunk color scheme",
387
+ "奇幻魔法色系 | Fantasy magic color scheme",
388
+ "科幻未來色系 | Sci-fi futuristic color scheme",
389
+ "恐怖暗黑色系 | Horror dark color scheme",
390
+ "浪漫粉色系 | Romantic pink color scheme",
391
+ "清新藍綠色系 | Fresh aqua color scheme",
392
+ "溫暖橙黃色系 | Warm orange-yellow color scheme",
393
+ "冷靜藍紫色系 | Cool blue-purple color scheme",
394
+ "自然綠色系 | Natural green color scheme",
395
+ "奢華金黑色系 | Luxury gold-black color scheme",
396
+ "復古褐黃色系 | Vintage sepia color scheme"
397
+ ],
398
+ "render_effects.txt": [
399
+ "全局照明效果 | Global illumination effect",
400
+ "景深模糊效果 | Depth of field blur effect",
401
+ "動態模糊效果 | Motion blur effect",
402
+ "體積霧效果 | Volumetric fog effect",
403
+ "鏡頭光暈效果 | Lens flare effect",
404
+ "色差效果 | Chromatic aberration effect",
405
+ "電影顆粒效果 | Cinematic film grain",
406
+ "光線追蹤反射 | Ray-traced reflections",
407
+ "次表面散射 | Subsurface scattering",
408
+ "環境光遮蔽 | Ambient occlusion",
409
+ "運動模糊效果 | Motion blur effect",
410
+ "散景效果 | Bokeh effect",
411
+ "眩光效果 | Glare effect",
412
+ "漏光效果 | Light leak effect",
413
+ "暗角效果 | Vignetting effect",
414
+ "銳化效果 | Sharpening effect",
415
+ "模糊效果 | Blur effect",
416
+ "馬賽克效果 | Mosaic effect",
417
+ "像素化效果 | Pixelation effect",
418
+ "故障藝術效果 | Glitch art effect",
419
+ "雙重曝光效果 | Double exposure effect",
420
+ "HDR效果 | HDR effect",
421
+ "漫畫網點效果 | Comic halftone effect",
422
+ "素描線條效果 | Sketch line effect",
423
+ "水墨渲染效果 | Ink wash rendering effect"
424
+ ]
425
+ }
426
+ }
427
+
428
+ # 預設模板資料
429
+ DEFAULT_TEMPLATES = {
430
+ "cyberpunk": {
431
+ "name": "賽博朋克 | Cyberpunk",
432
+ "fields": {
433
+ "scene_description": "霓虹閃爍的賽博朋克街道 | Neon-lit cyberpunk street",
434
+ "time_atmosphere": "深夜的神秘月光 | Mysterious moonlight late at night",
435
+ "color_scheme": "青橙配色方案 | Teal and orange color scheme",
436
+ "art_style": "賽博朋克風格 | Cyberpunk style",
437
+ "light_source_type": "霓虹燈光 | Neon lights",
438
+ "render_effects": "鏡頭光暈效果 | Lens flare effect"
439
+ }
440
+ },
441
+ "fantasy_magic": {
442
+ "name": "奇幻魔法 | Fantasy Magic",
443
+ "fields": {
444
+ "scene_description": "夢幻的童話森林 | Enchanted fairy tale forest",
445
+ "time_atmosphere": "霧氣瀰漫的清晨 | Misty morning",
446
+ "color_scheme": "柔和粉彩色調 | Soft pastel colors",
447
+ "art_style": "奇幻藝術風格 | Fantasy art style",
448
+ "light_source_type": "自然日光 | Natural daylight",
449
+ "render_effects": "體積霧效果 | Volumetric fog effect"
450
+ }
451
+ },
452
+ "sci_fi_futuristic": {
453
+ "name": "科幻未來 | Sci-fi Futuristic",
454
+ "fields": {
455
+ "scene_description": "科幻的太空站內景 | Sci-fi space station interior",
456
+ "time_atmosphere": "多雲的陰天光線 | Cloudy overcast light",
457
+ "color_scheme": "金屬色系搭配 | Metallic color palette",
458
+ "art_style": "科幻未來風格 | Sci-fi futuristic style",
459
+ "light_source_type": "LED燈帶光線 | LED strip lighting",
460
+ "render_effects": "光線追蹤反射 | Ray-traced reflections"
461
+ }
462
+ },
463
+ "retro_vintage": {
464
+ "name": "復古懷舊 | Retro Vintage",
465
+ "fields": {
466
+ "scene_description": "古典的歐洲城堡大廳 | Classical European castle hall",
467
+ "time_atmosphere": "黃金時刻的溫暖陽光 | Warm sunlight during golden hour",
468
+ "color_scheme": "復古褪色色彩 | Vintage faded colors",
469
+ "art_style": "復古插畫風格 | Retro illustration style",
470
+ "light_source_type": "燭光與火光 | Candlelight and firelight",
471
+ "render_effects": "電影顆粒效果 | Cinematic film grain"
472
+ }
473
+ },
474
+ "natural_realism": {
475
+ "name": "自然寫實 | Natural Realism",
476
+ "fields": {
477
+ "scene_description": "綠意盎然的自然環境 | Lush green natural environment",
478
+ "time_atmosphere": "午後的柔和光線 | Soft afternoon light",
479
+ "color_scheme": "自然大地色調 | Natural earth tones",
480
+ "art_style": "寫實主義風格 | Realism style",
481
+ "light_source_type": "自然日光 | Natural daylight",
482
+ "render_effects": "全局照明效果 | Global illumination effect"
483
+ }
484
+ },
485
+ "minimalism": {
486
+ "name": "極簡主義 | Minimalism",
487
+ "fields": {
488
+ "scene_description": "簡約的現代室內空間 | Minimalist modern interior",
489
+ "time_atmosphere": "均勻的正面光 | Even front lighting",
490
+ "color_scheme": "單色調配方案 | Monochromatic color scheme",
491
+ "art_style": "極簡主義風格 | Minimalist style",
492
+ "light_source_type": "柔光箱擴散光 | Softbox diffused light",
493
+ "render_effects": "環境光遮蔽 | Ambient occlusion"
494
+ }
495
+ },
496
+ "cinematic_portrait": {
497
+ "name": "電影人像 | Cinematic Portrait",
498
+ "fields": {
499
+ "scene_description": "戲劇性的室內場景 | Dramatic indoor scene",
500
+ "time_atmosphere": "戲劇���的側光 | Dramatic side lighting",
501
+ "color_scheme": "冷暖色調對比 | Warm and cool color contrast",
502
+ "art_style": "電影風格 | Cinematic style",
503
+ "light_source_type": "聚光燈效果 | Spotlight effect",
504
+ "render_effects": "景深模糊效果 | Depth of field blur effect"
505
+ }
506
+ },
507
+ "street_fashion": {
508
+ "name": "街頭潮流 | Street Fashion",
509
+ "fields": {
510
+ "scene_description": "繁忙的現代都市街頭 | Busy modern city street",
511
+ "time_atmosphere": "雨後的都市夜景 | City night scene after rain",
512
+ "color_scheme": "霓虹色彩搭配 | Neon color palette",
513
+ "art_style": "塗鴉藝術風格 | Graffiti art style",
514
+ "light_source_type": "RGB彩色燈光 | RGB colored lighting",
515
+ "render_effects": "動態模糊效果 | Motion blur effect"
516
+ }
517
+ },
518
+ "anime_manga": {
519
+ "name": "日式動漫 | Anime Manga",
520
+ "fields": {
521
+ "scene_description": "精緻的日式動漫場景 | Exquisite anime manga scene",
522
+ "time_atmosphere": "晴朗無雲的藍天 | Clear cloudless blue sky",
523
+ "color_scheme": "鮮豔飽和色彩 | Vibrant saturated colors",
524
+ "art_style": "日式動漫風格 | Japanese anime style",
525
+ "light_source_type": "自然日光 | Natural daylight",
526
+ "render_effects": "卡通動畫效果 | Cartoon animation effect"
527
+ }
528
+ },
529
+ "steampunk": {
530
+ "name": "蒸汽龐克 | Steampunk",
531
+ "fields": {
532
+ "scene_description": "蒸汽龐克風格城市 | Steampunk-style city",
533
+ "time_atmosphere": "薄霧籠罩的夜晚 | Thin fog shrouded night",
534
+ "color_scheme": "復古褐黃色系 | Vintage sepia color scheme",
535
+ "art_style": "蒸汽龐克風格 | Steampunk style",
536
+ "light_source_type": "煤氣燈光 | Gas lamp light",
537
+ "render_effects": "電影顆粒效果 | Cinematic film grain"
538
+ }
539
+ },
540
+ "horror_thriller": {
541
+ "name": "恐怖驚悚 | Horror Thriller",
542
+ "fields": {
543
+ "scene_description": "廢棄的工業廠房 | Abandoned industrial factory",
544
+ "time_atmosphere": "暴風雨前的壓抑氛圍 | Oppressive atmosphere before storm",
545
+ "color_scheme": "恐怖暗黑色系 | Horror dark color scheme",
546
+ "art_style": "恐怖驚悚風格 | Horror thriller style",
547
+ "light_source_type": "手電筒光束 | Flashlight beam",
548
+ "render_effects": "暗角效果 | Vignetting effect"
549
+ }
550
+ },
551
+ "romantic_aesthetic": {
552
+ "name": "浪漫唯美 | Romantic Aesthetic",
553
+ "fields": {
554
+ "scene_description": "花卉盛開的春季花園 | Spring garden in full bloom",
555
+ "time_atmosphere": "黃昏的浪漫餘暉 | Romantic glow of dusk",
556
+ "color_scheme": "浪漫粉色系 | Romantic pink color scheme",
557
+ "art_style": "浪漫唯美風格 | Romantic aesthetic style",
558
+ "light_source_type": "燭光與火光 | Candlelight and firelight",
559
+ "render_effects": "柔光效果 | Soft light effect"
560
+ }
561
+ },
562
+ "watercolor_art": {
563
+ "name": "水彩藝術 | Watercolor Art",
564
+ "fields": {
565
+ "scene_description": "夢幻的水彩畫風格場景 | Dreamy watercolor art scene",
566
+ "time_atmosphere": "霧氣瀰漫的清晨 | Misty morning",
567
+ "color_scheme": "柔和粉彩色調 | Soft pastel colors",
568
+ "art_style": "水彩藝術風格 | Watercolor style",
569
+ "light_source_type": "自然日光 | Natural daylight",
570
+ "render_effects": "水墨渲染效果 | Ink wash rendering effect"
571
+ }
572
+ }
573
+ }
574
+
575
+ @classmethod
576
+ def initialize_options_dir(cls):
577
+ """初始化選項目錄和檔案"""
578
+ options_dir = os.path.join(os.path.dirname(__file__), "z_image_options")
579
+
580
+ # 如果目錄不存在,創建它
581
+ if not os.path.exists(options_dir):
582
+ os.makedirs(options_dir)
583
+ print(f"[Z-Image] 已創建選項目錄: {options_dir}")
584
+
585
+ # 創建分組子目錄(使用英文名稱)
586
+ for group in cls.OPTION_DATA.keys():
587
+ group_dir = os.path.join(options_dir, group)
588
+ if not os.path.exists(group_dir):
589
+ os.makedirs(group_dir)
590
+ print(f"[Z-Image] 已創建分組目錄: {group_dir}")
591
+
592
+ # 初始化所有選項檔案
593
+ for group_name, files in cls.OPTION_DATA.items():
594
+ group_dir = os.path.join(options_dir, group_name)
595
+ for file_name, content_list in files.items():
596
+ file_path = os.path.join(group_dir, file_name)
597
+
598
+ # 如果檔案不存在,創建它
599
+ if not os.path.exists(file_path):
600
+ try:
601
+ with open(file_path, 'w', encoding='utf-8') as f:
602
+ # 寫入選項,每個選項佔一行
603
+ for item in content_list:
604
+ f.write(item + "\n")
605
+ print(f"[Z-Image] 已創建設定檔: {group_name}/{file_name}")
606
+ except Exception as e:
607
+ print(f"[Z-Image] 創建設定檔失敗 {group_name}/{file_name}: {str(e)}")
608
+ else:
609
+ # 如果檔案存在,檢查是否需要更新
610
+ try:
611
+ with open(file_path, 'r', encoding='utf-8') as f:
612
+ existing_lines = [line.strip() for line in f if line.strip()]
613
+
614
+ # 如果檔案內容太少,可能是舊版本,重新寫入
615
+ if len(existing_lines) < len(content_list) / 2:
616
+ with open(file_path, 'w', encoding='utf-8') as f:
617
+ for item in content_list:
618
+ f.write(item + "\n")
619
+ print(f"[Z-Image] 已更新設定檔: {group_name}/{file_name}")
620
+ except Exception as e:
621
+ print(f"[Z-Image] 讀取設定檔失敗 {group_name}/{file_name}: {str(e)}")
622
+
623
+ # 創建模板目錄和檔案
624
+ templates_dir = os.path.join(options_dir, "templates")
625
+ if not os.path.exists(templates_dir):
626
+ os.makedirs(templates_dir)
627
+ print(f"[Z-Image] 已創建模板目錄: {templates_dir}")
628
+
629
+ # 初始化模板檔案
630
+ for template_id, template_data in cls.DEFAULT_TEMPLATES.items():
631
+ template_file = os.path.join(templates_dir, f"{template_id}.json")
632
+ if not os.path.exists(template_file):
633
+ try:
634
+ with open(template_file, 'w', encoding='utf-8') as f:
635
+ json.dump(template_data, f, ensure_ascii=False, indent=2)
636
+ print(f"[Z-Image] 已創建模板檔案: templates/{template_id}.json")
637
+ except Exception as e:
638
+ print(f"[Z-Image] 創建模板檔案失敗 {template_id}.json: {str(e)}")
639
+
640
+ @classmethod
641
+ def load_templates(cls):
642
+ """載入所有模板"""
643
+ templates_dir = os.path.join(os.path.dirname(__file__), "z_image_options", "templates")
644
+
645
+ if not os.path.exists(templates_dir):
646
+ # 如果模板目錄不存在,使用預設模板
647
+ return cls.DEFAULT_TEMPLATES
648
+
649
+ templates = {}
650
+ try:
651
+ # 掃描模板目錄中的所有 JSON 檔案
652
+ for file_name in os.listdir(templates_dir):
653
+ if file_name.endswith('.json'):
654
+ template_id = file_name[:-5] # 移除 .json 擴展名
655
+ template_path = os.path.join(templates_dir, file_name)
656
+
657
+ try:
658
+ with open(template_path, 'r', encoding='utf-8') as f:
659
+ template_data = json.load(f)
660
+
661
+ # 確保模板有基本結構
662
+ if 'name' in template_data and 'fields' in template_data:
663
+ templates[template_id] = template_data
664
+ else:
665
+ print(f"[Z-Image] 模板檔案格式錯誤: {file_name}")
666
+ except Exception as e:
667
+ print(f"[Z-Image] 載入模板失敗 {file_name}: {str(e)}")
668
+ except Exception as e:
669
+ print(f"[Z-Image] 掃描模板目錄失敗: {str(e)}")
670
+
671
+ # 如果沒有載入到模板,使用預設模板
672
+ if not templates:
673
+ templates = cls.DEFAULT_TEMPLATES
674
+
675
+ return templates
676
+
677
+ @classmethod
678
+ def INPUT_TYPES(cls):
679
+ # 初始化選項目錄和檔案
680
+ cls.initialize_options_dir()
681
+
682
+ # 載入模板
683
+ templates = cls.load_templates()
684
+
685
+ # 生成模板選項列表
686
+ template_options = ["無模板 | No Template"]
687
+ for template_id, template_data in templates.items():
688
+ template_name = template_data.get('name', template_id)
689
+ template_options.append(f"{template_name} | {template_id}")
690
+
691
+ options_dir = os.path.join(os.path.dirname(__file__), "z_image_options")
692
+
693
+ # 動態生成輸入類型,使用分組前綴
694
+ input_types = {}
695
+
696
+ # 定義分組映射(使用中文前綴顯示,英文檔案名稱)
697
+ field_mapping = [
698
+ # 【場景】組
699
+ ("【場景】_場景描述", "scene", "scene_description.txt"),
700
+ ("【場景】_時間��圍", "scene", "time_atmosphere.txt"),
701
+ ("【場景】_環境設定", "scene", "environment_setting.txt"),
702
+
703
+ # 【主體】組
704
+ ("【主體】_人物特徵", "subject", "character_features.txt"),
705
+ ("【主體】_服裝造型", "subject", "clothing_style.txt"),
706
+ ("【主體】_姿勢表情", "subject", "pose_expression.txt"),
707
+
708
+ # 【攝影】組
709
+ ("【攝影】_鏡頭參數", "photography", "lens_parameters.txt"),
710
+ ("【攝影】_拍攝角度", "photography", "shooting_angle.txt"),
711
+ ("【攝影】_膠片風格", "photography", "film_style.txt"),
712
+
713
+ # 【燈光】組
714
+ ("【燈光】_光源類型", "lighting", "light_source_type.txt"),
715
+ ("【燈光】_光效描述", "lighting", "light_effect.txt"),
716
+ ("【燈光】_對比層次", "lighting", "contrast_level.txt"),
717
+
718
+ # 【風格】組
719
+ ("【風格】_藝術風格", "style", "art_style.txt"),
720
+ ("【風格】_色彩方案", "style", "color_scheme.txt"),
721
+ ("【風格】_渲染效果", "style", "render_effects.txt"),
722
+ ]
723
+
724
+ # 為每個字段創建選項列表
725
+ for field_name, group, file_name in field_mapping:
726
+ file_path = os.path.join(options_dir, group, file_name)
727
+ options = ["隨機 | Random", "無 | None"]
728
+ try:
729
+ with open(file_path, 'r', encoding='utf-8') as f:
730
+ # 讀取所有非空行
731
+ lines = [line.strip() for line in f if line.strip()]
732
+ options.extend(lines)
733
+ except Exception as e:
734
+ print(f"[Z-Image] 警告: 無法從 {file_path} 載入選項: {e}")
735
+ # 使用記憶體中的選項作為備份
736
+ if group in cls.OPTION_DATA and file_name in cls.OPTION_DATA[group]:
737
+ options.extend(cls.OPTION_DATA[group][file_name])
738
+
739
+ input_types[field_name] = (options, {"default": "隨機 | Random"})
740
+
741
+ # 添加語言選擇參數
742
+ input_types["language_choice"] = (["中文", "English", "雙語 | Bilingual"], {"default": "雙語 | Bilingual"})
743
+
744
+ # 添加風格模板選擇
745
+ input_types["style_template"] = (template_options, {"default": "無模板 | No Template"})
746
+
747
+ # 添加質量控制參數
748
+ input_types["detail_level"] = (["簡略 | Simple", "標準 | Standard", "詳細 | Detailed", "極度詳細 | Extremely Detailed"],
749
+ {"default": "標準 | Standard"})
750
+
751
+ # 添加負面提示
752
+ input_types["negative_prompt"] = ("STRING", {
753
+ "default": "低質量 | Low quality, 模糊 | Blurry, 變形 | Deformed, 解剖錯誤 | Bad anatomy, 多餘肢體 | Extra limbs, 水印 | Watermark, 簽名 | Signature",
754
+ "multiline": True
755
+ })
756
+
757
+ return {"required": input_types}
758
+
759
+ RETURN_TYPES = ("STRING", "STRING", "STRING")
760
+ RETURN_NAMES = ("json_prompt", "positive_text", "negative_prompt")
761
+ FUNCTION = "generate_json_prompt"
762
+ CATEGORY = "Z-Image"
763
+
764
+ def generate_json_prompt(self, **kwargs):
765
+ # 確保選項目錄和檔案存在
766
+ self.initialize_options_dir()
767
+
768
+ # 載入模板
769
+ templates = self.load_templates()
770
+
771
+ # 提取所有輸入參數
772
+ language_choice = kwargs.get("language_choice", "雙語 | Bilingual")
773
+ style_template = kwargs.get("style_template", "無模板 | No Template")
774
+ detail_level = kwargs.get("detail_level", "標準 | Standard")
775
+ negative_prompt = kwargs.get("negative_prompt", "")
776
+
777
+ # 從模板名稱中提取模板ID
778
+ selected_template_id = None
779
+ for template_id, template_data in templates.items():
780
+ template_name = template_data.get('name', template_id)
781
+ if style_template.startswith(template_name) or template_id in style_template:
782
+ selected_template_id = template_id
783
+ break
784
+
785
+ # 定義字段映射(去掉前綴的字段名)
786
+ field_keys = [
787
+ "scene_description", "time_atmosphere", "environment_setting",
788
+ "character_features", "clothing_style", "pose_expression",
789
+ "lens_parameters", "shooting_angle", "film_style",
790
+ "light_source_type", "light_effect", "contrast_level",
791
+ "art_style", "color_scheme", "render_effects"
792
+ ]
793
+
794
+ # 處理所有輸入字段
795
+ fields = {}
796
+ for key in field_keys:
797
+ # 將key轉換為中文顯示名稱以匹配輸入參數
798
+ chinese_name = self._get_chinese_field_name(key)
799
+ prefixed_key = f"【{self._get_group_chinese(key)}】_{chinese_name}"
800
+ value = kwargs.get(prefixed_key, "隨機 | Random")
801
+ fields[key] = self._process_field_value(key, value, language_choice)
802
+
803
+ # 應用風格模板
804
+ if selected_template_id and selected_template_id in templates:
805
+ fields = self._apply_style_template(fields, selected_template_id, templates, language_choice)
806
+
807
+ # 根據細節等級調整
808
+ fields = self._adjust_detail_level(fields, detail_level, language_choice)
809
+
810
+ # 構建詳細的 JSON 結構
811
+ json_data = {
812
+ "metadata": {
813
+ "generated_at": datetime.now().isoformat(),
814
+ "generator": "Z-Image JSON Prompt Generator v3.0",
815
+ "language": language_choice,
816
+ "style_template": selected_template_id if selected_template_id else "none",
817
+ "detail_level": detail_level
818
+ },
819
+
820
+ "scene_settings": {
821
+ "description": fields["scene_description"],
822
+ "time_atmosphere": fields["time_atmosphere"],
823
+ "environment": fields["environment_setting"]
824
+ },
825
+
826
+ "subject_description": {
827
+ "character": fields["character_features"],
828
+ "clothing": fields["clothing_style"],
829
+ "pose_expression": fields["pose_expression"]
830
+ },
831
+
832
+ "photography_technique": {
833
+ "lens": fields["lens_parameters"],
834
+ "angle": fields["shooting_angle"],
835
+ "film_style": fields["film_style"]
836
+ },
837
+
838
+ "lighting_effects": {
839
+ "light_source": fields["light_source_type"],
840
+ "effect": fields["light_effect"],
841
+ "contrast": fields["contrast_level"]
842
+ },
843
+
844
+ "style_rendering": {
845
+ "art_style": fields["art_style"],
846
+ "color_scheme": fields["color_scheme"],
847
+ "render_effects": fields["render_effects"],
848
+ "negative_guidance": self._process_language(negative_prompt, language_choice)
849
+ }
850
+ }
851
+
852
+ # 生成 JSON 字串
853
+ json_output = json.dumps(json_data, ensure_ascii=False, indent=2)
854
+
855
+ # 生成四段式文本版本
856
+ positive_text = self._generate_four_part_text(fields, language_choice, detail_level)
857
+
858
+ return (json_output, positive_text, negative_prompt)
859
+
860
+ def _get_chinese_field_name(self, field_name):
861
+ """將英文字段名轉換為中文顯示名稱"""
862
+ name_mapping = {
863
+ "scene_description": "場景描述",
864
+ "time_atmosphere": "時間氛圍",
865
+ "environment_setting": "環境設定",
866
+ "character_features": "人物特徵",
867
+ "clothing_style": "服裝造型",
868
+ "pose_expression": "姿勢表情",
869
+ "lens_parameters": "鏡頭參數",
870
+ "shooting_angle": "拍攝角度",
871
+ "film_style": "膠片風格",
872
+ "light_source_type": "光源類型",
873
+ "light_effect": "光效描述",
874
+ "contrast_level": "對比層次",
875
+ "art_style": "藝術風格",
876
+ "color_scheme": "色彩方案",
877
+ "render_effects": "渲染效果"
878
+ }
879
+ return name_mapping.get(field_name, field_name)
880
+
881
+ def _get_group_chinese(self, field_name):
882
+ """根據字段名返回所屬分組(中文)"""
883
+ group_mapping = {
884
+ "scene_description": "場景", "time_atmosphere": "場景", "environment_setting": "場景",
885
+ "character_features": "主體", "clothing_style": "主體", "pose_expression": "主體",
886
+ "lens_parameters": "攝影", "shooting_angle": "攝影", "film_style": "攝影",
887
+ "light_source_type": "燈光", "light_effect": "燈光", "contrast_level": "燈光",
888
+ "art_style": "風格", "color_scheme": "風格", "render_effects": "風格"
889
+ }
890
+ return group_mapping.get(field_name, "未知")
891
+
892
+ def _get_group(self, field_name):
893
+ """根據字段名返回所屬分組(英文)"""
894
+ group_mapping = {
895
+ "scene_description": "scene", "time_atmosphere": "scene", "environment_setting": "scene",
896
+ "character_features": "subject", "clothing_style": "subject", "pose_expression": "subject",
897
+ "lens_parameters": "photography", "shooting_angle": "photography", "film_style": "photography",
898
+ "light_source_type": "lighting", "light_effect": "lighting", "contrast_level": "lighting",
899
+ "art_style": "style", "color_scheme": "style", "render_effects": "style"
900
+ }
901
+ return group_mapping.get(field_name, "unknown")
902
+
903
+ def _process_field_value(self, field_name, value, language_choice):
904
+ """處理字段值,包括隨機選擇和語言處理"""
905
+ if value == "隨機 | Random":
906
+ # 從對應文件中隨機選擇
907
+ group = self._get_group(field_name)
908
+ options_dir = os.path.join(os.path.dirname(__file__), "z_image_options")
909
+ file_name = f"{field_name}.txt"
910
+ file_path = os.path.join(options_dir, group, file_name)
911
+
912
+ try:
913
+ with open(file_path, 'r', encoding='utf-8') as f:
914
+ options = [line.strip() for line in f if line.strip()]
915
+ # 過濾掉"隨機 | Random"和"無 | None"選項
916
+ valid_options = [opt for opt in options if opt not in ["隨機 | Random", "無 | None"]]
917
+ if valid_options:
918
+ selected = random.choice(valid_options)
919
+ return self._process_language(selected, language_choice)
920
+ except Exception as e:
921
+ print(f"[Z-Image] 警告: 無法為 {field_name} 載入隨機選項: {e}")
922
+ # 使用記憶體中的選項作為備份
923
+ if group in self.OPTION_DATA and file_name in self.OPTION_DATA[group]:
924
+ valid_options = self.OPTION_DATA[group][file_name]
925
+ if valid_options:
926
+ selected = random.choice(valid_options)
927
+ return self._process_language(selected, language_choice)
928
+
929
+ return ""
930
+ elif value == "無 | None":
931
+ return ""
932
+ else:
933
+ return self._process_language(value, language_choice)
934
+
935
+ def _process_language(self, text, language_choice):
936
+ """根據語言選擇處理文本"""
937
+ if not text:
938
+ return ""
939
+
940
+ if language_choice == "中文":
941
+ # 只返回中文部分
942
+ parts = text.split(" | ")
943
+ return parts[0].strip() if len(parts) > 0 else text
944
+ elif language_choice == "English":
945
+ # 只返回英文部分
946
+ parts = text.split(" | ")
947
+ return parts[1].strip() if len(parts) > 1 else text
948
+ else: # 雙語
949
+ return text
950
+
951
+ def _apply_style_template(self, fields, template_id, templates, language_choice):
952
+ """應用風格模板"""
953
+ if template_id not in templates:
954
+ return fields
955
+
956
+ template_data = templates[template_id]
957
+ template_fields = template_data.get('fields', {})
958
+
959
+ for key, value in template_fields.items():
960
+ if key in fields and (not fields[key] or fields[key] == "無" or fields[key] == "None"):
961
+ fields[key] = self._process_language(value, language_choice)
962
+
963
+ return fields
964
+
965
+ def _adjust_detail_level(self, fields, detail_level, language_choice):
966
+ """根據細節等級調整字段內容"""
967
+ # 提取細節等級名稱(去除語言部分)
968
+ if " | " in detail_level:
969
+ detail_level_name = detail_level.split(" | ")[0]
970
+ else:
971
+ detail_level_name = detail_level
972
+
973
+ if detail_level_name == "簡略":
974
+ # 簡略模式:只保留核心字段
975
+ core_fields = ["scene_description", "character_features", "art_style"]
976
+ for key in fields:
977
+ if key not in core_fields:
978
+ fields[key] = ""
979
+ elif detail_level_name == "詳細":
980
+ # 詳細模式:添加更多描述詞
981
+ descriptive_words = {
982
+ "scene_description": ["精緻的 | Exquisite", "細膩的 | Detailed", "生動的 | Vivid"],
983
+ "character_features": ["獨特的 | Unique", "鮮明的 | Distinct", "立體的 | Three-dimensional"],
984
+ "art_style": ["強烈的 | Strong", "突出的 | Prominent", "明顯的 | Obvious"]
985
+ }
986
+
987
+ for key, words in descriptive_words.items():
988
+ if fields[key] and not any(fields[key].startswith(word.split(" | ")[0]) for word in words):
989
+ selected_word = random.choice(words)
990
+ fields[key] = f"{self._process_language(selected_word, language_choice)}{fields[key]}"
991
+ elif detail_level_name == "極度詳細":
992
+ # 極度詳細模式:添加更多細節描述
993
+ detail_descriptions = {
994
+ "scene_description": ",充滿豐富的細節和層次 | , full of rich details and layers",
995
+ "character_features": ",具有獨特的個人特質和表情 | , with unique personal characteristics and expressions",
996
+ "clothing_style": ",展現精緻的材質和做工 | , showing exquisite materials and workmanship",
997
+ "art_style": ",體現強烈的視覺衝擊和藝術感 | , reflecting strong visual impact and artistic sense"
998
+ }
999
+
1000
+ for key, desc in detail_descriptions.items():
1001
+ if fields[key]:
1002
+ desc_part = desc.split(" | ")[0] if language_choice == "中文" else desc.split(" | ")[1]
1003
+ if not fields[key].endswith(desc_part):
1004
+ fields[key] = f"{fields[key]}{desc_part}"
1005
+
1006
+ return fields
1007
+
1008
+ def _generate_four_part_text(self, fields, language_choice, detail_level):
1009
+ """生成四段式文本提示"""
1010
+ # 提取細節等級名稱
1011
+ if " | " in detail_level:
1012
+ detail_level_name = detail_level.split(" | ")[0]
1013
+ else:
1014
+ detail_level_name = detail_level
1015
+
1016
+ parts = []
1017
+
1018
+ # 第一段:核心描述(場景 + 主體 + 姿勢)
1019
+ part1 = []
1020
+ if fields["scene_description"]:
1021
+ part1.append(fields["scene_description"])
1022
+ if fields["character_features"]:
1023
+ part1.append(fields["character_features"])
1024
+ if fields["pose_expression"]:
1025
+ part1.append(fields["pose_expression"])
1026
+
1027
+ if part1:
1028
+ if language_choice == "中文":
1029
+ parts.append(f"【核心描述】{','.join(part1)}")
1030
+ elif language_choice == "English":
1031
+ parts.append(f"【Core Description】{', '.join(part1)}")
1032
+ else:
1033
+ parts.append(f"【核心描述 | Core Description】{','.join(part1)}")
1034
+
1035
+ # 第二段:環境細節(時間 + 環境)
1036
+ part2 = []
1037
+ if fields["time_atmosphere"]:
1038
+ part2.append(fields["time_atmosphere"])
1039
+ if fields["environment_setting"]:
1040
+ part2.append(fields["environment_setting"])
1041
+ if fields["clothing_style"]:
1042
+ if language_choice == "English":
1043
+ part2.append(f"wearing {fields['clothing_style']}")
1044
+ else:
1045
+ part2.append(f"穿著{fields['clothing_style']}")
1046
+
1047
+ if part2:
1048
+ if language_choice == "中文":
1049
+ parts.append(f"【環境細節】{','.join(part2)}")
1050
+ elif language_choice == "English":
1051
+ parts.append(f"【Environment Details】{', '.join(part2)}")
1052
+ else:
1053
+ parts.append(f"【環境細節 | Environment Details】{','.join(part2)}")
1054
+
1055
+ # 第三段:技術參數(攝影 + 燈光)
1056
+ part3 = []
1057
+ if fields["lens_parameters"]:
1058
+ part3.append(fields["lens_parameters"])
1059
+ if fields["shooting_angle"]:
1060
+ part3.append(fields["shooting_angle"])
1061
+ if fields["light_source_type"]:
1062
+ part3.append(fields["light_source_type"])
1063
+ if fields["light_effect"]:
1064
+ part3.append(fields["light_effect"])
1065
+ if fields["film_style"]:
1066
+ part3.append(fields["film_style"])
1067
+ if fields["contrast_level"]:
1068
+ part3.append(fields["contrast_level"])
1069
+
1070
+ if part3:
1071
+ if language_choice == "中文":
1072
+ parts.append(f"【技術參數】{','.join(part3)}")
1073
+ elif language_choice == "English":
1074
+ parts.append(f"【Technical Parameters】{', '.join(part3)}")
1075
+ else:
1076
+ parts.append(f"【技術參數 | Technical Parameters】{','.join(part3)}")
1077
+
1078
+ # 第四段:風格強化(藝術 + 色彩 + 渲染)
1079
+ part4 = []
1080
+ if fields["art_style"]:
1081
+ part4.append(fields["art_style"])
1082
+ if fields["color_scheme"]:
1083
+ part4.append(fields["color_scheme"])
1084
+ if fields["render_effects"]:
1085
+ part4.append(fields["render_effects"])
1086
+
1087
+ # 根據細節等級添加額外描述
1088
+ if detail_level_name in ["詳細", "極度詳細"]:
1089
+ if language_choice == "中文":
1090
+ quality_words = ["高質量", "高解析度", "專業級", "大師級"]
1091
+ part4.append(f"{random.choice(quality_words)}作品")
1092
+ elif language_choice == "English":
1093
+ quality_words = ["High quality", "High resolution", "Professional grade", "Masterpiece"]
1094
+ part4.append(f"{random.choice(quality_words)} work")
1095
+ else:
1096
+ quality_words = ["高質量 | High quality", "高解析度 | High resolution", "專業級 | Professional grade", "大師級 | Masterpiece"]
1097
+ part4.append(f"{random.choice(quality_words)}作品 | work")
1098
+
1099
+ if part4:
1100
+ if language_choice == "中文":
1101
+ parts.append(f"【風格強化】{','.join(part4)}")
1102
+ elif language_choice == "English":
1103
+ parts.append(f"【Style Enhancement】{', '.join(part4)}")
1104
+ else:
1105
+ parts.append(f"【風格強化 | Style Enhancement】{','.join(part4)}")
1106
+
1107
+ # 合併所有段落
1108
+ separator = "\n\n" if detail_level_name in ["詳細", "極度詳細"] else "\n"
1109
+ return separator.join(parts)
1110
+
1111
+ @classmethod
1112
+ def IS_CHANGED(cls, **kwargs):
1113
+ return f"{time.time()}"
1114
+
1115
+
1116
+ # 註冊節點
1117
+ NODE_CLASS_MAPPINGS = {
1118
+ "ZImageJSONPrompting": ZImageJSONPrompting
1119
+ }
1120
+
1121
+ NODE_DISPLAY_NAME_MAPPINGS = {
1122
+ "ZImageJSONPrompting": "Z-Image JSON Prompt Generator"
1123
+ }