Skip to content

Commit

Permalink
fix: typo in prompt and response message
Browse files Browse the repository at this point in the history
  • Loading branch information
dzehnder committed Dec 7, 2023
1 parent f1fb19f commit 09b4baf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/firefall/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ async function getPrompt(log, placeholders) {
}

function getEmojiForChange(before, after) {
if (after > before) return ':warning:'; // Emoji for increase
if (after < before) return ':large_green_circle:'; // Emoji for decrease
if (after < before) return ':warning:'; // Emoji for increase
if (after > before) return ':large_green_circle:'; // Emoji for decrease
return ':heavy_minus_sign:'; // Emoji for no change
}

Expand Down Expand Up @@ -115,12 +115,10 @@ export async function recommendations(message, context) {
});

const responseData = await response.json();
log.info('Recommendations:', responseData.generations[0][0].text);
const recommendationData = responseData.generations[0][0].text;
log.info('Recommendations:', recommendationData);

const data = JSON.parse(responseData.generations[0][0].text);
const recommendationMessage = `Insights and Recommendations for ${url}:\n`;

log.info('Recommendation Message:', recommendationMessage);

const blocks = [
{
Expand Down Expand Up @@ -168,7 +166,7 @@ export async function recommendations(message, context) {
channel: 'C060T2PPF8V',
});

return new Response(recommendationMessage);
return new Response(recommendationData);
} catch (error) {
throw new Error('Error getting recommendations from Firefall API');
}
Expand Down
4 changes: 2 additions & 2 deletions static/prompts/firefall.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Example of Expected Insights and Recommendations:
insights: [
{
insight: "The addition of large, unoptimized images in the recent code update directly contributed to a 15% increase in load time, as reflected in the reduced Lighthouse 'speed-index' score.",
reccomendation: "Optimize image sizes and implement lazy loading to improve load times and recover Lighthouse performance scores.",
recommendation: "Optimize image sizes and implement lazy loading to improve load times and recover Lighthouse performance scores.",
},
{
insight: "The addition a third-party api is adding to the 'total-blocking-time' and decreasing the overall 'performance' score as a result.",
reccomendation: "Do not load the third-party api until absolutely required; Either by using an intersection observer to load it only once it reaches the viewport, or by delaying it's loading until the user interacts with that element."
recommendation: "Do not load the third-party api until absolutely required; Either by using an intersection observer to load it only once it reaches the viewport, or by delaying it's loading until the user interacts with that element."
},
]
}

0 comments on commit 09b4baf

Please sign in to comment.