AI Extensions: Migrate duck-facts beta extension#17605
Conversation
|
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 |
There was a problem hiding this comment.
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.mdneeds the{PR_MERGE_DATE}template string added to "[AI Extensions]" - The
launchCommandin/extensions/duck-facts/src/index.tsxshould be wrapped in a try-catch block for error handling - The error handling in
showToastcould be simplified usingshowFailureToastfrom@raycast/utils - The
metadatafolder with screenshots is missing but required since there's aviewcommand inpackage.json - The List component should use
isLoadingprop to avoid empty state flicker
5 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile
| console.error("Error:", error); | ||
| showToast(Toast.Style.Failure, "An error occurred"); |
There was a problem hiding this comment.
style: Could be simplified with showFailureToast from @raycast/utils
| console.error("Error:", error); | |
| showToast(Toast.Style.Failure, "An error occurred"); | |
| console.error("Error:", error); | |
| showFailureToast("An error occurred"); |
extensions/duck-facts/CHANGELOG.md
Outdated
| @@ -1,3 +1,5 @@ | |||
| # Duck Facts Changelog | |||
|
|
|||
| ## [AI Extensions] - 2024-12-09 | |||
There was a problem hiding this comment.
syntax: The changelog entry title must end with {PR_MERGE_DATE} instead of a hardcoded date
| ## [AI Extensions] - 2024-12-09 | |
| ## [AI Extensions] {PR_MERGE_DATE} |
extensions/duck-facts/CHANGELOG.md
Outdated
| ## [AI Extensions] - 2024-12-09 | ||
|
|
There was a problem hiding this comment.
style: Add a description of the changes made in this AI Extensions update
| export default async function generateFact(input: Input) { | ||
| const prompt = buildPrompt(input); | ||
| const response = await AI.ask(prompt); | ||
| return { fact: response }; | ||
| } |
There was a problem hiding this comment.
logic: AI.ask() should be wrapped in try/catch to handle potential API errors gracefully
| 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]; |
There was a problem hiding this comment.
logic: No validation if input.length is an invalid value - could cause undefined lengthGuide
fc929ab to
63e50bb
Compare
|
Published to the Raycast Store: |
|
🎉 🎉 🎉 We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag. |

Description
Screencast
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare located outside the metadata folder if they were not generated with our metadata tool