Job Application

Please fill out the form below

Clear
// streamer.js const axios = require('axios'); const { Readable } = require('stream'); const apiKey = '<7fad01db-54e5-40bf-bba4-d9074c3f4fef>'; const chatId = ''; const apiUrl = 'https://www.chatbase.co/api/v1/chat'; const messages = [ { content: '', role: 'user' } ]; const authorizationHeader = `Bearer ${apiKey}`; async function readChatbotReply() { try { const response = await axios.post(apiUrl, { messages, chatId, stream: true, temperature: 0 }, { headers: { Authorization: authorizationHeader, 'Content-Type': 'application/json' }, responseType: 'stream' }); const readable = new Readable({ read() {} }); response.data.on('data', (chunk) => { readable.push(chunk); }); response.data.on('end', () => { readable.push(null); }); const decoder = new TextDecoder(); let done = false; readable.on('data', (chunk) => { const chunkValue = decoder.decode(chunk); // Process the chunkValue as desired // Here we just output it as in comes in without \n process.stdout.write(chunkValue); }); readable.on('end', () => { done = true; }); } catch (error) { console.log('Error:', error.message); } } readChatbotReply();

Contact Us

(512) 351-4080

info@clouddentalaustin.com

Privacy Policy | Terms and Conditions
‍© Cloud Dental Austin 2023

HOURS:

M-F 8am-5pm
Weekends CLOSED

9070 Research Blvd, Austin, TX 78758, USA

Address: 9070 Research Blvd Ste 205

Austin, TX 78758

Copyright by Cloud Dental 2022. All rights reserved.