main
Backend Deploy 🚀 / build-and-deploy (push) Has been cancelled

This commit is contained in:
Harun CAN
2026-05-11 07:32:58 +02:00
parent 58832e99d1
commit 2e6c272eee
17 changed files with 1260 additions and 400 deletions
+37
View File
@@ -0,0 +1,37 @@
const axios = require('axios');
const http = require('http');
async function test() {
console.log('Sending POST /generate...');
const res = await axios.post('http://localhost:17493/generate', {
profile_id: 'b8d26247-c8bc-4c06-9364-5b09d11de4bf',
text: 'Hello world again',
language: 'en',
engine: 'kokoro'
});
const genId = res.data.id;
console.log('Generation ID:', genId);
console.log('Polling status...');
return new Promise((resolve, reject) => {
http.get(`http://localhost:17493/generate/${genId}/status`, (response) => {
response.on('data', (chunk) => {
const lines = chunk.toString().split('\n');
for (const line of lines) {
if (line.startsWith('data: ')) {
const data = JSON.parse(line.substring(6));
console.log('Status update:', data);
if (data.status === 'completed') {
console.log('Finished!');
resolve(data);
} else if (data.status === 'failed') {
console.log('Failed:', data.error);
reject(new Error(data.error));
}
}
}
});
});
});
}
test().catch(console.error);