Last active
June 28, 2023 05:03
-
-
Save mpmisko/bc77a469ab777ba7794e3b51e90894fd to your computer and use it in GitHub Desktop.
Client for MediSearch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const io = require(‘socket.io-client’); | |
| const readline = require(‘readline’); | |
| const rl = readline.createInterface({ | |
| input: process.stdin, | |
| output: process.stdout | |
| }); | |
| rl.question(‘What question would you like to ask? ’, (answer) => { | |
| const socket = io(‘http://104.154.109.122:80’); | |
| const conversation = { | |
| conversation: [answer], | |
| key: ‘66d6a250-a64b-4bee-9232-c9dcf63f4a1e’ | |
| }; | |
| socket.on(‘articles’, (data) => { | |
| console.log(‘articles’); | |
| console.log(data); | |
| }); | |
| socket.on(‘llm_response’, (data) => { | |
| console.log(‘llm_response’); | |
| console.log(data); | |
| }); | |
| socket.on(‘error_unauthorized’, (data) => { | |
| console.log(‘error_unauthorized’); | |
| console.log(data); | |
| }); | |
| socket.on(‘error_internal’, (data) => { | |
| console.log(‘internal error’); | |
| console.log(data); | |
| }); | |
| socket.on(‘error_llm’, (data) => { | |
| console.log(‘error_llm’); | |
| console.log(data); | |
| }); | |
| socket.emit(‘api_message’, JSON.stringify(conversation)); | |
| setTimeout(() => { | |
| socket.close(); | |
| }, 100000); | |
| rl.close(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment