feat(extraction): read headless mode from config instead of hardcoding
Add headless field to extraction config schema (default: true). Extractor handler now reads globalConfig.extraction.headless instead of hardcoding true. Users can set headless: false in config.yaml to show the browser window during extraction for debugging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,7 @@ extraction:
|
|||||||
autoConvert: true
|
autoConvert: true
|
||||||
mergeBatches: true
|
mergeBatches: true
|
||||||
enableDbPersistence: true
|
enableDbPersistence: true
|
||||||
|
headless: true # 浏览器无头模式,true=后台运行,false=显示浏览器窗口(调试用)
|
||||||
|
|
||||||
validation:
|
validation:
|
||||||
dataSource: database_full
|
dataSource: database_full
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ export function registerExtractorHandlers(): void {
|
|||||||
log.info('Fetching ERP configuration from database...')
|
log.info('Fetching ERP configuration from database...')
|
||||||
const erpConfig = await getErpConfig()
|
const erpConfig = await getErpConfig()
|
||||||
|
|
||||||
|
// Read headless setting from global config
|
||||||
|
const configManager = ConfigManager.getInstance()
|
||||||
|
const globalConfig = configManager.getConfig()
|
||||||
|
|
||||||
log.info('ERP config retrieved', {
|
log.info('ERP config retrieved', {
|
||||||
url: erpConfig.url ? 'configured' : 'EMPTY',
|
url: erpConfig.url ? 'configured' : 'EMPTY',
|
||||||
username: erpConfig.username ? 'configured' : 'EMPTY'
|
username: erpConfig.username ? 'configured' : 'EMPTY'
|
||||||
@@ -188,7 +192,7 @@ export function registerExtractorHandlers(): void {
|
|||||||
url: erpConfig.url,
|
url: erpConfig.url,
|
||||||
username: erpConfig.username,
|
username: erpConfig.username,
|
||||||
password: erpConfig.password,
|
password: erpConfig.password,
|
||||||
headless: true
|
headless: globalConfig.extraction.headless
|
||||||
})
|
})
|
||||||
|
|
||||||
sendProgress(sender, '登录 ERP 系统...', 9.99, {
|
sendProgress(sender, '登录 ERP 系统...', 9.99, {
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ const DEFAULT_CONFIG: FullConfig = {
|
|||||||
verbose: true,
|
verbose: true,
|
||||||
autoConvert: true,
|
autoConvert: true,
|
||||||
mergeBatches: true,
|
mergeBatches: true,
|
||||||
enableDbPersistence: true
|
enableDbPersistence: true,
|
||||||
|
headless: true
|
||||||
},
|
},
|
||||||
validation: {
|
validation: {
|
||||||
dataSource: 'database_full',
|
dataSource: 'database_full',
|
||||||
|
|||||||
@@ -83,7 +83,8 @@ export const extractionConfigSchema = z.object({
|
|||||||
verbose: z.boolean().default(true),
|
verbose: z.boolean().default(true),
|
||||||
autoConvert: z.boolean().default(true),
|
autoConvert: z.boolean().default(true),
|
||||||
mergeBatches: z.boolean().default(true),
|
mergeBatches: z.boolean().default(true),
|
||||||
enableDbPersistence: z.boolean().default(true)
|
enableDbPersistence: z.boolean().default(true),
|
||||||
|
headless: z.boolean().default(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user