Giter Site home page Giter Site logo

openassistantgpt / chatbot-sdk Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 5.0 2.36 MB

A SDK for building and deploying your own chatbot using NextJS and Vercel. Created by OpenAssistantGPT

Home Page: https://sdk.openassistantgpt.io

License: Apache License 2.0

JavaScript 3.23% TypeScript 95.01% CSS 1.76%
ai ai-sdk assistant-api chatbot openai openai-api sdk chatbot-framework chatbots chatgpt chatgpt-api chatgpt-ui

chatbot-sdk's Introduction

hero illustration

OpenAssistantGPT SDK

This SDK is an extension of the vercel/ai SDK with more features, addapted to our use case and maintained by the OpenAssistantGPT team. If you want more information about OpenAssistantGPT you can find it here.

We also provide our chatbot with our hosted version, with adavanced analytics, crawling for custom content and advanced security.

Deploy example

Deploy our basic example using Vercel:

Deploy with Vercel

For more information about the example give a look at this README.md.

All examples

Installation

You will need Node.js 18+ and pnpm install on your local development machine.

npm install openassistantgpt

Usage

@openassistantgpt/assistant

First you need to import our library and configure the POST and GET method. This will setup the backend correctly.

npm install @openassistantgpt/assistant

Then you have to setup you environment variables by creating your .env file

OPENAI_API_KEY=xxxxxxx
OPENAI_ASSISTANT_ID=xxxxxx

Once the package is installed and your environment variables are configured create the route file /api/chat/[[...openassistantgpt]]/route.ts

import { OpenAssistantGPT } from '@openassistantgpt/assistant';

// In OpenAssistantGPT handler you must enter your base path.
// The base path is everything before the [[...openassistantgpt]] part of the route.
const httpHandler = new OpenAssistantGPT('/api/chat/').handler;

export { httpHandler as GET, httpHandler as POST };

@openassistantgpt/ui

First you need to import our library and configure your component to use it.

npm install @openassistantgpt/ui

Once the UI package is installed create the page.tsx file and configure your chatbot like you want.

'use client';

import { OpenAssistantGPTChat, ChatbotConfig } from '@openassistantgpt/ui';

export default function ChatPage() {
  const chatbot: ChatbotConfig = {
    id: '12345',
    name: 'OpenAssistantGPT',

    chatTitle: 'Chat with OpenAssistantGPT',
    welcomeMessage:
      "Welcome to OpenAssistantGPT! ๐Ÿš€ I'm your AI assistant, crafted using this platform. How may I assist you today?",
    chatMessagePlaceHolder: 'Ask us any question...',

    rightToLeftLanguage: false,

    bubbleColor: 'linear-gradient(to top left, #003366, #336699)',
    bubbleTextColor: '#FFFFFF',

    chatHeaderBackgroundColor: '#FFFFFF',
    chatHeaderTextColor: '#52525b',

    chatbotReplyBackgroundColor: '#e4e4e7',
    chatbotReplyTextColor: '#000000',

    userReplyBackgroundColor: '#e4e4e7',
    userReplyTextColor: '#000000',

    chatbotLogoURL:
      'https://gwetfkan2dovfoiz.public.blob.vercel-storage.com/search-8jZhOvOBPxuTmohrup5TPvSzrjsyog.png',
    chatInputStyle: 'default',

    chatHistoryEnabled: true,
    chatFileAttachementEnabled: true,

    displayFooterText: true,
    footerLink: 'https://www.openassistantgpt.io',
    footerTextName: 'OpenAssistantGPT',
  };

  return (
    <OpenAssistantGPTChat
      chatbot={chatbot}
      path="/api/chat/assistant"
      defaultMessage=""
    />
  );
}

Community

The OpenAssistantGPT SDK community can be found on GitHub Discussions where you can ask questions, voice ideas, and share your projects with other people.

Contributing

Contributions to the OpenAssistantGPT SDK are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have smooth experience contributing to OpenAssistantGPT SDK.

Authors

OpenAssistantGPT team members, with contributions from the Open Source Community.

chatbot-sdk's People

Contributors

marcolivierbouch avatar github-actions[bot] avatar dependabot[bot] avatar

Stargazers

 avatar Christopher Daniel Dean avatar Victor Micco avatar Elias avatar Jaskaran Singh avatar Syed Saif avatar Alesso avatar  avatar Shashank Kumar Dubey avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.