diff --git a/ga.py b/ga.py index 16aa93c..95f325d 100644 --- a/ga.py +++ b/ga.py @@ -1,4 +1,4 @@ -import sys, os, re, json, time, pyperclip, threading +import sys, os, re, json, time, threading from pathlib import Path import tempfile, traceback, subprocess, itertools, collections if sys.stdout is None: sys.stdout = open(os.devnull, "w") @@ -22,7 +22,7 @@ def code_run(code: str, code_type: str = "python", timeout: int = 60, cwd: str = tmp_file.write(code) tmp_path = tmp_file.name tmp_file.close() - cmd = ["python", "-X", "utf8", "-u", tmp_path] + cmd = [sys.executable, "-X", "utf8", "-u", tmp_path] elif code_type in ["powershell", "bash"]: if os.name == 'nt': cmd = ["powershell", "-NoProfile", "-NonInteractive", "-Command", code] else: cmd = ["bash", "-c", code] diff --git a/sidercall.py b/sidercall.py index cb0dbee..bf52f28 100644 --- a/sidercall.py +++ b/sidercall.py @@ -1,5 +1,4 @@ import os, json, re, time, requests -from sider_ai_api import Session try: from mykey import sider_cookie except ImportError: sider_cookie = "" @@ -8,6 +7,7 @@ except ImportError: oai_apikey = oai_apibase = oai_model = "" class SiderLLMSession: def __init__(self, default_model="gemini-3.0-flash"): + from sider_ai_api import Session self._core = Session(cookie=sider_cookie, proxies={'https':'127.0.0.1:2082'}) self.default_model = default_model def ask(self, prompt, model=None): diff --git a/simphtml.py b/simphtml.py index 4542e86..bbd3c93 100644 --- a/simphtml.py +++ b/simphtml.py @@ -1,4 +1,5 @@ -from bs4 import BeautifulSoup +try: from bs4 import BeautifulSoup +except ImportError: print("[Error] BeautifulSoup4 未安装,请叫Agent安装BeautifulSoup4,再使用web相关工具。") js_optHTML = r'''function optHTML() { function createEnhancedDOMCopy() {