diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 33258ab..52354a1 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -931,6 +931,11 @@ export default class LineConnection { }, ], } + console.log(`${promptRecord.content} + + Return ONLY a valid JSON array of strings. + Here is the log: + ${log}`) const remoteUrl = process.env.ERP_URL_AUTH || 'https://stage.nswteam.net' const remoteResp = await axios.post( remoteUrl + '/api/transferPostData', @@ -1994,7 +1999,7 @@ Ports Missing/Down: ${missing.length}\n\n` const skipReason = this.config.reasonSkipPhysical || snapshot?.reason || '' const isSkipped = typeof skipReason === 'string' && skipReason.trim().length > 0 - const aiIssue = issues.length > 0 ? issues.join('\n') : '' + const aiIssue = issues.length > 0 && Array.isArray(issues) ? issues.join('\n') : '' let summaryStatus = 'PASS' const match = aiIssue.match(/RESULT:\s*(PASS WITH WARNING|PASS|FAIL|INSUFFICIENT DATA)/im) if (match) { diff --git a/BACKEND/app/ultils/helper.ts b/BACKEND/app/ultils/helper.ts index 6298985..f3b414d 100644 --- a/BACKEND/app/ultils/helper.ts +++ b/BACKEND/app/ultils/helper.ts @@ -687,9 +687,8 @@ export async function updateNoteToERP(sn: string, note: string) { // urlAPI: '/api/stock-model-serial/get-list-for-test-log', // filter: { // where: { - // _q: 'FOC1425Z3RN', + // _q: sn, // }, - // orgId: ['5fadc798f070e4b64b53ac9c', '5fadc7b0f070e4b64b53ac9d'], // }, // }, // { @@ -705,8 +704,7 @@ export async function updateNoteToERP(sn: string, note: string) { where: { _q: sn, }, - }, - orgId: ['5fadc798f070e4b64b53ac9c', '5fadc7b0f070e4b64b53ac9d'], + } }, headers: header, } @@ -735,6 +733,12 @@ export async function updateNoteToERP(sn: string, note: string) { await axios.post(remoteUrl + '/api/stock-model-serial/data-save-for-test-log', payload, { headers: header, }) + // await axios.post("https://stage.nswteam.net/api/transferPostData", { + // urlAPI: '/api/stock-model-serial/data-save-for-test-log', + // data: payload + // }, { + // headers: header, + // }) } catch (error) { console.log('updateNoteToERP', error) } diff --git a/BACKEND/providers/socket_io_provider.ts b/BACKEND/providers/socket_io_provider.ts index aef7d6c..2467f0d 100644 --- a/BACKEND/providers/socket_io_provider.ts +++ b/BACKEND/providers/socket_io_provider.ts @@ -53,22 +53,22 @@ type StationAction = ( export default class SocketIoProvider { private static _io: CustomServer - constructor(protected app: ApplicationService) {} + constructor(protected app: ApplicationService) { } /** * Register bindings to the container */ - register() {} + register() { } /** * The container bindings have booted */ - async boot() {} + async boot() { } /** * The application has been booted */ - async start() {} + async start() { } /** * The process has been started @@ -83,7 +83,7 @@ export default class SocketIoProvider { /** * Preparing to shutdown the app */ - async shutdown() {} + async shutdown() { } public static get io() { return this._io @@ -100,7 +100,7 @@ export class WebSocketIo { lineConnecting: number[] = [] // key = lineId intervalKeepConnect: { [key: string]: NodeJS.Timeout } = {} - constructor(protected app: ApplicationService) {} + constructor(protected app: ApplicationService) { } async boot() { const SOCKET_IO_PORT = env.get('SOCKET_PORT') || 8989 diff --git a/FRONTEND/src/components/CardLine.tsx b/FRONTEND/src/components/CardLine.tsx index 5b8ef47..8f22663 100644 --- a/FRONTEND/src/components/CardLine.tsx +++ b/FRONTEND/src/components/CardLine.tsx @@ -155,7 +155,7 @@ const CardLine = ({ }, [line?.latestScenario]); function detectResultStatus(lines: string[]) { - if (!lines || lines.length === 0) return null; + if (!lines || lines.length === 0 || typeof lines === "string") return null; const text = lines.join("\n"); const match = text.match(