vibego 0.2.55__py3-none-any.whl → 0.2.57__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 vibego might be problematic. Click here for more details.
- bot.py +59 -10
- {vibego-0.2.55.dist-info → vibego-0.2.57.dist-info}/METADATA +1 -1
- {vibego-0.2.55.dist-info → vibego-0.2.57.dist-info}/RECORD +7 -7
- vibego_cli/__init__.py +1 -1
- {vibego-0.2.55.dist-info → vibego-0.2.57.dist-info}/WHEEL +0 -0
- {vibego-0.2.55.dist-info → vibego-0.2.57.dist-info}/entry_points.txt +0 -0
- {vibego-0.2.55.dist-info → vibego-0.2.57.dist-info}/top_level.txt +0 -0
bot.py
CHANGED
|
@@ -1344,6 +1344,36 @@ ATTACHMENT_USAGE_HINT = (
|
|
|
1344
1344
|
_FS_SAFE_PATTERN = re.compile(r"[^A-Za-z0-9._-]")
|
|
1345
1345
|
|
|
1346
1346
|
|
|
1347
|
+
def _attachment_directory_prefix_for_display(relative_path: str) -> Optional[str]:
|
|
1348
|
+
"""根据附件相对路径推导目录前缀,便于提示模型定位。"""
|
|
1349
|
+
|
|
1350
|
+
path_str = (relative_path or "").strip()
|
|
1351
|
+
if not path_str:
|
|
1352
|
+
return None
|
|
1353
|
+
|
|
1354
|
+
try:
|
|
1355
|
+
parent = Path(path_str).parent
|
|
1356
|
+
except Exception:
|
|
1357
|
+
return None
|
|
1358
|
+
|
|
1359
|
+
parent_str = parent.as_posix()
|
|
1360
|
+
if parent_str in {"", "."}:
|
|
1361
|
+
if path_str.startswith("./"):
|
|
1362
|
+
parent_str = "./"
|
|
1363
|
+
elif path_str.startswith("/"):
|
|
1364
|
+
parent_str = "/"
|
|
1365
|
+
else:
|
|
1366
|
+
return None
|
|
1367
|
+
else:
|
|
1368
|
+
if path_str.startswith("./") and not parent_str.startswith(("./", "/")):
|
|
1369
|
+
parent_str = f"./{parent_str}"
|
|
1370
|
+
|
|
1371
|
+
if not parent_str.endswith("/"):
|
|
1372
|
+
parent_str = f"{parent_str}/"
|
|
1373
|
+
|
|
1374
|
+
return parent_str
|
|
1375
|
+
|
|
1376
|
+
|
|
1347
1377
|
def _sanitize_fs_component(value: str, fallback: str) -> str:
|
|
1348
1378
|
"""清理路径片段中的特殊字符,避免越权访问。"""
|
|
1349
1379
|
|
|
@@ -1417,16 +1447,27 @@ def _guess_extension(mime_type: Optional[str], fallback: str = ".bin") -> str:
|
|
|
1417
1447
|
|
|
1418
1448
|
|
|
1419
1449
|
def _attachment_dir_for_message(message: Message, media_group_id: Optional[str] = None) -> Path:
|
|
1420
|
-
"""
|
|
1450
|
+
"""为当前消息生成附件目录,按项目标识 + 日期归档,便于模型定位。"""
|
|
1421
1451
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1452
|
+
# media_group_id 参数保留用于兼容旧调用,目前统一归档至日期目录。
|
|
1453
|
+
_ = media_group_id
|
|
1454
|
+
|
|
1455
|
+
# 优先使用项目 slug,回退到 bot 名称或通用前缀。
|
|
1456
|
+
project_identifier = PROJECT_SLUG or ""
|
|
1457
|
+
sanitized_project = _sanitize_fs_component(project_identifier, "project")
|
|
1458
|
+
if sanitized_project == "project":
|
|
1459
|
+
bot_username = getattr(message.bot, "username", None)
|
|
1460
|
+
sanitized_project = _sanitize_fs_component(bot_username or "bot", "bot")
|
|
1461
|
+
|
|
1462
|
+
# 使用消息时间(UTC)格式化日期,确保相同日期的附件集中存放。
|
|
1463
|
+
event_time = message.date or datetime.now(UTC)
|
|
1464
|
+
try:
|
|
1465
|
+
event_time = event_time.astimezone(UTC)
|
|
1466
|
+
except Exception:
|
|
1467
|
+
event_time = datetime.now(UTC)
|
|
1468
|
+
date_component = event_time.strftime("%Y-%m-%d")
|
|
1469
|
+
|
|
1470
|
+
target = ATTACHMENT_STORAGE_ROOT / sanitized_project / date_component
|
|
1430
1471
|
target.mkdir(parents=True, exist_ok=True)
|
|
1431
1472
|
return target
|
|
1432
1473
|
|
|
@@ -1617,7 +1658,15 @@ def _build_prompt_with_attachments(
|
|
|
1617
1658
|
if base_text:
|
|
1618
1659
|
sections.append(base_text)
|
|
1619
1660
|
if attachments:
|
|
1620
|
-
|
|
1661
|
+
directory_hint: Optional[str] = None
|
|
1662
|
+
for item in attachments:
|
|
1663
|
+
directory_hint = _attachment_directory_prefix_for_display(item.relative_path)
|
|
1664
|
+
if directory_hint:
|
|
1665
|
+
break
|
|
1666
|
+
if directory_hint:
|
|
1667
|
+
lines = [f"附件列表(文件位于项目工作目录({directory_hint}),可直接读取):"]
|
|
1668
|
+
else:
|
|
1669
|
+
lines = ["附件列表(文件位于项目工作目录,可直接读取):"]
|
|
1621
1670
|
for idx, item in enumerate(attachments, 1):
|
|
1622
1671
|
lines.append(
|
|
1623
1672
|
f"{idx}. {item.display_name}({item.mime_type})→ {item.relative_path}"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
bot.py,sha256
|
|
1
|
+
bot.py,sha256=-on8QBKAHcMtSWShP3cvqTJof2gWXLMUtPieaj7EpmM,291534
|
|
2
2
|
logging_setup.py,sha256=gvxHi8mUwK3IhXJrsGNTDo-DR6ngkyav1X-tvlBF_IE,4613
|
|
3
3
|
master.py,sha256=Jwxf6I94jOADzb9Xio1wb-tWy5wgQ9PlmdpKW4mhQMg,117114
|
|
4
4
|
project_repository.py,sha256=UcthtSGOJK0cTE5bQCneo3xkomRG-kyc1N1QVqxeHIs,17577
|
|
@@ -426,14 +426,14 @@ tasks/constants.py,sha256=tS1kZxBIUm3JJUMHm25XI-KHNUZl5NhbbuzjzL_rF-c,299
|
|
|
426
426
|
tasks/fsm.py,sha256=rKXXLEieQQU4r2z_CZUvn1_70FXiZXBBugF40gpe_tQ,1476
|
|
427
427
|
tasks/models.py,sha256=N_qqRBo9xMSV0vbn4k6bLBXT8C_dp_oTFUxvdx16ZQM,2459
|
|
428
428
|
tasks/service.py,sha256=w_S_aWiVqRXzXEpimLDsuCCCX2lB5uDkff9aKThBw9c,41916
|
|
429
|
-
vibego_cli/__init__.py,sha256=
|
|
429
|
+
vibego_cli/__init__.py,sha256=4SS400ravryVKHd1SCM6mZ6KOnzAD0aN3Bzkhcg9rb0,311
|
|
430
430
|
vibego_cli/__main__.py,sha256=qqTrYmRRLe4361fMzbI3-CqpZ7AhTofIHmfp4ykrrBY,158
|
|
431
431
|
vibego_cli/config.py,sha256=VxkPJMq01tA3h3cOkH-z_tiP7pMgfSGGicRvUnCWkhI,3054
|
|
432
432
|
vibego_cli/deps.py,sha256=1nRXI7Dd-S1hYE8DligzK5fIluQWETRUj4_OKL0DikQ,1419
|
|
433
433
|
vibego_cli/main.py,sha256=X__NXwZnIDIFbdKSTbNyZgZHKcPlN0DQz9sqTI1aQ9E,12158
|
|
434
434
|
vibego_cli/data/worker_requirements.txt,sha256=QSt30DSSSHtfucTFPpc7twk9kLS5rVLNTcvDiagxrZg,62
|
|
435
|
-
vibego-0.2.
|
|
436
|
-
vibego-0.2.
|
|
437
|
-
vibego-0.2.
|
|
438
|
-
vibego-0.2.
|
|
439
|
-
vibego-0.2.
|
|
435
|
+
vibego-0.2.57.dist-info/METADATA,sha256=uYSuc5xbtB4s-QP6Fmq7PU2IuECkWBoJomUrSa-NuZg,10519
|
|
436
|
+
vibego-0.2.57.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
437
|
+
vibego-0.2.57.dist-info/entry_points.txt,sha256=Lsy_zm-dlyxt8-9DL9blBReIwU2k22c8-kifr46ND1M,48
|
|
438
|
+
vibego-0.2.57.dist-info/top_level.txt,sha256=R56CT3nW5H5v3ce0l3QDN4-C4qxTrNWzRTwrxnkDX4U,69
|
|
439
|
+
vibego-0.2.57.dist-info/RECORD,,
|
vibego_cli/__init__.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|