mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-03 22:34:11 +02:00
fix: parse OpenAI responses for triage
This commit is contained in:
8
.github/workflows/ai-triage.yml
vendored
8
.github/workflows/ai-triage.yml
vendored
@@ -83,6 +83,7 @@ jobs:
|
|||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
const text = data.output_text
|
const text = data.output_text
|
||||||
|
|| data.output?.map(p => p.content?.map(c => c.text ?? '').join('')).join('\n')
|
||||||
|| data?.choices?.[0]?.message?.content
|
|| data?.choices?.[0]?.message?.content
|
||||||
|| 'Thanks for opening this issue — we will take a look!';
|
|| 'Thanks for opening this issue — we will take a look!';
|
||||||
|
|
||||||
@@ -161,7 +162,12 @@ jobs:
|
|||||||
core.setFailed(`OpenAI error ${res.status}: ${txt}`);
|
core.setFailed(`OpenAI error ${res.status}: ${txt}`);
|
||||||
} else {
|
} else {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
const patch = (data.output_text || data?.choices?.[0]?.message?.content || '').trim();
|
const patch = (
|
||||||
|
data.output_text
|
||||||
|
|| data.output?.map(p => p.content?.map(c => c.text ?? '').join('')).join('\n')
|
||||||
|
|| data?.choices?.[0]?.message?.content
|
||||||
|
|| ''
|
||||||
|
).trim();
|
||||||
return patch;
|
return patch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user