Sergei 6d017ea617 WellNuo Lite Robert - Julia Robust Agent (no barge-in)
Changes:
- Updated livekitService.ts to use remote token server
- Julia-robust agent with disabled interruptions
- Added discard_audio_if_uninterruptible=True
- Added min_interruption_duration=2.0
- Token server configured for julia-robust agent
2026-01-24 15:22:21 -08:00

69 lines
1.8 KiB
JavaScript

const express = require('express');
const cors = require('cors');
const { AccessToken } = require('livekit-server-sdk');
require('dotenv').config();
const app = express();
app.use(cors());
app.use(express.json());
const LIVEKIT_API_KEY = process.env.LIVEKIT_API_KEY || 'APIEivUcPW3WSrV';
const LIVEKIT_API_SECRET = process.env.LIVEKIT_API_SECRET || 'A65mc5KUKE0VGdZNaMRwe6uJpA9ZQPAxS66akZTOfmL';
const LIVEKIT_URL = 'wss://live-kit-demo-70txlh6a.livekit.cloud';
// ROBUST MODE: Use julia-robust agent (no barge-in)
const AGENT_NAME = 'julia-robust';
// Health check
app.get('/health', (req, res) => {
res.json({ status: 'ok', agent: AGENT_NAME, url: LIVEKIT_URL });
});
// Generate LiveKit token
app.post('/token', async (req, res) => {
try {
const { userId } = req.body;
const identity = userId || `user-${Date.now()}`;
const roomName = `julia-room-${Date.now()}`;
const token = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET, {
identity: identity,
ttl: 3600, // 1 hour
});
token.addGrant({
room: roomName,
roomJoin: true,
canPublish: true,
canSubscribe: true,
canPublishData: true,
});
// Request Julia AI agent to join the room
token.roomConfig = {
agents: [{ agentName: AGENT_NAME }],
};
const jwt = await token.toJwt();
res.json({
success: true,
data: {
token: jwt,
roomName: roomName,
wsUrl: LIVEKIT_URL,
identity: identity,
},
});
} catch (error) {
console.error('Token generation error:', error);
res.status(500).json({ success: false, error: error.message });
}
});
const PORT = process.env.PORT || 3001;
app.listen(PORT, () => {
console.log(`Julia Token Server running on port ${PORT}`);
console.log(`LiveKit URL: ${LIVEKIT_URL}`);
console.log(`Agent: ${AGENT_NAME}`);
});