-
Notifications
You must be signed in to change notification settings - Fork 0
Pr request #518
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
Closed
Closed
Pr request #518
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
ad0554c
Adding readme.md
gowthamkishore3 00435f4
Adding changes
gowthamkishore3 5e16ec1
Addig changes
gowthamkishore3 8c0f749
Updating changes
gowthamkishore3 0f17baa
Adding changes
gowthamkishore3 73f8c44
Adding changes
gowthamkishore3 835d4dc
Adding changes
gowthamkishore3 6bab880
Adding changes
gowthamkishore3 65ee31e
Adding chages
gowthamkishore3 39a7dd4
Adding chanes
gowthamkishore3 5207dd2
adding changes
gowthamkishore3 c11782d
adding changes
gowthamkishore3 2ff04fb
Adding changes
gowthamkishore3 717af8d
Adding urls
gowthamkishore3 560ab30
adding changes
gowthamkishore3 c312a69
Adding changes
gowthamkishore3 ed53803
Adding hnges
gowthamkishore3 e3f5c08
adding changes
gowthamkishore3 30de397
Adding changes;
gowthamkishore3 ded46f5
Updating
gowthamkishore3 8698896
Adding changes
gowthamkishore3 1013f38
Adding changes
gowthamkishore3 b2c0c96
Adding changes
gowthamkishore3 1885f4e
Adding changes
gowthamkishore3 53068f6
Adding changes
gowthamkishore3 04bc9e4
Ading changes
gowthamkishore3 b8eb414
Adding changes
gowthamkishore3 d9731ba
Adding changes
gowthamkishore3 1014ede
Adding changes
gowthamkishore3 205a73a
Adding changes;
gowthamkishore3 71cb433
Adding changes
gowthamkishore3 a84a628
Adding changes
gowthamkishore3 8566bf1
adding changes
gowthamkishore3 7dc48fc
Adding changes
gowthamkishore3 c5326eb
Adding code
gowthamkishore3 d65d968
ADdign changes
gowthamkishore3 b374c3c
Adding changes
gowthamkishore3 f2c2390
Adding cabges
gowthamkishore3 010a61f
Adding changes
gowthamkishore3 1860956
Adding changes
gowthamkishore3 8db4b75
Adding changes
gowthamkishore3 614d412
Adding cahnges
gowthamkishore3 fe0b1c8
Adding changes
gowthamkishore3 4afb097
aDding changes
gowthamkishore3 fa45fac
Resolving issue
gowthamkishore3 869a128
Adding cghanges
gowthamkishore3 93975eb
Adding chngaes
gowthamkishore3 b86b315
Addig hanges
gowthamkishore3 f7c2ffd
Adding changes
gowthamkishore3 e7d4e6b
Adding chaneges
gowthamkishore3 2d43529
Adding changes
gowthamkishore3 69d4c6f
Adding chanes
gowthamkishore3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import 'dotenv/config'; | ||
| import express from 'express'; | ||
| import cors from 'cors'; | ||
| import multer from 'multer'; | ||
| import fs from 'fs/promises'; | ||
| import path from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
|
|
||
| import { analyzeTrack } from './realtime.js'; | ||
|
|
||
| const app = express(); | ||
| const upload = multer({ dest: 'uploads/', limits: { fileSize: 10 * 1024 * 1024 } }); | ||
|
|
||
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
|
|
||
| const PORT = process.env.PORT || 3001; | ||
| const CLIENT_ORIGIN = process.env.CLIENT_ORIGIN || 'http://localhost:5173'; | ||
|
Comment on lines
+18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Rename constants to camelCase to meet style guideline. Project guidance requires camelCase variable names. Please rename -const PORT = process.env.PORT || 3001;
-const CLIENT_ORIGIN = process.env.CLIENT_ORIGIN || 'http://localhost:5173';
+const port = process.env.PORT || 3001;
+const clientOrigin = process.env.CLIENT_ORIGIN || 'http://localhost:5173';
-app.use(cors({ origin: CLIENT_ORIGIN }));
+app.use(cors({ origin: clientOrigin }));
-app.listen(PORT, () => {
- console.log(`Server listening on http://localhost:${PORT}`);
+app.listen(port, () => {
+ console.log(`Server listening on http://localhost:${port}`);
});🤖 Prompt for AI Agents |
||
|
|
||
| await fs.mkdir('uploads', { recursive: true }); | ||
|
|
||
|
|
||
| app.use(cors({ origin: CLIENT_ORIGIN })); | ||
| app.use(express.json()); | ||
|
|
||
| app.get('/health', (_req, res) => { | ||
| res.json({ status: 'ok' }); | ||
| }); | ||
|
|
||
| app.post('/api/analyze', upload.single('track'), async (req, res) => { | ||
| if (!req.file) { | ||
| return res.status(400).json({ error: 'Missing track upload' }); | ||
| } | ||
|
|
||
| const task = req.body.task || 'analysis'; | ||
| const lyricContext = req.body.lyricContext || ''; | ||
|
|
||
|
|
||
| const filePath = path.join(__dirname, '..', req.file.path); | ||
|
|
||
| try { | ||
| const audioBuffer = await fs.readFile(filePath); | ||
|
|
||
| const result = await analyzeTrack({ | ||
| task, | ||
| audioBuffer, | ||
| lyricContext, | ||
| }); | ||
|
|
||
| res.json(result); | ||
| } catch (error) { | ||
| console.error('Realtime analysis failed', error); | ||
| res.status(500).json({ | ||
| error: 'Failed to process track with OpenAI Realtime API', | ||
| details: error?.message ?? 'Unknown error', | ||
| }); | ||
| } finally { | ||
| await fs.unlink(filePath).catch(() => {}); | ||
| } | ||
| }); | ||
|
|
||
| app.listen(PORT, () => { | ||
| console.log(`Server listening on http://localhost:${PORT}`); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| Hi | ||
|
|
||
|
|
||
| asd |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Restore valid Zod builders for new fields.
The new schema uses
z.datesdsd,z.urlsdsd,z.strinsdsg, andUserSchemassss, none of which exist on the Zod API. This will throw at runtime and break type inference. Revert to the correct builders and reference the actual schema symbol.📝 Committable suggestion
🤖 Prompt for AI Agents