Skip to content

AI Extensions: Migrate duck-facts beta extension#17605

Merged
KELiON merged 2 commits intomainfrom
migrate/duck-facts
Mar 13, 2025
Merged

AI Extensions: Migrate duck-facts beta extension#17605
KELiON merged 2 commits intomainfrom
migrate/duck-facts

Conversation

@KELiON
Copy link
Contributor

@KELiON KELiON commented Mar 6, 2025

Description

Screencast

Checklist

@KELiON KELiON requested a review from pernielsentikaer as a code owner March 6, 2025 12:48
@raycastbot
Copy link
Collaborator

raycastbot commented Mar 6, 2025

Thank you for your contribution! 🎉

🔔 @validatedev @pernielsentikaer you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

Due to our current reduced availability, the initial review may take up to 10-15 business days

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: duck-facts Issues related to the duck-facts extension labels Mar 6, 2025
@validatedev
Copy link
Contributor

image

Thanks for migrating that one 🥰🦆

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR migrates the Duck Facts extension to use GPT-4o-mini and adds comprehensive AI tooling with extensive test cases for generating duck-related facts.

  • The new changelog entry in /extensions/duck-facts/CHANGELOG.md needs the {PR_MERGE_DATE} template string added to "[AI Extensions]"
  • The launchCommand in /extensions/duck-facts/src/index.tsx should be wrapped in a try-catch block for error handling
  • The error handling in showToast could be simplified using showFailureToast from @raycast/utils
  • The metadata folder with screenshots is missing but required since there's a view command in package.json
  • The List component should use isLoading prop to avoid empty state flicker

5 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +44 to +45
console.error("Error:", error);
showToast(Toast.Style.Failure, "An error occurred");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Could be simplified with showFailureToast from @raycast/utils

Suggested change
console.error("Error:", error);
showToast(Toast.Style.Failure, "An error occurred");
console.error("Error:", error);
showFailureToast("An error occurred");

@@ -1,3 +1,5 @@
# Duck Facts Changelog

## [AI Extensions] - 2024-12-09
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: The changelog entry title must end with {PR_MERGE_DATE} instead of a hardcoded date

Suggested change
## [AI Extensions] - 2024-12-09
## [AI Extensions] {PR_MERGE_DATE}

Comment on lines +3 to +4
## [AI Extensions] - 2024-12-09

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Add a description of the changes made in this AI Extensions update

Comment on lines +64 to +68
export default async function generateFact(input: Input) {
const prompt = buildPrompt(input);
const response = await AI.ask(prompt);
return { fact: response };
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: AI.ask() should be wrapped in try/catch to handle potential API errors gracefully

Suggested change
export default async function generateFact(input: Input) {
const prompt = buildPrompt(input);
const response = await AI.ask(prompt);
return { fact: response };
}
export default async function generateFact(input: Input) {
const prompt = buildPrompt(input);
try {
const response = await AI.ask(prompt);
return { fact: response };
} catch (error) {
throw new Error(`Failed to generate duck fact: ${error.message}`);
}
}

: "Generate an interesting and educational fact about ducks";

const aspectClause = input.aspect ? `, focusing on their ${input.aspect}` : "";
const lengthGuide = LENGTH_GUIDES[input.length || DEFAULT_LENGTH];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: No validation if input.length is an invalid value - could cause undefined lengthGuide

@KELiON KELiON force-pushed the migrate/duck-facts branch from fc929ab to 63e50bb Compare March 13, 2025 16:50
@KELiON KELiON merged commit 49fb5dd into main Mar 13, 2025
9 checks passed
@KELiON KELiON deleted the migrate/duck-facts branch March 13, 2025 16:55
@github-actions
Copy link
Contributor

Published to the Raycast Store:
https://raycast.com/validate/duck-facts

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Extension extension: duck-facts Issues related to the duck-facts extension extension fix / improvement Label for PRs with extension's fix improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants