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

@nlux/react

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nlux/react - npm Package Compare versions

Comparing version 2.2.11-beta to 2.2.12-beta

56

nlux-react.d.ts
import { useEffect, JSX, RefObject, FC, ReactElement, ComponentClass, ReactNode, Context } from 'react';
import { MessageOptions as MessageOptions$2, StandardChatAdapter as StandardChatAdapter$1, EventsConfig as EventsConfig$1, DisplayOptions as DisplayOptions$1, ConversationOptions as ConversationOptions$1, ComposerOptions as ComposerOptions$1, ContextItems, AiContext as AiContext$1, ContextItemDataType, ContextAdapter, ContextAdapterBuilder } from '@nlux/core';
export { AiChatPropsInEvents, ComposerOptions, ConversationLayout, ConversationOptions, DisplayOptions, ErrorCallback, ErrorEventDetails, EventCallback, EventName, EventsConfig, HighlighterExtension, HistoryPayloadSize, MessageReceivedCallback, MessageReceivedEventDetails, MessageRenderedCallback, MessageRenderedEventDetails, MessageSentCallback, MessageSentEventDetails, MessageStreamStartedCallback, MessageStreamStartedEventDetails, PreDestroyCallback, PreDestroyEventDetails, ReadyCallback, ReadyEventDetails, UpdatableAiChatProps } from '@nlux/core';
export { AiChatPropsInEvents, ComposerOptions, ConversationLayout, ConversationOptions, DisplayOptions, ErrorCallback, ErrorEventDetails, EventCallback, EventName, EventsConfig, HighlighterExtension, HistoryPayloadSize, MessageReceivedCallback, MessageReceivedEventDetails, MessageRenderedCallback, MessageRenderedEventDetails, MessageSentCallback, MessageSentEventDetails, MessageStreamStartedCallback, MessageStreamStartedEventDetails, PreDestroyCallback, PreDestroyEventDetails, ReadyCallback, ReadyEventDetails, SanitizerExtension, UpdatableAiChatProps } from '@nlux/core';

@@ -40,9 +40,9 @@ type UseEffectParams = Parameters<typeof useEffect>;

