UNPKG

tina-ai-api

Version:

Biblioteca Node.js para integração com a API Tina AI

2 lines (1 loc) 575 B
(()=>{(()=>{const e="http://108.181.199.60:3000/api/tina";async function n({message:o,userId:r}){if(!o||!r)throw new Error('Par\xE2metros "message" e "userId" s\xE3o obrigat\xF3rios');try{return(await(await fetch(`${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:o,userId:r})})).json()).answer||"Sem resposta"}catch(t){throw console.error("Erro no chat:",t),new Error("Erro ao obter resposta do chat")}}async function a(){throw new Error("imageGen ainda est\xE1 em desenvolvimento")}window.Tina={chat:n,imageGen:a}})();})();