neoagent 2.4.1-beta.13 → 2.4.1-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/flutter_app/android/app/src/main/AndroidManifest.xml +2 -1
- package/flutter_app/lib/main_chat.dart +88 -0
- package/flutter_app/lib/main_controller.dart +12 -0
- package/flutter_app/lib/main_integrations.dart +3 -1
- package/flutter_app/lib/src/backend_client.dart +11 -0
- package/package.json +1 -1
- package/server/public/.last_build_id +1 -1
- package/server/public/assets/fonts/MaterialIcons-Regular.otf +0 -0
- package/server/public/flutter_bootstrap.js +1 -1
- package/server/public/main.dart.js +48513 -48367
- package/server/routes/voice_assistant.js +36 -1
|
@@ -4,7 +4,8 @@ const { requireAuth } = require('../middleware/auth');
|
|
|
4
4
|
const { sanitizeError } = require('../utils/security');
|
|
5
5
|
const { getAgentIdFromRequest, resolveAgentId } = require('../services/agents/manager');
|
|
6
6
|
const { TurnCoordinator } = require('../services/voice/turnCoordinator');
|
|
7
|
-
const { normalizeVoiceSynthesisOptions } = require('../services/voice/providers');
|
|
7
|
+
const { normalizeVoiceSynthesisOptions, transcribeVoiceInput } = require('../services/voice/providers');
|
|
8
|
+
const { writeTempAudioFile, removeTempFile } = require('../services/voice/liveAudio');
|
|
8
9
|
const { runVoiceTranscriptTurn } = require('../services/voice/turnRunner');
|
|
9
10
|
|
|
10
11
|
const router = express.Router();
|
|
@@ -135,4 +136,38 @@ router.post('/respond', async (req, res) => {
|
|
|
135
136
|
}
|
|
136
137
|
});
|
|
137
138
|
|
|
139
|
+
router.post('/transcribe', async (req, res) => {
|
|
140
|
+
try {
|
|
141
|
+
const audioBase64 = String(req.body?.audioBase64 || '').trim();
|
|
142
|
+
const mimeType = String(req.body?.mimeType || 'audio/pcm;rate=16000;channels=1').trim();
|
|
143
|
+
|
|
144
|
+
if (!audioBase64) {
|
|
145
|
+
return res.status(400).json({ error: 'audioBase64 is required.' });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const approxBytes = (audioBase64.length * 3) / 4;
|
|
149
|
+
if (approxBytes > 25 * 1024 * 1024) {
|
|
150
|
+
return res.status(400).json({ error: 'Audio exceeds maximum size of 25MB.' });
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const audioBytes = Buffer.from(audioBase64, 'base64');
|
|
154
|
+
const { filePath, mimeType: fileMimeType } = await writeTempAudioFile(audioBytes, mimeType);
|
|
155
|
+
let transcript = '';
|
|
156
|
+
try {
|
|
157
|
+
transcript = await transcribeVoiceInput(filePath, {
|
|
158
|
+
mimeType: fileMimeType,
|
|
159
|
+
userId: req.session.userId,
|
|
160
|
+
timeoutMs: 30000,
|
|
161
|
+
});
|
|
162
|
+
} finally {
|
|
163
|
+
await removeTempFile(filePath);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return res.json({ transcript: String(transcript || '').trim() });
|
|
167
|
+
} catch (err) {
|
|
168
|
+
const message = sanitizeError(err);
|
|
169
|
+
return res.status(500).json({ error: message });
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
138
173
|
module.exports = router;
|