1.0.20 • Published 10 months ago

@edvisory/okmd-ai-widget v1.0.20

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

OKMD AI Widget

A React widget component that provides AI chat functionality with OKMD's AI service.

Features

  • AI Chat interface with floating button and expandable chat box
  • Real-time message streaming
  • Message history and conversation starters
  • File attachments support
  • Citations and references
  • Character limit warnings
  • Usage quota management
  • Like/Dislike feedback system
  • Responsive design

Installation

Requirements

This package has the following peer dependencies:

  • React ^18.3.1
  • React DOM ^18.3.1
  • @tanstack/react-query ^5.59.16
  • @hookform/resolvers ^3.10.0
  • antd ^5.21.6
  • axios ^1.7.7

Environment Configuration

Configure the environment variables in src/constants/env.ts:

VariableDescriptionRequired
NEXT_PUBLIC_APP_URLBase URL of your applicationYes
NEXT_PUBLIC_API_ENDPOINTAPI endpoint for OKMD AI serviceYes

Example configuration:

These environment variables are used for:

  • Authentication endpoints
  • API communication
  • Login redirects

Usage

  1. Import the widget:
  2. Add the widget to your React application:

Props

PropTypeRequiredDescription
apiKeystringYesAPI key for authentication with OKMD AI service
onLogin() => voidNoCallback function when login is required
onChatChange(chats: ChatSessionChatMessageType[]) => voidNoCallback function when chat messages change
onClose() => voidNoCallback function when chat box is closed
onOpen() => voidNoCallback function when chat box is opened

Example usage in react project

import React from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; // required for react-query
import { OkmdAiWidget } from "okmd-ai-widget"; // import widget
import "@edvisory/okmd-ai-widget/dist/esm/index.css"; // import styles

const queryClient = new QueryClient({
  defaultOptions: {
    // your default options
  },
});

const App = () => {
  return (
    <QueryClientProvider client={queryClient}>
      <OkmdAiWidget apiKey="your-api-key" />
    </QueryClientProvider>
  );
};

Example usage in nextjs project

import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; // required for react-query
import "@edvisory/okmd-ai-widget/dist/esm/index.css"; // import styles

const OkmdAiWidget = dynamic(
  () => import("@edvisory/okmd-ai-widget").then((mod) => mod.OkmdAiWidget),
  { ssr: false }
);

const queryClient = new QueryClient({
  defaultOptions: {
    // your default options
  },
});

const App = () => {
  return (
    <QueryClientProvider client={queryClient}>
      <OkmdAiWidget apiKey="your-api-key" />
    </QueryClientProvider>
  );
};

Features

Chat Interface

  • Floating button with "Ask OKMD AI" text
  • Expandable chat box
  • Real-time message streaming
  • Support for markdown formatting in responses

Conversation Management

  • Pre-defined conversation starters
  • Support for regenerating responses
  • Feedback system (like/dislike)

User Experience

  • Character limit warnings
  • Usage quota management
  • Loading states
  • Error handling
  • Responsive design for mobile and desktop

Publish to NPM

  1. Patch version
npm version patch
  1. Publish to NPM
npm publish

or

npm publish --access public

License

This project is proprietary software owned by Edvisory.

Support

For support, please contact the development team at Edvisory.

1.0.20

10 months ago

1.0.19

10 months ago

1.0.18-1

10 months ago

1.0.18

10 months ago

1.0.17-21

10 months ago

1.0.17-20

10 months ago

1.0.17-19

10 months ago

1.0.17-18

10 months ago

1.0.17-17

10 months ago

1.0.17-16

10 months ago

1.0.17-15

10 months ago

1.0.17-14

10 months ago

1.0.17-13

10 months ago

1.0.17-12

10 months ago

1.0.17-11

10 months ago

1.0.17-10

10 months ago

1.0.17-9

10 months ago

1.0.17-8

10 months ago

1.0.17-7

10 months ago

1.0.17-6

10 months ago

1.0.17-5

10 months ago

1.0.17-4

10 months ago

1.0.17-3

10 months ago

1.0.17-2

10 months ago

1.0.17-1

10 months ago

1.0.16-12

10 months ago

1.0.17

10 months ago

1.0.16-11

10 months ago

1.0.16-10

10 months ago

1.0.16-9

10 months ago

1.0.16-8

10 months ago

1.0.16-6

10 months ago

1.0.16-5

10 months ago

1.0.16-4

10 months ago

1.0.16-3

10 months ago

1.0.16-2

10 months ago

1.0.16-1

10 months ago

1.0.13

10 months ago

1.0.16

10 months ago

1.0.15

10 months ago

1.0.14

10 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago