mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 10:21:02 +01: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 text = data.output_text
|
||||
|| data.output?.map(p => p.content?.map(c => c.text ?? '').join('')).join('\n')
|
||||
|| data?.choices?.[0]?.message?.content
|
||||
|| 'Thanks for opening this issue — we will take a look!';
|
||||
|
||||
@@ -161,7 +162,12 @@ jobs:
|
||||
core.setFailed(`OpenAI error ${res.status}: ${txt}`);
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user