新增内容,新增拉起软件层

This commit is contained in:
super
2026-06-08 09:19:15 +08:00
parent 8ab647c419
commit c85e5b278f
67 changed files with 1552 additions and 189 deletions

View File

@@ -419,6 +419,74 @@ class WindowAPI:
except Exception as e:
return {'success': False, 'error': str(e)}
def launch_yaoayanui(self):
candidates = []
env_path = os.getenv('YAOAYANUI_EXE', '').strip()
if env_path:
candidates.append(env_path)
candidates.extend([
os.path.join(BASE_DIR, 'resources', 'yaoayanui', 'tauri-app.exe'),
os.path.abspath(os.path.join(
BASE_DIR,
'..',
'..',
'yaoyaoAI',
'yaoayanui',
'src-tauri',
'target',
'release',
'tauri-app.exe',
)),
os.path.abspath(os.path.join(
BASE_DIR,
'..',
'..',
'yaoyaoAI',
'yaoayanui',
'src-tauri',
'target',
'release',
'bundle',
'nsis',
'aiclient_0.1.15_x64-setup.exe',
)),
])
exe_path = ''
for candidate in candidates:
if candidate and os.path.isfile(candidate):
exe_path = os.path.abspath(candidate)
break
if not exe_path:
return {
'success': False,
'error': '未找到 yaoayanui 可执行文件,请设置 YAOAYANUI_EXE',
}
try:
if sys.platform.startswith('win'):
subprocess.Popen(
[exe_path],
cwd=os.path.dirname(exe_path),
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
creationflags=subprocess.DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP,
)
else:
subprocess.Popen(
[exe_path],
cwd=os.path.dirname(exe_path),
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
return {'success': True, 'path': exe_path}
except Exception as e:
return {'success': False, 'error': str(e)}
def enqueue_json(self, data):
"""保存任务到队列"""
try:
@@ -538,7 +606,7 @@ def main():
api = WindowAPI(window)
window.expose(api.close, api.minimize, api.maximize, api.toggle_maximize, generate_images, api.save_image, api.save_image_to_folder, api.select_folder, api.select_brand_xlsx_files, api.select_brand_folder,
api.save_file_from_url, api.save_template_xlsx,api.save_template_zip,api.upload_file_to_java,api.open_external_url,api.enqueue_json,api.get_detail_del,api.save_file_from_url_new,api.save_file_from_url_with_progress,api.get_device_id)
api.save_file_from_url, api.save_template_xlsx,api.save_template_zip,api.upload_file_to_java,api.open_external_url,api.launch_yaoayanui,api.enqueue_json,api.get_detail_del,api.save_file_from_url_new,api.save_file_from_url_with_progress,api.get_device_id)
webview.start(
debug=True,
storage_path=cache_path,