@foundationui/react-hooks
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,1 +0,1 @@ | ||
"use strict";var t=require("react");exports.useFoundationModel=function(e){var o=e.dev?"http://localhost:7777/platform":"https://api.foundation-ui.com/platform",n=t.useMemo((function(){return function(t){if(e.fetchModelOutput)return e.fetchModelOutput(t);var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"POST",mode:"cors",headers:n,body:JSON.stringify({model:e.model,user:e.user,safeMode:e.safeMode,input:t})}).then((function(t){return 200!==t.status&&console.error("Error getting completion"),t.json()})).catch((function(t){return console.error(t),null}))}}),[e.model,e.user,e.dev,e.safeMode,e.getJWT,e.fetchModelOutput]),r=t.useMemo((function(){return function(t){if(e.markOutput)return e.markOutput(t,{seen:!0});var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"PUT",mode:"cors",headers:n,body:JSON.stringify({outputSid:t,seen:!0})}).then((function(t){200!==t.status&&console.error("Couldn't update completion to seen")})).catch((function(t){return console.error(t)}))}}),[o,e.markOutput,e.getJWT]),u=t.useMemo((function(){return function(t){if(e.markOutput)return e.markOutput(t,{accepted:!0});var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"PUT",mode:"cors",headers:n,body:JSON.stringify({outputSid:t,accepted:!0})}).then((function(t){200!==t.status&&console.error("Couldn't update completion to accepted")})).catch((function(t){return console.error(t)}))}}),[o,e.markOutput,e.getJWT]);return{model:e.model,user:e.user,getCompletion:n,markCompletionSeen:r,markCompletionAccepted:u}}; | ||
"use strict";var t=require("react");exports.useFoundationModel=function(e){var o=e.dev?"http://localhost:7777/v0":"https://api.foundation-ui.com/v0",n=t.useMemo((function(){return function(t){if(e.fetchModelOutput)return e.fetchModelOutput(t);var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"POST",mode:"cors",headers:n,body:JSON.stringify({model:e.model,user:e.user,safeMode:e.safeMode,input:t})}).then((function(t){return 200!==t.status&&console.error("Error getting completion"),t.json()})).catch((function(t){return console.error(t),null}))}}),[e.model,e.user,e.dev,e.safeMode,e.getJWT,e.fetchModelOutput]),r=t.useMemo((function(){return function(t){if(e.markOutput)return e.markOutput(t,{seen:!0});var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"PUT",mode:"cors",headers:n,body:JSON.stringify({outputSid:t,seen:!0})}).then((function(t){200!==t.status&&console.error("Couldn't update completion to seen")})).catch((function(t){return console.error(t)}))}}),[o,e.markOutput,e.getJWT]),u=t.useMemo((function(){return function(t){if(e.markOutput)return e.markOutput(t,{accepted:!0});var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"PUT",mode:"cors",headers:n,body:JSON.stringify({outputSid:t,accepted:!0})}).then((function(t){200!==t.status&&console.error("Couldn't update completion to accepted")})).catch((function(t){return console.error(t)}))}}),[o,e.markOutput,e.getJWT]);return{model:e.model,user:e.user,getCompletion:n,markCompletionSeen:r,markCompletionAccepted:u}}; |
@@ -1,1 +0,1 @@ | ||
import t from"react";function e(e){var o=e.dev?"http://localhost:7777/platform":"https://api.foundation-ui.com/platform",n=t.useMemo((function(){return function(t){if(e.fetchModelOutput)return e.fetchModelOutput(t);var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"POST",mode:"cors",headers:n,body:JSON.stringify({model:e.model,user:e.user,safeMode:e.safeMode,input:t})}).then((function(t){return 200!==t.status&&console.error("Error getting completion"),t.json()})).catch((function(t){return console.error(t),null}))}}),[e.model,e.user,e.dev,e.safeMode,e.getJWT,e.fetchModelOutput]),r=t.useMemo((function(){return function(t){if(e.markOutput)return e.markOutput(t,{seen:!0});var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"PUT",mode:"cors",headers:n,body:JSON.stringify({outputSid:t,seen:!0})}).then((function(t){200!==t.status&&console.error("Couldn't update completion to seen")})).catch((function(t){return console.error(t)}))}}),[o,e.markOutput,e.getJWT]),u=t.useMemo((function(){return function(t){if(e.markOutput)return e.markOutput(t,{accepted:!0});var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"PUT",mode:"cors",headers:n,body:JSON.stringify({outputSid:t,accepted:!0})}).then((function(t){200!==t.status&&console.error("Couldn't update completion to accepted")})).catch((function(t){return console.error(t)}))}}),[o,e.markOutput,e.getJWT]);return{model:e.model,user:e.user,getCompletion:n,markCompletionSeen:r,markCompletionAccepted:u}}export{e as useFoundationModel}; | ||
import t from"react";function e(e){var o=e.dev?"http://localhost:7777/v0":"https://api.foundation-ui.com/v0",n=t.useMemo((function(){return function(t){if(e.fetchModelOutput)return e.fetchModelOutput(t);var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"POST",mode:"cors",headers:n,body:JSON.stringify({model:e.model,user:e.user,safeMode:e.safeMode,input:t})}).then((function(t){return 200!==t.status&&console.error("Error getting completion"),t.json()})).catch((function(t){return console.error(t),null}))}}),[e.model,e.user,e.dev,e.safeMode,e.getJWT,e.fetchModelOutput]),r=t.useMemo((function(){return function(t){if(e.markOutput)return e.markOutput(t,{seen:!0});var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"PUT",mode:"cors",headers:n,body:JSON.stringify({outputSid:t,seen:!0})}).then((function(t){200!==t.status&&console.error("Couldn't update completion to seen")})).catch((function(t){return console.error(t)}))}}),[o,e.markOutput,e.getJWT]),u=t.useMemo((function(){return function(t){if(e.markOutput)return e.markOutput(t,{accepted:!0});var n={"Content-Type":"application/json"};return e.getJWT&&(n.Authorization="Bearer ".concat(e.getJWT())),fetch("".concat(o,"/model"),{method:"PUT",mode:"cors",headers:n,body:JSON.stringify({outputSid:t,accepted:!0})}).then((function(t){200!==t.status&&console.error("Couldn't update completion to accepted")})).catch((function(t){return console.error(t)}))}}),[o,e.markOutput,e.getJWT]);return{model:e.model,user:e.user,getCompletion:n,markCompletionSeen:r,markCompletionAccepted:u}}export{e as useFoundationModel}; |
{ | ||
"name": "@foundationui/react-hooks", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Use a foundation model in your app. It gets smarter the more your users use it.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
27867