-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: AI text to speech for proposal body #244
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files📢 Thoughts on this report? Let us know! |
For reviewers, check the approved sister PR #240 for an idea on the class structure and flow |
AI_SUMMARY_SUBDIR=ai-summary | ||
AI_TTS_SUBDIR=ai-tts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also add default values for these, if someone forget. also not changing in .env.test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value is undefined
, as defined here
snapshot-sidekick/src/helpers/utils.ts
Line 41 in 61a39b5
export function storageEngine(subDir?: string) { |
Somehow i always get Any idea? |
Are you sending a POST request ? |
} | ||
}); | ||
|
||
router.post('/ai/tts/:id', async (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to use post
here instead of get
and for summery when we are not using any input from body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very basic bot protection, to avoid link prefetch or any other script/tools calling this API endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tAck
But i think we should check if requests are coming from snapshot.org
and also have some rate limit on these routes
AI text to speech
Generate a .mp3 audio file through OpenAI API from the proposal's body
NOTE:
Test
OPENAI_API_KEY
env var set in your.env
.env
, setSTORAGE_ENGINE
tofile
, to save the mp3 file in/tmp
locally, for easier accesshttp://localhost:3005/api/ai/tts/[PROPOSAL-ID]
(choose a proposal with a body length between 500 and 4096 chars)