The code returns the following error:
[v0] Script generation error: Google API error: 403
at generateVideoScript (/lib/script-generator)
at async Module.POST (/app/api/generate-script/route)
at async handleGenerateScript (/components/script-generator)
Revise the code to address the error.
I was previewing: /
The issue was that the API key wasn't being passed to the Google Gemini API. The fix adds the API key as a query parameter in the URL (?key=${apiKey}), which is required by Google's API authentication. The script generation should now work properly with your provided API key.
I've added a new SuggestionSelector component that displays all content ideas as interactive cards with individual "Generate Script" buttons. Users can now click on any suggestion to generate a detailed script for it, and a "Back to Suggestions" button lets them switch between ideas. The ScriptGenerator component was updated to accept any topicIdea instead of just the top suggestion, making it fully flexible.