Update voiceai-server.js

This commit is contained in:
2026-04-13 03:03:20 +00:00
parent e1344c1f60
commit 4e72adf1fd

View File

@@ -7,7 +7,7 @@ app.use(express.json());
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
const AI_NODE = 'http://10.10.0.67:8765'; const AI_NODE = 'http://10.10.0.67:8765';
const AI_KEY = 'b1ca95570932bd14ae75426095f436912bb88e6b217712f0811e6501c68df465'; const AI_KEY = 'b1ca95570932bd14ae75426095f436912bb88e6b217712f0811e6501c68df465';
const AI_MODEL = 'llama3.1:70b'; const AI_MODEL = 'deepseek-r1:latest';
const conversations = {}; const conversations = {};
const PROPS = {'+12133547300':{name:'broadcastbeat',greeting:'Thank you for calling Broadcast Beat. How can I help you today?',system:'You are the AI receptionist for Broadcast Beat. Be professional. Under 40 words.'},'+12134182600':{name:'pinkpulse',greeting:'Hey gorgeous! You have reached The Pink Pulse. How can I help you today?',system:'You are the AI receptionist for The Pink Pulse, an LGBTQ+ publication. Be warm and fabulous. Under 40 words.'},'+12136529233':{name:'avbeat',greeting:'Thank you for calling AV Beat. How can I help you today?',system:'You are the AI receptionist for AV Beat. Be professional. Under 40 words.'},'+12132977880':{name:'onsethost',greeting:'Thank you for calling OnSetHost. How can I help you today?',system:'You are the AI receptionist for OnSetHost, web hosting for production professionals. Under 40 words.'}}; const PROPS = {'+12133547300':{name:'broadcastbeat',greeting:'Thank you for calling Broadcast Beat. How can I help you today?',system:'You are the AI receptionist for Broadcast Beat. Be professional. Under 40 words.'},'+12134182600':{name:'pinkpulse',greeting:'Hey gorgeous! You have reached The Pink Pulse. How can I help you today?',system:'You are the AI receptionist for The Pink Pulse, an LGBTQ+ publication. Be warm and fabulous. Under 40 words.'},'+12136529233':{name:'avbeat',greeting:'Thank you for calling AV Beat. How can I help you today?',system:'You are the AI receptionist for AV Beat. Be professional. Under 40 words.'},'+12132977880':{name:'onsethost',greeting:'Thank you for calling OnSetHost. How can I help you today?',system:'You are the AI receptionist for OnSetHost, web hosting for production professionals. Under 40 words.'}};
async function askAI(prompt) { async function askAI(prompt) {
@@ -15,7 +15,7 @@ async function askAI(prompt) {
const r = await axios.post(AI_NODE+'/queue/add',{prompt,model:AI_MODEL,site:'voiceai',job_type:'text'},{headers:{'x-api-key':AI_KEY},timeout:5000}); const r = await axios.post(AI_NODE+'/queue/add',{prompt,model:AI_MODEL,site:'voiceai',job_type:'text'},{headers:{'x-api-key':AI_KEY},timeout:5000});
const jobId = r.data.job_id; const jobId = r.data.job_id;
console.log('Job submitted:',jobId); console.log('Job submitted:',jobId);
for(let i=0;i<60;i++){ for(let i=0;i<120;i++){
await new Promise(r=>setTimeout(r,500)); await new Promise(r=>setTimeout(r,500));
const j = await axios.get(AI_NODE+'/jobs',{headers:{'x-api-key':AI_KEY},timeout:3000}); const j = await axios.get(AI_NODE+'/jobs',{headers:{'x-api-key':AI_KEY},timeout:3000});
const job = (j.data.jobs||[]).find(x=>x.job_id===jobId); const job = (j.data.jobs||[]).find(x=>x.job_id===jobId);