XMWAI 0.3.26__py3-none-any.whl → 0.4.0__py3-none-any.whl

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/core.py CHANGED
@@ -1,9 +1,9 @@
1
- import re
2
- import requests
3
- import json
4
1
  import os
5
2
  import turtle
3
+ import json
4
+ import re
6
5
  import zipfile
6
+ import requests
7
7
 
8
8
 
9
9
  # U1-02 Story GPT----------------------------------
XMWAI/web_core.py CHANGED
@@ -1,18 +1,19 @@
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
5
+ import time
6
+ import shutil
8
7
  import webbrowser
9
8
  import threading
10
- import time
9
+ from flask import Flask, render_template
10
+ from pyecharts import options as opts
11
+ from pyecharts.charts import Pie
11
12
  from importlib.resources import files
12
13
  from pathlib import Path
13
14
 
14
15
 
15
- '''Super堡'''
16
+ '''U3-04 Super堡'''
16
17
  # 搭建flask框架
17
18
  app = Flask(
18
19
  __name__,
@@ -76,7 +77,8 @@ def start_server(port=5050):
76
77
  pass
77
78
 
78
79
 
79
- '''Random料理屋'''
80
+
81
+ '''U3-03 Random料理屋'''
80
82
  # 食材对应 emoji
81
83
  emoji_dict = {
82
84
  "鸡": "🍗", "牛": "🥩", "猪": "🥓", "鱼": "🐟", "虾": "🦐", "蟹": "🦀",
@@ -200,8 +202,11 @@ def cookbook(m, t, s, key):
200
202
  templates_dir = Path(files("XMWAI") / "templates")
201
203
  templates_dir.mkdir(exist_ok=True)
202
204
 
203
- # 静态图片路径(PyPI 安装后能读取)
204
- bg_path = Path(files("XMWAI") / "static" / "images" / "bg.jpeg")
205
+ # 从包内 static 拷贝背景图到模板目录
206
+ bg_src = Path(files("XMWAI") / "static" / "images" / "bg.jpeg")
207
+ bg_copy = templates_dir / "bg.jpeg"
208
+ if not bg_copy.exists():
209
+ shutil.copy(bg_src, bg_copy)
205
210
 
206
211
  # 生成饼图文件
207
212
  pie_chart_file = templates_dir / "nutrition_pie.html"
@@ -229,7 +234,7 @@ def cookbook(m, t, s, key):
229
234
  </div>
230
235
  """
231
236
 
232
- # HTML 页面
237
+ # HTML 页面 (背景图引用相对路径 bg.jpeg)
233
238
  html = f"""
234
239
  <!DOCTYPE html>
235
240
  <html lang="zh">
@@ -238,9 +243,9 @@ def cookbook(m, t, s, key):
238
243
  <title>创意菜谱</title>
239
244
  <style>
240
245
  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; }}
246
+ body {{ font-family:"微软雅黑",sans-serif; background:#2c2c2c url('bg.jpeg') no-repeat center center fixed; background-size:cover; color:#333; }}
242
247
  .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; }}
248
+ .banner {{ width:100%; height:220px; background:url('bg.jpeg') center/cover no-repeat; border-radius:15px 15px 0 0; display:flex; align-items:center; justify-content:center; }}
244
249
  .banner h1 {{ color:#fff; font-size:28px; text-shadow:1px 1px 3px #666; }}
245
250
  p {{ font-size:18px; margin:8px 0; }}
246
251
  .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; }}
@@ -258,7 +263,7 @@ def cookbook(m, t, s, key):
258
263
  <p>🥗 <strong>配菜:</strong>{s_emoji}</p>
259
264
  <p>👩‍🍳 <strong>做法:</strong>{t_emoji}</p>
260
265
  {steps_html}
261
- <iframe src="{pie_chart_file.resolve()}"></iframe>
266
+ <iframe src="{pie_chart_file.name}"></iframe>
262
267
  </div>
263
268
  <script>
264
269
  const steps = document.querySelectorAll('.step-card');
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: XMWAI
3
- Version: 0.3.26
3
+ Version: 0.4.0
4
4
  Summary: Small code King AI related library
