ci(issue-triage): correct Responses parsing (use first message/output_text); robust JSON extract (no push)

This commit is contained in:
James Peter
2025-09-06 00:52:42 +10:00
parent 118c4581a8
commit b5eaecf417
+11 -1
View File
@@ -224,7 +224,17 @@ jobs:
const data = await res.json();
let json = {};
try {
json = JSON.parse(data.choices[0].message.content || '{}');
// Responses API: find first 'message' item and extract output_text
let txt = '';
if (Array.isArray(data.output)) {
const msg = data.output.find(o => o && o.type === 'message');
if (msg && Array.isArray(msg.content)) {
const c = msg.content.find(p => p && (p.type === 'output_text' || p.type === 'text'));
if (c && typeof c.text === 'string') txt = c.text;
}
}
if (!txt && typeof data.output_text === 'string') txt = data.output_text;
json = JSON.parse(txt || '{}');
} catch (e) {
json = {};
}