fix: sync/barcode/memory overhaul + detailed logs + preview + result tracking
- Sync: fix GiteaSync constructor + add push()/pull() methods - Barcode: two-tab layout matching GUI (mapping + special rules) - Memory: spec→specification unification, manual add, confidence/price tracking - Processing: TaskLogHandler captures detailed logs (barcode mapping, unit conversion) - Preview: fullscreen dialog for file preview (image/Excel) in Orders/Tables/Images - Detail: per-file log filtering in file pages - Tasks: result files now per-task, add copy path button - Config: reactive edited state + save_config fix - Dashboard: sync task isolation, log limit 10 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+13
-12
@@ -105,23 +105,24 @@ class ConfigManager:
|
||||
|
||||
def save_config(self) -> None:
|
||||
"""保存配置到文件(API 密钥不写入文件)"""
|
||||
try:
|
||||
# 保存前临时清空 API 密钥,避免写入文件
|
||||
saved_keys = {}
|
||||
for option in ('api_key', 'secret_key'):
|
||||
# 保存前临时清空 API 密钥,避免写入文件
|
||||
saved_keys = {}
|
||||
for option in ('api_key', 'secret_key'):
|
||||
try:
|
||||
saved_keys[option] = self.config.get('API', option, fallback='')
|
||||
self.config.set('API', option, '')
|
||||
except Exception:
|
||||
saved_keys[option] = ''
|
||||
self.config.set('API', option, '')
|
||||
|
||||
try:
|
||||
with open(self.config_file, 'w', encoding='utf-8') as f:
|
||||
self.config.write(f)
|
||||
|
||||
# 恢复内存中的值
|
||||
for option, val in saved_keys.items():
|
||||
self.config.set('API', option, val)
|
||||
|
||||
logger.info(f"配置已保存到: {self.config_file}")
|
||||
except Exception as e:
|
||||
logger.error(f"保存配置文件时出错: {e}")
|
||||
finally:
|
||||
# 恢复内存中的值(即使写入失败也恢复)
|
||||
for option, val in saved_keys.items():
|
||||
if val:
|
||||
self.config.set('API', option, val)
|
||||
|
||||
def get(self, section: str, option: str, fallback: Any = None) -> Any:
|
||||
"""获取配置值"""
|
||||
|
||||
Reference in New Issue
Block a user