XMWAI 0.1.5__py3-none-any.whl → 0.1.7__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/__init__.py +2 -1
- XMWAI/bomb_core.py +1 -1
- XMWAI/core.py +30 -20
- XMWAI/idiom_core.py +5 -3
- {xmwai-0.1.5.dist-info → xmwai-0.1.7.dist-info}/METADATA +1 -1
- {xmwai-0.1.5.dist-info → xmwai-0.1.7.dist-info}/RECORD +9 -9
- {xmwai-0.1.5.dist-info → xmwai-0.1.7.dist-info}/WHEEL +0 -0
- {xmwai-0.1.5.dist-info → xmwai-0.1.7.dist-info}/licenses/LICENSE.txt +0 -0
- {xmwai-0.1.5.dist-info → xmwai-0.1.7.dist-info}/top_level.txt +0 -0
XMWAI/__init__.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from .core import story, photo, reply, poem, get_access_token # 从子模块导入函数到顶层
|
|
2
2
|
from .magic_core import birthday # 从子模块导入函数到顶层
|
|
3
3
|
from .bomb_core import bomb # 从子模块导入函数到顶层
|
|
4
|
+
from .idiom_core import idiom,searchIdiom # 从子模块导入函数到顶层
|
|
4
5
|
|
|
5
|
-
__all__ = ["story", "photo", "reply", "poem", "get_access_token", 'birthday', 'bomb'] # 可选:明确导出的内容
|
|
6
|
+
__all__ = ["story", "photo", "reply", "poem", "get_access_token", 'birthday', 'bomb', "idiom", "searchIdiom"] # 可选:明确导出的内容
|
XMWAI/bomb_core.py
CHANGED
|
@@ -24,7 +24,7 @@ def bomb(screen, x, y):
|
|
|
24
24
|
|
|
25
25
|
# 第一次加载时:将所有 gif 加载为 turtle 形状
|
|
26
26
|
if not hasattr(bomb, "_gif_loaded"):
|
|
27
|
-
gif_dir = files("
|
|
27
|
+
gif_dir = files("XMWAI.gif") # 注意:XMWAI/gif/__init__.py 必须存在
|
|
28
28
|
|
|
29
29
|
bomb._shapes = [] # 保存所有完整路径
|
|
30
30
|
for i in range(86):
|
XMWAI/core.py
CHANGED
|
@@ -184,24 +184,34 @@ def poem(title, key=""):
|
|
|
184
184
|
elif key != "CaJQ":
|
|
185
185
|
print("秘钥错误!请重新输入!")
|
|
186
186
|
return "秘钥错误!请重新输入!"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
187
|
+
messagesList = [
|
|
188
|
+
{
|
|
189
|
+
"role": "system",
|
|
190
|
+
"content": "唐代诗人"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"role": "user",
|
|
194
|
+
"content": f"请以《{title}》为题,创作一首七言绝句,每句7个字,一共4句,符合古诗韵律规范,内容积极乐观向上,适合中小学生阅读,不要解析,不要题目,不要标点符号,所有文字放在一行"
|
|
195
|
+
}
|
|
196
|
+
]
|
|
198
197
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
198
|
+
url = "https://qianfan.baidubce.com/v2/chat/completions"
|
|
199
|
+
|
|
200
|
+
payload = json.dumps({
|
|
201
|
+
"model": "ernie-4.5-turbo-32k",
|
|
202
|
+
"messages": messagesList
|
|
203
|
+
}, ensure_ascii=False)
|
|
204
|
+
headers = {
|
|
205
|
+
'Content-Type': 'application/json',
|
|
206
|
+
'appid': '',
|
|
207
|
+
'Authorization': 'Bearer bce-v3/ALTAK-cGbxpVA5AbSz6h8nbLaFh/b539762075d55c76d93dc78bcf0a91beeaf0490a'
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
response = requests.request("POST", url, headers=headers, data=payload.encode("utf-8"))
|
|
211
|
+
|
|
212
|
+
response_data = json.loads(response.text)
|
|
213
|
+
content = response_data["choices"][0]["message"]["content"]
|
|
214
|
+
content.replace(" ", "")
|
|
215
|
+
content.replace("\n", "")
|
|
216
|
+
content.replace(" ", "")
|
|
217
|
+
return content
|
XMWAI/idiom_core.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import random
|
|
2
|
-
|
|
3
2
|
import json
|
|
4
3
|
|
|
5
4
|
|
|
@@ -56,8 +55,11 @@ def searchIdiom(text, num=1):
|
|
|
56
55
|
with open("idiom.json", "r", encoding="utf-8") as f:
|
|
57
56
|
data = json.load(f)
|
|
58
57
|
for i in data:
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
try:
|
|
59
|
+
if text == i["word"][num-1]:
|
|
60
|
+
wordList.append(i["word"])
|
|
61
|
+
except:
|
|
62
|
+
pass
|
|
61
63
|
if wordList:
|
|
62
64
|
return random.choice(wordList)
|
|
63
65
|
else:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
XMWAI/__init__.py,sha256=
|
|
2
|
-
XMWAI/bomb_core.py,sha256=
|
|
3
|
-
XMWAI/core.py,sha256=
|
|
4
|
-
XMWAI/idiom_core.py,sha256=
|
|
1
|
+
XMWAI/__init__.py,sha256=GuNnfM345TTSZW45YiwEt1dM6Ay0biP1bQBrGpqqmEg,464
|
|
2
|
+
XMWAI/bomb_core.py,sha256=dRORqAyhItkFuMUHAN0vwQcvrvb3C5X18hmaUMJ0hhE,1708
|
|
3
|
+
XMWAI/core.py,sha256=KrtdKXvSGKAHlOYF1-v2iSxpfjpHoGeGVOBIxH1Ez4E,7759
|
|
4
|
+
XMWAI/idiom_core.py,sha256=H3OhYbcGeyGwibrgq2JLHlYD5eVmxVJAmKyFFYn88cY,1839
|
|
5
5
|
XMWAI/magic_core.py,sha256=XU7K4Ta7EAvwBLk20_Hlu18E6Kz8B0HxUBq0YsawikE,3441
|
|
6
6
|
XMWAI/gif/0.gif,sha256=LGpAReVTyZEb1J-bWYTpxxHbIxmLJ-3wA0lw4cBqdsY,303
|
|
7
7
|
XMWAI/gif/1.gif,sha256=nsysRjMkNBQJy91SOY284gnnD_DlhLrgyIOgcJ_ZOHI,3554
|
|
@@ -90,8 +90,8 @@ XMWAI/gif/84.gif,sha256=6Ip_uQmvrr2fagLXu1YqWyI_DL2PVVtKCPtmNtzt3P4,38767
|
|
|
90
90
|
XMWAI/gif/85.gif,sha256=6Ip_uQmvrr2fagLXu1YqWyI_DL2PVVtKCPtmNtzt3P4,38767
|
|
91
91
|
XMWAI/gif/9.gif,sha256=cPouth-xwc3QPcg2m6HMP2OD1ZCeRBD_-RPImvvKAA0,9485
|
|
92
92
|
XMWAI/gif/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
93
|
-
xmwai-0.1.
|
|
94
|
-
xmwai-0.1.
|
|
95
|
-
xmwai-0.1.
|
|
96
|
-
xmwai-0.1.
|
|
97
|
-
xmwai-0.1.
|
|
93
|
+
xmwai-0.1.7.dist-info/licenses/LICENSE.txt,sha256=bcaIQMrIhdQ3O-PoZlexjmW6h-wLGvHxh5Oksl4ohtc,1066
|
|
94
|
+
xmwai-0.1.7.dist-info/METADATA,sha256=Brl-47g-2N-wyM20O9Mhepb4Y5_lPTE4McoFcMiGICc,1033
|
|
95
|
+
xmwai-0.1.7.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
96
|
+
xmwai-0.1.7.dist-info/top_level.txt,sha256=yvGcDI-sggK5jqd9wz0saipZvk3oIE3hNGHlqUjxf0c,6
|
|
97
|
+
xmwai-0.1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|