Skip to content

Commit 4ea9d77

Browse files
fdelbrayelleFrançois Delbrayelle
andauthored
fix(ai_copilot): retrieve more ERROR lines (#14961)
Co-authored-by: François Delbrayelle <fdelbrayelle@kestra.io>
1 parent 57eea63 commit 4ea9d77

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ui/src/components/executions/TaskRunLine.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,13 @@
378378
const attemptNumber = this.selectedAttemptNumberByTaskRunId[taskRun.id] ?? 0;
379379
const attemptUid = this.attemptUid(taskRun.id, attemptNumber);
380380
const logs = this.logsWithIndexByAttemptUid[attemptUid] ?? [];
381-
const errorLine = (() => {
382-
const lastError = [...logs].reverse().find(l => (l.level || "").toString().toUpperCase() === "ERROR");
383-
if (lastError?.message) return lastError.message;
381+
const errorLines = (() => {
382+
const errors = logs.filter(l => (l.level || "").toString().toUpperCase() === "ERROR" && (l.message ?? "").length > 0);
383+
if (errors.length > 0) return errors.map(l => l.message).join("\n");
384384
const last = [...logs].reverse().find(l => (l.message ?? "").length > 0);
385385
return last?.message ?? "";
386386
})();
387-
const prompt = `Fix the task ${taskRun.taskId} as it generated the following error:\n${errorLine}`;
387+
const prompt = `Fix the task ${taskRun.taskId} as it generated the following error:\n${errorLines}`;
388388
try {
389389
window.sessionStorage.setItem("kestra-ai-prompt", prompt);
390390
} catch (err) {

0 commit comments

Comments
 (0)