Skip to content

Commit

Permalink
Display AI tips in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Dec 31, 2024
1 parent 6b8eeb8 commit fa58a0a
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/common/utils/deployTipJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,25 @@ export async function analyzeDeployErrorLogsJson(resultJson: any, log: string, i
const detailedErrorLines: string[] = [];
for (const error of errors) {
detailedErrorLines.push(...["", c.red(c.bold(error.messageInitialDisplay)), ""]);
if (error.tips.length > 0 && error.tips.some(err => err.tip)) {
if (error.tips.length > 0 && error.tips.some(err => err.tip || err.tipFromAi)) {
for (const errorTip of error.tips) {
detailedErrorLines.push(...[
c.yellow(c.italic("Error " + c.bold(errorTip.tip.label)) + ":"),
c.yellow(errorTip.tip.messageConsole),
c.yellow(`Documentation: ${errorTip.tip.docUrl}`)
])
if (errorTip.tip) {
detailedErrorLines.push(...[
c.yellow(c.italic("Error " + c.bold(errorTip.tip.label)) + ":"),
c.yellow(errorTip.tip.messageConsole),
c.yellow(`Documentation: ${errorTip.tip.docUrl}`)
])
}
if (errorTip.tipFromAi) {
detailedErrorLines.push(...[
c.yellow(c.italic("🤖 AI response:")),
c.yellow(errorTip.tipFromAi.promptResponse)
])
}
}
}
else {
detailedErrorLines.push(...["No tip found for error. Try asking ChatGPT, Google or a Release Manager :)"])
detailedErrorLines.push(...[c.yellow("No tip found for error. Try asking ChatGPT, Google or a Release Manager :)")])
}
}
detailedErrorLines.push("");
Expand Down

0 comments on commit fa58a0a

Please sign in to comment.