forked from React-Group/interstellar_ai
15 lines
495 B
JavaScript
15 lines
495 B
JavaScript
|
import axios from "axios";
|
||
|
|
||
|
onmessage = (e) => {
|
||
|
const { messages = [{ role: "system", content: "You are a helpful assistant" }], ai_model = "phi3.5", access_token } = e.data
|
||
|
|
||
|
axios.post("http://localhost:5000/interstellar/api/ai_send")
|
||
|
.then(response => {
|
||
|
const status = response.data.status
|
||
|
postMessage({status})
|
||
|
})
|
||
|
.catch(error => {
|
||
|
console.log("Error calling API:", error)
|
||
|
postMessage({status:500})
|
||
|
})
|
||
|
}
|