XMWAI 0.3.25__tar.gz → 0.3.26__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of XMWAI might be problematic. Click here for more details.
- {xmwai-0.3.25/XMWAI.egg-info → xmwai-0.3.26}/PKG-INFO +1 -1
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/web_core.py +56 -105
- {xmwai-0.3.25 → xmwai-0.3.26/XMWAI.egg-info}/PKG-INFO +1 -1
- {xmwai-0.3.25 → xmwai-0.3.26}/setup.py +1 -1
- {xmwai-0.3.25 → xmwai-0.3.26}/LICENSE.txt +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/MANIFEST.in +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/README.md +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/__init__.py +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/bomb_core.py +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/core.py +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/file/__init__.py +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/file/idiom.json +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/0.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/1.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/10.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/11.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/12.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/13.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/14.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/15.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/16.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/17.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/18.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/19.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/2.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/20.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/21.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/22.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/23.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/24.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/25.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/26.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/27.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/28.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/29.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/3.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/30.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/31.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/32.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/33.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/34.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/35.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/36.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/37.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/38.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/39.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/4.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/40.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/41.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/42.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/43.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/44.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/45.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/46.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/47.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/48.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/49.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/5.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/50.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/51.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/52.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/53.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/54.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/55.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/56.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/57.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/58.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/59.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/6.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/60.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/61.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/62.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/63.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/64.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/65.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/66.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/67.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/68.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/69.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/7.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/70.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/71.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/72.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/73.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/74.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/75.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/76.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/77.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/78.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/79.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/8.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/80.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/81.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/82.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/83.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/84.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/85.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/9.gif +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/gif/__init__.py +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/idiom_core.py +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/magic_core.py +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/burger.js +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/BottomBun.png +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/TopBun.png +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/beef.png +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/bg.jpeg +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/bg.png +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/cheese.png +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/lettuce.png +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/sauce.png +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/static/images/tomato.png +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/templates/burger.html +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/templates/nutrition_pie.html +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/templates//345/210/233/346/204/217/350/217/234/350/260/261.html" +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/trial_class.py +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI.egg-info/SOURCES.txt +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI.egg-info/dependency_links.txt +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI.egg-info/requires.txt +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/XMWAI.egg-info/top_level.txt +0 -0
- {xmwai-0.3.25 → xmwai-0.3.26}/setup.cfg +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from PIL import Image, ImageDraw
|
|
2
|
-
import random
|
|
3
1
|
import os
|
|
4
2
|
import json
|
|
5
3
|
import requests
|
|
@@ -90,8 +88,8 @@ emoji_dict = {
|
|
|
90
88
|
|
|
91
89
|
# 动作对应 emoji
|
|
92
90
|
action_dict = {
|
|
93
|
-
"炒": "🍳", "煮": "🍲", "烤": "🔥", "蒸": "♨️", "炸": "🍟",
|
|
94
|
-
"
|
|
91
|
+
"炒": "🍳", "煮": "🍲", "烤": "🔥", "蒸": "♨️", "炸": "🍟", "拌": "🥣",
|
|
92
|
+
"切": "🔪", "腌": "🫙", "炖": "🥘"
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
|
|
@@ -110,6 +108,7 @@ def format_section_steps(text):
|
|
|
110
108
|
|
|
111
109
|
|
|
112
110
|
def parse_nutrition_section(text):
|
|
111
|
+
"""解析 API 返回的营养 JSON 并提取数值"""
|
|
113
112
|
default_data = {"蛋白质": 30, "脂肪": 20, "碳水化合物": 50, "维生素": 10, "矿物质": 5}
|
|
114
113
|
|
|
115
114
|
def extract_number(val):
|
|
@@ -154,34 +153,11 @@ def generate_pie_chart(data_dict, filename: Path):
|
|
|
154
153
|
return filename
|
|
155
154
|
|
|
156
155
|
|
|
157
|
-
def random_gradient_bg(bg_path: Path):
|
|
158
|
-
"""生成一张随机渐变背景图"""
|
|
159
|
-
width, height = 1200, 800
|
|
160
|
-
|
|
161
|
-
# 随机挑两个颜色 (RGB)
|
|
162
|
-
start_color = (random.randint(100, 255), random.randint(
|
|
163
|
-
100, 255), random.randint(100, 255))
|
|
164
|
-
end_color = (random.randint(100, 255), random.randint(
|
|
165
|
-
100, 255), random.randint(100, 255))
|
|
166
|
-
|
|
167
|
-
img = Image.new("RGB", (width, height), start_color)
|
|
168
|
-
draw = ImageDraw.Draw(img)
|
|
169
|
-
|
|
170
|
-
for y in range(height):
|
|
171
|
-
r = int(start_color[0] + (end_color[0] - start_color[0]) * y / height)
|
|
172
|
-
g = int(start_color[1] + (end_color[1] - start_color[1]) * y / height)
|
|
173
|
-
b = int(start_color[2] + (end_color[2] - start_color[2]) * y / height)
|
|
174
|
-
draw.line([(0, y), (width, y)], fill=(r, g, b))
|
|
175
|
-
|
|
176
|
-
img.save(bg_path, "JPEG")
|
|
177
|
-
print(f"🎨 生成随机渐变背景:{bg_path}")
|
|
178
|
-
|
|
179
|
-
|
|
180
156
|
def cookbook(m, t, s, key):
|
|
181
157
|
if key != "CaJQ":
|
|
182
158
|
return "密钥错误,无法生成食谱。"
|
|
183
159
|
|
|
184
|
-
# 调用 API
|
|
160
|
+
# 调用 API 生成创意菜谱
|
|
185
161
|
messagesList = [
|
|
186
162
|
{"role": "system", "content": "天马行空的创意菜厨师"},
|
|
187
163
|
{"role": "user", "content": f"请以{m}为主菜,{s}为配菜,{t}为烹饪方式写一个创意食谱,"
|
|
@@ -193,8 +169,11 @@ def cookbook(m, t, s, key):
|
|
|
193
169
|
url = "https://qianfan.baidubce.com/v2/chat/completions"
|
|
194
170
|
payload = json.dumps({"model": "ernie-4.5-turbo-32k",
|
|
195
171
|
"messages": messagesList}, ensure_ascii=False)
|
|
196
|
-
headers = {
|
|
197
|
-
|
|
172
|
+
headers = {
|
|
173
|
+
"Content-Type": "application/json",
|
|
174
|
+
"appid": "",
|
|
175
|
+
"Authorization": "Bearer bce-v3/ALTAK-cGbxpVA5AbSz6h8nbLaFh/b539762075d55c76d93dc78bcf0a91beeaf0490a"
|
|
176
|
+
}
|
|
198
177
|
|
|
199
178
|
try:
|
|
200
179
|
response = requests.post(url, headers=headers,
|
|
@@ -206,12 +185,12 @@ def cookbook(m, t, s, key):
|
|
|
206
185
|
|
|
207
186
|
# 分割内容
|
|
208
187
|
sections = re.split(r"(创意灵感|食材清单|制作步骤|食材搭配的营养价值)", content)
|
|
209
|
-
body_sections = [""]
|
|
188
|
+
body_sections = [""]*4
|
|
210
189
|
title_map = {"创意灵感": 0, "食材清单": 1, "制作步骤": 2, "食材搭配的营养价值": 3}
|
|
211
190
|
i = 1
|
|
212
191
|
while i < len(sections):
|
|
213
192
|
header = sections[i]
|
|
214
|
-
text_sec = sections[i
|
|
193
|
+
text_sec = sections[i+1] if i+1 < len(sections) else ""
|
|
215
194
|
idx = title_map.get(header.strip(), None)
|
|
216
195
|
if idx is not None:
|
|
217
196
|
body_sections[idx] = text_sec.strip()
|
|
@@ -221,20 +200,20 @@ def cookbook(m, t, s, key):
|
|
|
221
200
|
templates_dir = Path(files("XMWAI") / "templates")
|
|
222
201
|
templates_dir.mkdir(exist_ok=True)
|
|
223
202
|
|
|
224
|
-
#
|
|
203
|
+
# 静态图片路径(PyPI 安装后能读取)
|
|
225
204
|
bg_path = Path(files("XMWAI") / "static" / "images" / "bg.jpeg")
|
|
226
|
-
random_gradient_bg(bg_path)
|
|
227
205
|
|
|
228
|
-
#
|
|
206
|
+
# 生成饼图文件
|
|
229
207
|
pie_chart_file = templates_dir / "nutrition_pie.html"
|
|
230
208
|
nutrient_data = parse_nutrition_section(body_sections[3])
|
|
231
209
|
generate_pie_chart(nutrient_data, pie_chart_file)
|
|
232
210
|
|
|
233
211
|
# 添加 emoji
|
|
234
|
-
m_emoji
|
|
235
|
-
|
|
212
|
+
m_emoji = add_emoji_to_text(m)
|
|
213
|
+
s_emoji = add_emoji_to_text(s)
|
|
214
|
+
t_emoji = add_emoji_to_text(t)
|
|
236
215
|
|
|
237
|
-
#
|
|
216
|
+
# 步骤顺序 HTML
|
|
238
217
|
step_titles = ["食材搭配的营养价值", "创意灵感", "食材清单", "制作步骤"]
|
|
239
218
|
steps_order = [3, 0, 1, 2]
|
|
240
219
|
steps_html = ""
|
|
@@ -244,89 +223,61 @@ def cookbook(m, t, s, key):
|
|
|
244
223
|
else:
|
|
245
224
|
section_content_html = format_section_steps(body_sections[idx])
|
|
246
225
|
steps_html += f"""
|
|
247
|
-
<div class="step-card" style="animation-delay:{(i
|
|
248
|
-
<div class="step-title">Step {i
|
|
226
|
+
<div class="step-card" style="animation-delay:{(i+1)*0.2}s;">
|
|
227
|
+
<div class="step-title">Step {i+1} 📝 {step_titles[i]}</div>
|
|
249
228
|
<div class="step-content">{section_content_html}</div>
|
|
250
229
|
</div>
|
|
251
230
|
"""
|
|
252
231
|
|
|
253
|
-
#
|
|
254
|
-
bg_rel_path = os.path.relpath(bg_path, templates_dir)
|
|
255
|
-
pie_rel_path = os.path.relpath(pie_chart_file, templates_dir)
|
|
256
|
-
|
|
257
|
-
# HTML 文件
|
|
258
|
-
safe_title = re.sub(r'[\/\\:*?"<>|]', "", m + t + s)
|
|
259
|
-
html_file = templates_dir / f"{safe_title}_菜谱.html"
|
|
260
|
-
|
|
232
|
+
# HTML 页面
|
|
261
233
|
html = f"""
|
|
262
234
|
<!DOCTYPE html>
|
|
263
235
|
<html lang="zh">
|
|
264
236
|
<head>
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
.banner {{
|
|
282
|
-
width:100%; height:220px;
|
|
283
|
-
background:url('{bg_rel_path}') center/cover no-repeat;
|
|
284
|
-
border-radius:15px 15px 0 0;
|
|
285
|
-
display:flex; align-items:center; justify-content:center;
|
|
286
|
-
}}
|
|
287
|
-
.banner h1 {{ color:#fff; font-size:28px; text-shadow:1px 1px 3px #666; }}
|
|
288
|
-
p {{ font-size:18px; margin:8px 0; }}
|
|
289
|
-
.step-card {{
|
|
290
|
-
background:#fff0b3; margin:10px 0; border-radius:12px;
|
|
291
|
-
overflow:hidden; opacity:0; transform:translateY(20px) scale(0.98);
|
|
292
|
-
animation:fadeInUp 0.6s forwards;
|
|
293
|
-
}}
|
|
294
|
-
.step-title {{
|
|
295
|
-
font-weight:bold; padding:10px 15px; cursor:pointer;
|
|
296
|
-
background:#ffb347; color:#fff; border-bottom:1px solid #ffd27f;
|
|
297
|
-
}}
|
|
298
|
-
.step-content {{
|
|
299
|
-
padding:10px 15px; display:block; font-size:16px;
|
|
300
|
-
opacity:0; max-height:0; overflow:hidden;
|
|
301
|
-
transition: opacity 0.4s ease, max-height 0.4s ease;
|
|
302
|
-
}}
|
|
303
|
-
.step-card.hover .step-content {{ opacity:1; max-height:800px; }}
|
|
304
|
-
iframe {{ width:100%; height:500px; border:none; margin-top:20px; }}
|
|
305
|
-
@keyframes fadeInUp {{ to {{ opacity:1; transform:translateY(0) scale(1); }} }}
|
|
306
|
-
</style>
|
|
237
|
+
<meta charset="UTF-8">
|
|
238
|
+
<title>创意菜谱</title>
|
|
239
|
+
<style>
|
|
240
|
+
html, body {{ margin:0; padding:0; width:100%; height:100%; overflow-x:hidden; }}
|
|
241
|
+
body {{ font-family:"微软雅黑",sans-serif; background:#2c2c2c url('{bg_path.resolve()}') no-repeat center center fixed; background-size:cover; color:#333; }}
|
|
242
|
+
.container {{ max-width:1200px; margin:30px auto; background:rgba(255,248,220,0.95); border-radius:15px; padding:30px; box-shadow:0 0 20px rgba(0,0,0,0.2); }}
|
|
243
|
+
.banner {{ width:100%; height:220px; background:url('{bg_path.resolve()}') center/cover no-repeat; border-radius:15px 15px 0 0; display:flex; align-items:center; justify-content:center; }}
|
|
244
|
+
.banner h1 {{ color:#fff; font-size:28px; text-shadow:1px 1px 3px #666; }}
|
|
245
|
+
p {{ font-size:18px; margin:8px 0; }}
|
|
246
|
+
.step-card {{ background:#fff0b3; margin:10px 0; border-radius:12px; overflow:hidden; opacity:0; transform:translateY(20px) scale(0.98); animation:fadeInUp 0.6s forwards; }}
|
|
247
|
+
.step-title {{ font-weight:bold; padding:10px 15px; cursor:pointer; background:#ffb347; color:#fff; border-bottom:1px solid #ffd27f; }}
|
|
248
|
+
.step-content {{ padding:10px 15px; display:block; font-size:16px; opacity:0; max-height:0; overflow:hidden; transition: opacity 0.4s ease, max-height 0.4s ease; }}
|
|
249
|
+
.step-card.hover .step-content {{ opacity:1; max-height:800px; }}
|
|
250
|
+
iframe {{ width:100%; height:500px; border:none; margin-top:20px; }}
|
|
251
|
+
@keyframes fadeInUp {{ to {{ opacity:1; transform:translateY(0) scale(1); }} }}
|
|
252
|
+
</style>
|
|
307
253
|
</head>
|
|
308
254
|
<body>
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
255
|
+
<div class="container">
|
|
256
|
+
<div class="banner"><h1>🍽 {m+t+s}</h1></div>
|
|
257
|
+
<p>🍖 <strong>主菜:</strong>{m_emoji}</p>
|
|
258
|
+
<p>🥗 <strong>配菜:</strong>{s_emoji}</p>
|
|
259
|
+
<p>👩🍳 <strong>做法:</strong>{t_emoji}</p>
|
|
260
|
+
{steps_html}
|
|
261
|
+
<iframe src="{pie_chart_file.resolve()}"></iframe>
|
|
262
|
+
</div>
|
|
263
|
+
<script>
|
|
264
|
+
const steps = document.querySelectorAll('.step-card');
|
|
265
|
+
steps.forEach(card => {{
|
|
266
|
+
card.addEventListener('mouseenter', () => {{ card.classList.add('hover'); }});
|
|
267
|
+
card.addEventListener('mouseleave', () => {{ card.classList.remove('hover'); }});
|
|
268
|
+
}});
|
|
269
|
+
</script>
|
|
324
270
|
</body>
|
|
325
271
|
</html>
|
|
326
272
|
"""
|
|
327
273
|
|
|
274
|
+
# 保存 HTML 文件到包内 templates
|
|
275
|
+
safe_title = re.sub(r'[\/\\:*?"<>|]', "", m+t+s)
|
|
276
|
+
html_file = templates_dir / f"{safe_title}_菜谱.html"
|
|
328
277
|
with open(html_file, "w", encoding="utf-8") as f:
|
|
329
278
|
f.write(html)
|
|
330
279
|
|
|
280
|
+
# 打开浏览器
|
|
331
281
|
webbrowser.open(f"file://{html_file.resolve()}")
|
|
282
|
+
|
|
332
283
|
return content
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="XMWAI", # 包名(pip install XMWAI)
|
|
5
|
-
version="0.3.
|
|
5
|
+
version="0.3.26", # 每次上传记得升级版本号
|
|
6
6
|
author="pydevelopment", # 作者
|
|
7
7
|
author_email="hekai@xiaoma.cn", # 邮箱
|
|
8
8
|
description="Small code King AI related library", # 简短描述
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xmwai-0.3.25 → xmwai-0.3.26}/XMWAI/templates//345/210/233/346/204/217/350/217/234/350/260/261.html"
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|