Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nlux/nlbridge-react

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nlux/nlbridge-react - npm Package Compare versions

Comparing version 0.12.0 to 0.12.1

2

cjs/nlbridge-react.js

@@ -1,1 +0,1 @@

"use strict";var e=require("@nlux/nlbridge"),r=require("react");const t=r=>{const{url:t,dataTransferMode:a}=r||{};if(a&&"stream"!==a&&"fetch"!==a)throw new Error("Data transfer mode not supported");if(!t)throw new Error("Runnable URL is required");let n=e.createAdapter().withUrl(t);return a&&(n=n.withDataTransferMode(a)),n};Object.defineProperty(exports,"createAdapter",{enumerable:!0,get:function(){return e.createAdapter}}),exports.useAdapter=e=>{const[a,n]=r.useState(!1),[o,s]=r.useState(t(e)),{url:u,dataTransferMode:d}=e||{};return r.useEffect((()=>{if(!a)return void n(!0);const r=t(e);s(r)}),[u,d]),o};
"use strict";var e=require("@nlux/nlbridge"),t=require("react");const r=t=>{const{url:r,dataTransferMode:n,contextId:a,taskRunner:o}=t||{};if(n&&"stream"!==n&&"fetch"!==n)throw new Error("Data transfer mode not supported");if(!r)throw new Error("Runnable URL is required");let u=e.createChatAdapter().withUrl(r);return n&&(u=u.withDataTransferMode(n)),a&&(u=u.withContextId(a)),o&&(u=u.withTaskRunner(o)),u},n=e=>{if(e)return(t,r)=>{const n=e.registeredTaskCallbacks[t];if(n)return n(...r)}};Object.defineProperty(exports,"createChatAdapter",{enumerable:!0,get:function(){return e.createChatAdapter}}),Object.defineProperty(exports,"createContextAdapter",{enumerable:!0,get:function(){return e.createContextAdapter}}),exports.useChatAdapter=e=>{const{context:a,url:o,dataTransferMode:u}=e||{},s=a?t.useContext(a.ref):void 0,[d,c]=t.useState(!1),[i,f]=t.useState(r({...e,taskRunner:n(s)}));return t.useEffect((()=>{if(!d)return void c(!0);let e=r({url:o,dataTransferMode:u,contextId:s?.contextId,taskRunner:n(s)});f(e)}),[d,s,u,o]),i};

@@ -1,1 +0,1 @@

import{createAdapter as r}from"@nlux/nlbridge";export{createAdapter}from"@nlux/nlbridge";import{useState as e,useEffect as t}from"react";const o=e=>{const{url:t,dataTransferMode:o}=e||{};if(o&&"stream"!==o&&"fetch"!==o)throw new Error("Data transfer mode not supported");if(!t)throw new Error("Runnable URL is required");let n=r().withUrl(t);return o&&(n=n.withDataTransferMode(o)),n},n=r=>{const[n,a]=e(!1),[d,i]=e(o(r)),{url:f,dataTransferMode:s}=r||{};return t((()=>{if(!n)return void a(!0);const e=o(r);i(e)}),[f,s]),d};export{n as useAdapter};
import{createChatAdapter as r}from"@nlux/nlbridge";export{createChatAdapter,createContextAdapter}from"@nlux/nlbridge";import{useContext as t,useState as e,useEffect as n}from"react";const a=t=>{const{url:e,dataTransferMode:n,contextId:a,taskRunner:o}=t||{};if(n&&"stream"!==n&&"fetch"!==n)throw new Error("Data transfer mode not supported");if(!e)throw new Error("Runnable URL is required");let d=r().withUrl(e);return n&&(d=d.withDataTransferMode(n)),a&&(d=d.withContextId(a)),o&&(d=d.withTaskRunner(o)),d},o=r=>{if(r)return(t,e)=>{const n=r.registeredTaskCallbacks[t];if(n)return n(...e)}},d=r=>{const{context:d,url:s,dataTransferMode:i}=r||{},u=d?t(d.ref):void 0,[f,c]=e(!1),[l,x]=e(a({...r,taskRunner:o(u)}));return n((()=>{if(!f)return void c(!0);let r=a({url:s,dataTransferMode:i,contextId:u?.contextId,taskRunner:o(u)});x(r)}),[f,u,i,s]),l};export{d as useChatAdapter};

@@ -1,6 +0,12 @@

import { NlBridgeAdapterOptions, NlBridgeAdapterBuilder } from '@nlux/nlbridge';
export { Adapter, DataTransferMode, NlBridgeAdapterBuilder, NlBridgeAdapterOptions, StandardAdapter, StreamingAdapterObserver, createAdapter } from '@nlux/nlbridge';
import { ChatAdapterBuilder } from '@nlux/nlbridge';
export { Adapter, ChatAdapterBuilder, ChatAdapterOptions, ContextAdapter, DataTransferMode, StandardAdapter, StreamingAdapterObserver, createChatAdapter, createContextAdapter } from '@nlux/nlbridge';
import { AiContext } from '@nlux/react';
declare const useAdapter: (options: NlBridgeAdapterOptions) => NlBridgeAdapterBuilder;
type ReactChatAdapterOptions = {
url: string;
dataTransferMode?: 'stream' | 'fetch';
context?: AiContext;
};
declare const useChatAdapter: (options: ReactChatAdapterOptions) => ChatAdapterBuilder;
export { useAdapter };
export { type ReactChatAdapterOptions, useChatAdapter };
{
"name": "@nlux/nlbridge-react",
"version": "0.12.0",
"version": "0.12.1",
"description": "The nlbridge adapters for nlux React, the React JS library for building conversational AI interfaces.",

@@ -59,6 +59,6 @@ "keywords": [

"dependencies": {
"@nlux/nlbridge": "0.12.0"
"@nlux/nlbridge": "0.12.1"
},
"peerDependencies": {
"@nlux/react": "0.12.0",
"@nlux/react": "0.12.1",
"react": "^18.2.0"

@@ -65,0 +65,0 @@ },

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@nlux/nlbridge"),require("react")):"function"==typeof define&&define.amd?define(["exports","@nlux/nlbridge","react"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["@nlux/nlbridge-react"]={},e.nlbridge,e.react)}(this,(function(e,r,t){"use strict";const n=e=>{const{url:t,dataTransferMode:n}=e||{};if(n&&"stream"!==n&&"fetch"!==n)throw new Error("Data transfer mode not supported");if(!t)throw new Error("Runnable URL is required");let a=r.createAdapter().withUrl(t);return n&&(a=a.withDataTransferMode(n)),a};Object.defineProperty(e,"createAdapter",{enumerable:!0,get:function(){return r.createAdapter}}),e.useAdapter=e=>{const[r,a]=t.useState(!1),[o,i]=t.useState(n(e)),{url:d,dataTransferMode:u}=e||{};return t.useEffect((()=>{if(!r)return void a(!0);const t=n(e);i(t)}),[d,u]),o}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@nlux/nlbridge"),require("react")):"function"==typeof define&&define.amd?define(["exports","@nlux/nlbridge","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@nlux/nlbridge-react"]={},e.nlbridge,e.react)}(this,(function(e,t,r){"use strict";const n=e=>{const{url:r,dataTransferMode:n,contextId:a,taskRunner:o}=e||{};if(n&&"stream"!==n&&"fetch"!==n)throw new Error("Data transfer mode not supported");if(!r)throw new Error("Runnable URL is required");let d=t.createChatAdapter().withUrl(r);return n&&(d=d.withDataTransferMode(n)),a&&(d=d.withContextId(a)),o&&(d=d.withTaskRunner(o)),d},a=e=>{if(e)return(t,r)=>{const n=e.registeredTaskCallbacks[t];if(n)return n(...r)}};Object.defineProperty(e,"createChatAdapter",{enumerable:!0,get:function(){return t.createChatAdapter}}),Object.defineProperty(e,"createContextAdapter",{enumerable:!0,get:function(){return t.createContextAdapter}}),e.useChatAdapter=e=>{const{context:t,url:o,dataTransferMode:d}=e||{},u=t?r.useContext(t.ref):void 0,[i,s]=r.useState(!1),[f,c]=r.useState(n({...e,taskRunner:a(u)}));return r.useEffect((()=>{if(!i)return void s(!0);let e=n({url:o,dataTransferMode:d,contextId:u?.contextId,taskRunner:a(u)});c(e)}),[i,u,d,o]),f}}));
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc