update userscript guard and scheduler flag
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name ljq_web_driver
|
// @name ljq_web_driver
|
||||||
// @namespace http://tampermonkey.net/
|
// @namespace http://tampermonkey.net/
|
||||||
// @version 0.32
|
// @version 0.33
|
||||||
// @description Execute JS via ljq_web_driver
|
// @description Execute JS via ljq_web_driver
|
||||||
// @require https://code.jquery.com/jquery-3.6.0.min.js
|
// @require https://code.jquery.com/jquery-3.6.0.min.js
|
||||||
// @author You
|
// @author You
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const log_prefix = "ljq_driver: ";
|
const log_prefix = "ljq_driver: ";
|
||||||
if (document.querySelector('[data-testid="stApp"],.stApp')) return;
|
if (document.querySelector('[data-testid="stApp"],.stApp')) return;
|
||||||
|
if (/<title>\s*Streamlit\s*<\/title>|window\.prerenderReady=!1|You need to enable JavaScript to run this app\./i.test(document.documentElement?.outerHTML || '')) return;
|
||||||
|
|
||||||
if (window.self !== window.top) {
|
if (window.self !== window.top) {
|
||||||
window.addEventListener('message',e=>{if(e.data?.type==='ljq_exec'){try{let r=eval(e.data.code);parent.postMessage({type:'ljq_result',id:e.data.id,result:String(r)},'*')}catch(err){parent.postMessage({type:'ljq_result',id:e.data.id,error:err.message},'*')}}});
|
window.addEventListener('message',e=>{if(e.data?.type==='ljq_exec'){try{let r=eval(e.data.code);parent.postMessage({type:'ljq_result',id:e.data.id,result:String(r)},'*')}catch(err){parent.postMessage({type:'ljq_result',id:e.data.id,error:err.message},'*')}}});
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ if __name__ == '__main__':
|
|||||||
parser.add_argument('--feishu', '--fs', dest='feishu', action='store_true', help='启动 Feishu Bot');
|
parser.add_argument('--feishu', '--fs', dest='feishu', action='store_true', help='启动 Feishu Bot');
|
||||||
parser.add_argument('--wecom', action='store_true', help='启动 WeCom Bot');
|
parser.add_argument('--wecom', action='store_true', help='启动 WeCom Bot');
|
||||||
parser.add_argument('--dingtalk', '--dt', dest='dingtalk', action='store_true', help='启动 DingTalk Bot');
|
parser.add_argument('--dingtalk', '--dt', dest='dingtalk', action='store_true', help='启动 DingTalk Bot');
|
||||||
parser.add_argument('--no-sched', action='store_true', help='不启动计划任务调度器')
|
parser.add_argument('--sched', action='store_true', help='启动计划任务调度器')
|
||||||
parser.add_argument('--llm_no', type=int, default=0, help='LLM编号')
|
parser.add_argument('--llm_no', type=int, default=0, help='LLM编号')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
port = str(find_free_port()) if args.port == '0' else args.port
|
port = str(find_free_port()) if args.port == '0' else args.port
|
||||||
@@ -108,11 +108,11 @@ if __name__ == '__main__':
|
|||||||
print('[Launch] DingTalk Bot started')
|
print('[Launch] DingTalk Bot started')
|
||||||
else: print('[Launch] DingTalk Bot not enabled (use --dingtalk to start)')
|
else: print('[Launch] DingTalk Bot not enabled (use --dingtalk to start)')
|
||||||
|
|
||||||
if not args.no_sched:
|
if args.sched:
|
||||||
scheduler_proc = subprocess.Popen([sys.executable, os.path.join(script_dir, "agentmain.py"), "--reflect", os.path.join(script_dir, "reflect", "scheduler.py"), "--llm_no", str(args.llm_no)], creationflags=subprocess.CREATE_NO_WINDOW if os.name=='nt' else 0)
|
scheduler_proc = subprocess.Popen([sys.executable, os.path.join(script_dir, "agentmain.py"), "--reflect", os.path.join(script_dir, "reflect", "scheduler.py"), "--llm_no", str(args.llm_no)], creationflags=subprocess.CREATE_NO_WINDOW if os.name=='nt' else 0)
|
||||||
atexit.register(scheduler_proc.kill)
|
atexit.register(scheduler_proc.kill)
|
||||||
print('[Launch] Task Scheduler started (duplicate prevented by scheduler port lock)')
|
print('[Launch] Task Scheduler started (duplicate prevented by scheduler port lock)')
|
||||||
else: print('[Launch] Task Scheduler disabled (--no-sched)')
|
else: print('[Launch] Task Scheduler not enabled (--sched)')
|
||||||
|
|
||||||
monitor_thread = threading.Thread(target=idle_monitor, daemon=True)
|
monitor_thread = threading.Thread(target=idle_monitor, daemon=True)
|
||||||
monitor_thread.start()
|
monitor_thread.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user