打开资源管理器|资源管理器|打开我的电脑|我的电脑|此电脑|打开此电脑|打开C盘|C盘|打开D盘|D盘|打开桌面|桌面|打开下载|下载|c盘|d盘

import os
import re

# 获取用户输入
text = query.strip().lower()

# 去除空格、标点以及常见动作词
text = re.sub(r"[\s，。！？、,!.?]", "", text)
text = re.sub(r"^(请|帮我|帮忙|打开|启动|进入|查看)", "", text)

home_dir = os.path.expanduser("~")

if "资源管理器" in text:
    target = os.path.join(
        os.environ.get("WINDIR", r"C:\Windows"),
        "explorer.exe"
    )
    name = "资源管理器"

elif "我的电脑" in text or "此电脑" in text:
    target = r"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
    name = "此电脑"

elif "c盘" in text:
    target = r"C:\\"
    name = "C盘"

elif "d盘" in text:
    target = r"D:\\"
    name = "D盘"

elif "桌面" in text:
    target = os.path.join(home_dir, "Desktop")
    name = "桌面"

elif "下载" in text:
    target = os.path.join(home_dir, "Downloads")
    name = "下载"

else:
    target = None
    name = None

try:
    if target is None:
        result = f"无法识别的位置：{query}"

    elif not target.startswith("::{") and not os.path.exists(target):
        result = f"{name}不存在：{target}"

    else:
        os.startfile(target)
        result = f"已打开{name}"

except Exception as error:
    result = f"打开{name}失败：{error}"
