XMWAI 0.3.2__tar.gz → 0.3.22__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.

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