5
5
  Home-page: https://github.com/Tonykai88/XMWAI.git
6
6
  Author: pydevelopment
@@ -1,10 +1,10 @@
1
1
  XMWAI/__init__.py,sha256=-0GLZK0X3vEuTbu5n2AX3cWw6SXtJTERtBIAssZq41o,908
2
2
  XMWAI/bomb_core.py,sha256=h2ZPH3SuoG2L_XOf1dcK8p3lhw5QzhneWl2yMLj1RiU,1819
3
- XMWAI/core.py,sha256=XG2ZLhW9CETUQMr-8FLZonL_aQg9jfohGnm9oU5XyVQ,10018
3
+ XMWAI/core.py,sha256=Mxyj1yJhCwmS0ImwVmvjm-J628HoENsddKpkuRaj0vQ,10018
4
4
  XMWAI/idiom_core.py,sha256=yU-VHhqqoutVm6GVikcjL3m9yuB1hUsFBpPYvwY4n5g,1689
5
5
  XMWAI/magic_core.py,sha256=Ms4b12PJ8rjsmceg1VUqWCWx2ebvdhLp4sIF6K_Vaok,3491
6
6
  XMWAI/trial_class.py,sha256=GRDEe24a-DYMRyoTLgJbE5dCSQY0CbYqB5ALsBfYmtA,10226
7
- XMWAI/web_core.py,sha256=3nXhv2VdLT5RbWpRF2f7bBPmMaEDt5ZvLl_LarseByI,10781
7
+ XMWAI/web_core.py,sha256=7awPg1kYW3lYrbgylqJvUF3g050bn6H21PgmQ7Kv1wA,10927
8
8
  XMWAI/file/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  XMWAI/file/idiom.json,sha256=HUtPRUzhxBbWoasjadbmbA_5ngQ5AXLu9weQSZ4hzhk,10319857
10
10
  XMWAI/gif/0.gif,sha256=LGpAReVTyZEb1J-bWYTpxxHbIxmLJ-3wA0lw4cBqdsY,303
@@ -107,8 +107,8 @@ XMWAI/static/images/tomato.png,sha256=FEOEAOdUhW_BDFgTpxOkYc0I5Iu29_gtHb3RIPEej0
107
107
  XMWAI/templates/burger.html,sha256=vDnxpSW8phetyScySsalScZnFKl3LNpy5lJjKxGXgbI,3320
108
108
  XMWAI/templates/nutrition_pie.html,sha256=yJVXI28i-UfvF0xOXGSNLMb8oCJNhh2J3zoRDr5_7DM,5567
109
109
  XMWAI/templates/创意菜谱.html,sha256=RcDgH58QLyUJ9A59wobu3wvchGBY1snVsXcZQZam5M0,4805
110
- xmwai-0.3.26.dist-info/licenses/LICENSE.txt,sha256=bcaIQMrIhdQ3O-PoZlexjmW6h-wLGvHxh5Oksl4ohtc,1066
111
- xmwai-0.3.26.dist-info/METADATA,sha256=rHeE3l7YYAxISpygMmdxJ9FI3ClJQ4oikrr4Ybtev54,1198
112
- xmwai-0.3.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
113
- xmwai-0.3.26.dist-info/top_level.txt,sha256=yvGcDI-sggK5jqd9wz0saipZvk3oIE3hNGHlqUjxf0c,6
114
- xmwai-0.3.26.dist-info/RECORD,,
110
+ xmwai-0.4.0.dist-info/licenses/LICENSE.txt,sha256=bcaIQMrIhdQ3O-PoZlexjmW6h-wLGvHxh5Oksl4ohtc,1066
111
+ xmwai-0.4.0.dist-info/METADATA,sha256=oUlOhWPKH78hdoSlvaVgn82BrCmF52IK3J6gPUiKRzI,1197
112
+ xmwai-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
113
+ xmwai-0.4.0.dist-info/top_level.txt,sha256=yvGcDI-sggK5jqd9wz0saipZvk3oIE3hNGHlqUjxf0c,6
114
+ xmwai-0.4.0.dist-info/RECORD,,
File without changes