This commit is contained in:
andrew.ng 2026-05-27 14:40:00 +07:00
commit 20bdd3eef0
3 changed files with 11 additions and 7 deletions

View File

@ -620,7 +620,10 @@ export default class LineConnection {
stationId: this.config.stationId,
lineId: this.config.id,
})
const detectLog = await this.detectLogWithAI(this.outputALLScenario)
let detectLog = await this.detectLogWithAI(this.outputALLScenario)
if (typeof detectLog === 'string' && detectLog?.includes('[')) {
detectLog = [...detectLog.matchAll(/"((?:\\.|[^"\\])*)"/g)].map(m => m[1])
}
const result = mapToLineFormat({
lineNumber: this.config.lineNumber,
inventory: this.config.inventory,

View File

@ -29,7 +29,7 @@ type InputData = {
lineNumber: number
inventory: any
latestScenario?: {
detectAI?: DetectAI
detectAI?: string | string[]
}
data?: any[]
}
@ -223,9 +223,10 @@ export function mapToLineFormat(input: InputData) {
// // Mode (DPEL / DPELP)
// const dataPlatform = input.data?.find((el) => el.command?.trim() === 'show platform')
// const mode = dataPlatform && !dataPlatform.output?.includes('Incomplete') ? 'DPELP' : 'DPEL'
const detectAI: string | string[] | undefined = input.latestScenario?.detectAI
// Issues
const issues = Array.isArray(input.latestScenario?.detectAI) ? input.latestScenario?.detectAI : []
const issues = Array.isArray(detectAI) ? detectAI : typeof detectAI === 'string' && detectAI?.includes('[') ? [...detectAI.matchAll(/"((?:\\.|[^"\\])*)"/g)]
.map(m => m[1]) : []
// Issues
const summary = ''

View File

@ -2,6 +2,6 @@
"extends": "@adonisjs/tsconfig/tsconfig.app.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "./build"
}
}
"outDir": "./build",
},
}