Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
柴进
/
GoogleNanoBananaApp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4dae7c18
authored
2026-01-15 10:40:40 +0800
by
柴进
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
极速模式支持多张图协同出图,移除单张限制
1 parent
3c58ff8e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
task_queue.py
task_queue.py
View file @
4dae7c1
...
...
@@ -114,17 +114,48 @@ class TaskQueueManager(QObject):
self
.
logger
.
info
(
"TaskQueueManager 初始化完成"
)
def
_load_db_config
(
self
):
"""加载数据库配置"""
"""加载数据库配置
(与 image_generator.py 相同的多路径逻辑)
"""
try
:
import
json
import
sys
import
os
import
platform
from
pathlib
import
Path
config_file
=
Path
(
"config.json"
)
config_paths
=
[]
# 1. 用户配置目录(打包后优先)
if
getattr
(
sys
,
'frozen'
,
False
):
system
=
platform
.
system
()
if
system
==
'Darwin'
:
user_config
=
Path
.
home
()
/
'Library'
/
'Application Support'
/
'ZB100ImageGenerator'
/
'config.json'
elif
system
==
'Windows'
:
user_config
=
Path
(
os
.
getenv
(
'APPDATA'
,
Path
.
home
()))
/
'ZB100ImageGenerator'
/
'config.json'
else
:
user_config
=
Path
.
home
()
/
'.config'
/
'zb100imagegenerator'
/
'config.json'
config_paths
.
append
(
user_config
)
# 2. 可执行文件所在目录
config_paths
.
append
(
Path
(
sys
.
executable
)
.
parent
/
'config.json'
)
# 3. PyInstaller _MEIPASS 目录
if
hasattr
(
sys
,
'_MEIPASS'
):
config_paths
.
append
(
Path
(
sys
.
_MEIPASS
)
/
'config.json'
)
# 4. 当前工作目录(开发模式)
config_paths
.
append
(
Path
(
'config.json'
))
# 尝试所有路径
for
config_file
in
config_paths
:
if
config_file
.
exists
():
with
open
(
config_file
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
config
=
json
.
load
(
f
)
self
.
_db_config
=
config
.
get
(
'db_config'
)
if
self
.
_db_config
:
self
.
logger
.
info
(
"数据库配置已加载"
)
self
.
logger
.
info
(
f
"数据库配置已加载: {config_file}"
)
return
self
.
logger
.
warning
(
"未找到 config.json,日志记录将被禁用"
)
except
Exception
as
e
:
self
.
logger
.
warning
(
f
"加载数据库配置失败: {e}"
)
...
...
Please
register
or
sign in
to post a comment