*/
interface StandardChatAdapter<AiMsg> {
interface StandardChatAdapter<AiMsg = string> {
get dataTransferMode(): DataTransferMode;
fetchText(message: string, extras: ChatAdapterExtras<AiMsg>): Promise<string | object | undefined>;
batchText(message: string, extras: ChatAdapterExtras<AiMsg>): Promise<string | object | undefined>;
get id(): string;
get info(): StandardAdapterInfo;
preProcessAiStreamedChunk(chunk: string | object | undefined, extras: ChatAdapterExtras<AiMsg>): AiMsg | undefined;
preProcessAiUnifiedMessage(message: string | object | undefined, extras: ChatAdapterExtras<AiMsg>): AiMsg | undefined;
preProcessAiBatchedMessage(message: string | object | undefined, extras: ChatAdapterExtras<AiMsg>): AiMsg | undefined;
streamText(message: string, observer: StreamingAdapterObserver<string | object | undefined>, extras: ChatAdapterExtras<AiMsg>): void;

@@ -128,2 +128,4 @@ }

type SanitizerExtension = (html: string) => string;
/**

@@ -152,7 +154,7 @@ * Props for the custom function that renders a message sent by the server in streaming mode.

/**
* Props for the custom function that renders a message sent by the server in fetch mode.
* Props for the custom function that renders a message sent by the server in batch mode.
* @template AiMsg The type of the message received from the AI. Defaults to string for standard NLUX adapters.
*
* @property {string} uid The unique identifier of the message.
* @property {'fetch'} dataTransferMode The data transfer mode used by the adapter.
* @property {'batch'} dataTransferMode The data transfer mode used by the adapter.
* @property {'complete'} status The status of the message.

@@ -164,5 +166,5 @@ *

*/
type FetchResponseComponentProps$1<AiMsg> = {
type BatchResponseComponentProps$1<AiMsg> = {
uid: string;
dataTransferMode: 'fetch';
dataTransferMode: 'batch';
status: 'complete';

@@ -172,3 +174,3 @@ content: AiMsg;

};
type ResponseRenderer$1<AiMsg> = ((props: StreamResponseComponentProps$1<AiMsg>) => HTMLElement | null) | ((props: FetchResponseComponentProps$1<AiMsg>) => HTMLElement | null);
type ResponseRenderer$1<AiMsg> = ((props: StreamResponseComponentProps$1<AiMsg>) => HTMLElement | null) | ((props: BatchResponseComponentProps$1<AiMsg>) => HTMLElement | null);
type PromptRendererProps$1 = {

@@ -185,2 +187,10 @@ uid: string;

/**
* Custom function to sanitize the HTML content of the messages. This function is called before any HTML content
* is rendered in the chat.
*
* @param {string} html
* @returns {string}
*/
htmlSanitizer?: SanitizerExtension;
/**
* Indicates the target of the links in the markdown messages.

@@ -299,3 +309,3 @@ * - 'blank': Open links in a new tab.

*/
type AiChatPropsInEvents<AiMsg> = Omit<AiChatProps$1<AiMsg>, 'adapter' | 'events'>;
type AiChatPropsInEvents<AiMsg = string> = Omit<AiChatProps$1<AiMsg>, 'adapter' | 'events'>;

@@ -388,3 +398,3 @@ type MessageSentEventDetails = {

*/
type ChatAdapterExtras<AiMsg> = {
type ChatAdapterExtras<AiMsg = string> = {
/**

@@ -414,6 +424,6 @@ * This attribute contains the properties used with the AiChat component.

*/
type DataTransferMode = 'stream' | 'fetch';
type DataTransferMode = 'stream' | 'batch';
/**
* This interface exposes methods that should be implemented by any chat adapter to connect the AiChat component
* to any API or AI backend. Chat adapters can be used to request data from the API in fetch mode or stream mode.
* to any API or AI backend. Chat adapters can be used to request data from the API in batch mode or stream mode.
*

@@ -424,5 +434,5 @@ * The difference between this and the `AssistAdapter` interface is that this adapter can only return a text response

*/
interface ChatAdapter<AiMsg> {
interface ChatAdapter<AiMsg = string> {
/**
* This method should be implemented by any adapter that wants to request data from the API in fetch mode.
* This method should be implemented by any adapter that wants to request data from the API in batch mode.
* It should return a promise that resolves to the response from the API.

@@ -435,6 +445,6 @@ * Either this method or `streamText` (or both) should be implemented by any adapter.

*/
fetchText?: (message: string, extras: ChatAdapterExtras<AiMsg>) => Promise<AiMsg>;
batchText?: (message: string, extras: ChatAdapterExtras<AiMsg>) => Promise<AiMsg>;
/**
* This method should be implemented by any adapter to be used with nlux.
* Either this method or `fetchText` (or both) should be implemented by any adapter.
* Either this method or `batchText` (or both) should be implemented by any adapter.
*

@@ -516,7 +526,7 @@ * @param {string} message

/**
* Props for the custom React component that renders a message sent by the server in fetch mode.
* Props for the custom React component that renders a message sent by the server in batch mode.
* @template AiMsg The type of the message received from the AI. Defaults to string for standard NLUX adapters.
*
* @property {string} uid The unique identifier of the message.
* @property {'fetch'} dataTransferMode The data transfer mode used by the adapter.
* @property {'batch'} dataTransferMode The data transfer mode used by the adapter.
* @property {'complete'} status The status of the message.

@@ -528,5 +538,5 @@ *

*/
type FetchResponseComponentProps<AiMsg> = {
type BatchResponseComponentProps<AiMsg> = {
uid: string;
dataTransferMode: 'fetch';
dataTransferMode: 'batch';
status: 'complete';

@@ -536,3 +546,3 @@ content: AiMsg;

};
type ResponseRenderer<AiMsg> = FC<StreamResponseComponentProps<AiMsg>> | FC<FetchResponseComponentProps<AiMsg>>;
type ResponseRenderer<AiMsg> = FC<StreamResponseComponentProps<AiMsg>> | FC<BatchResponseComponentProps<AiMsg>>;
type PromptRendererProps = {

@@ -721,2 +731,2 @@ uid: string;

export { AiChat, type AiChatProps, type AiContext, type AiContextProviderProps, type BotPersona, type ChatAdapter, type ChatAdapterBuilder, type ChatAdapterExtras, type ChatItem, type DataTransferMode, type DiscardContextItem, type FetchResponseComponentProps, type MessageOptions, type PersonaOptions, type PromptRenderer, type PromptRendererProps, type ResponseRenderer, type StandardAdapterInfo, type StandardChatAdapter, type StreamResponseComponentProps, type StreamingAdapterObserver, type UpdateContextItem, type UserPersona, createAiContext, useAiContext, useAiTask, useDeepCompareEffect };
export { AiChat, type AiChatProps, type AiContext, type AiContextProviderProps, type BatchResponseComponentProps, type BotPersona, type ChatAdapter, type ChatAdapterBuilder, type ChatAdapterExtras, type ChatItem, type DataTransferMode, type DiscardContextItem, type MessageOptions, type PersonaOptions, type PromptRenderer, type PromptRendererProps, type ResponseRenderer, type StandardAdapterInfo, type StandardChatAdapter, type StreamResponseComponentProps, type StreamingAdapterObserver, type UpdateContextItem, type UserPersona, createAiContext, useAiContext, useAiTask, useDeepCompareEffect };
{
"name": "@nlux/react",
"version": "2.2.11-beta",
"version": "2.2.12-beta",
"description": "nlux React is a library for building conversational AI interfaces, with support for OpenAI, HuggingFace, and more.",

@@ -62,3 +62,3 @@ "keywords": [

"dependencies": {
"@nlux/core": "2.2.11-beta"
"@nlux/core": "2.2.12-beta"
},

@@ -65,0 +65,0 @@ "peerDependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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