Skip to content

Commit 177753f

Browse files
Merge pull request #293 from SmythOS/feat/update-form-and-voice-embodiment
Enhance form preview and voice modules
2 parents 76e42c6 + 8c7dc39 commit 177753f

File tree

5 files changed

+56
-14
lines changed

5 files changed

+56
-14
lines changed

packages/runtime/src/modules/embodiment/modules/formPreview/routes/router.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@ router.get('/', async (req, res) => {
1818
<!doctype html>
1919
<html lang="en" style="height: 100%;margin: 0;padding: 0;">
2020
<head>
21-
<meta charset="UTF-8" />
22-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
23-
<title>${agent.name}</title>
21+
<meta charset="UTF-8" />
22+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
23+
<link rel="icon" type="image/png" href="/static/img/icon.svg" />
24+
<title>${agent.name}</title>
2425
</head>
2526
<body style="height: 100%;margin: 0;padding: 0;">
26-
<div id="form-preview-container" style="height: 100%;"></div>
27-
<script src="/static/embodiment/formPreview/form-preview-minified.js"></script>
28-
<script>
29-
FormPreview.init({
30-
domain:'${req.hostname}',
31-
containerId: 'form-preview-container',
32-
widget: false,
33-
});
34-
</script>
27+
<div id="form-preview-container" style="height: 100%;"></div>
28+
<script src="/static/embodiment/formPreview/form-preview-minified.js"></script>
29+
<script>
30+
FormPreview.init({
31+
domain:'${req.hostname}?endpointId=${req?.query?.endpointId || ''}',
32+
containerId: 'form-preview-container',
33+
widget: false,
34+
});
35+
</script>
3536
</body>
3637
</html>`);
3738
});
@@ -45,6 +46,7 @@ router.get('/params', async (req, res) => {
4546

4647
const isLocalAgent = req.hostname.includes('localagent');
4748
const agentId = agent?.id;
49+
const outputPreview = agent.agentSettings?.embodiments?.get('form')?.outputPreview || false;
4850

4951
const port = isLocalAgent ? config.env.AGENT_DOMAIN_PORT : undefined;
5052
const agentData = {
@@ -53,6 +55,7 @@ router.get('/params', async (req, res) => {
5355
components: agent.components,
5456
domain: agent?.domain,
5557
port,
58+
outputPreview,
5659
};
5760

5861
res.send(agentData);

packages/runtime/src/modules/embodiment/modules/voice/routes/router.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ router.post('/ephemeral-key', async (req, res) => {
8989

9090
if (!response.ok) {
9191
const error = await response.text();
92+
if (error.includes('invalid_api_key')) {
93+
return res.status(response.status).json({ error: `Incorrect API key provided` });
94+
}
9295
return res.status(response.status).json({ error: `Failed to create ephemeral key: ${error}` });
9396
}
9497

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const OPENAI_REALTIME_MODEL = 'gpt-4o-realtime-preview-2025-06-03';
1+
export const OPENAI_REALTIME_MODEL = 'gpt-realtime';
22

33
export const VOICE = 'alloy';

packages/runtime/static/embodiment/formPreview/form-preview-minified.js

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/runtime/static/embodiment/voice/voice-embodiment-minified.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)