Socket
Socket
Sign inDemoInstall

nuxt-chatgpt

Package Overview
Dependencies
175
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nuxt-chatgpt

ChatGPT integration for Nuxt 3


Version published
Weekly downloads
156
decreased by-47.12%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

v0.1.9

🩹 Fixes

  • Removed body destructuring from openai.ts (e5af2f7)

🏡 Chore

  • Release new version (59e5352)

❤️ Contributors

  • SchnapsterDog olivertrajceski@yahoo.com
  • AbdelH2O

Readme

Source

Nuxt Chatgpt

Logo

ChatGPT integration for Nuxt 3.

npm version npm downloads License


About the module

This user-friendly module boasts of an easy integration process that enables seamless implementation into any Nuxt 3 project. With type-safe integration, you can integrate ChatGPT into your Nuxt 3 project without breaking a sweat. Enjoy easy access to the send method through the useChatgpt() composable. Additionally, the module guarantees security as requests are routed through a Nitro Server, thus preventing the exposure of your API Key.

Features

  • 💪   Easy implementation into any Nuxt 3 project.
  • 👉   Type-safe integration of Chatgpt into your Nuxt 3 project.
  • 🕹️   Provides a useChatgpt() composable that grants easy access to the send method.
  • 🔥   Ensures security by routing requests through a Nitro Server, preventing the API Key from being exposed.
  • 🧱   It is lightweight and performs well.

Getting Started

  1. Add nuxt-chatgpt dependency to your project
  • npm
    npm install --save-dev nuxt-chatgpt
    
  • pnpm
    pnpm add -D nuxt-chatgpt
    
  • yarn
    yarn add --dev nuxt-chatgpt
    
  1. Add nuxt-chatgpt to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: ["nuxt-chatgpt"],

  // entirely optional
  chatgpt: {
    apiKey: 'Your apiKey here goes here'
  },
})

That's it! You can now use Nuxt Chatgpt in your Nuxt app 🔥

Example & Usage

To access the send method in the nuxt-chatgpt module, you can use the useChatgpt() composable, which provides easy access to the method. The send method requires two parameters:

  • message: a string representing the text message that you want to send to the GPT-3 model for processing.
  • options: an optional object that specifies any additional options you want to pass to the API request, such as the GPT-3 model ID, the number of responses to generate, and the maximum length of each response.
const { send } = useChatgpt()

const data = ref('')
const message = ref('')

async function sendMessage() {
  const response = await send(message.value)
  data.value = response
}

<template>
  <div>
    <input v-model="message">
    <button
      @click="sendMessage"
      v-text="'Send'"
    />
    <div>{{ data }}</div>
  </div>
</template>

Module Options

NameTypeDefaultDescription
apiKeyStringxxxxxxYour apiKey here goes here
isEnabledBooleantrueEnable or disable the module. True by default.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Oliver Trajceski - LinkedIn - oliver@akrinum.com

Project Link: https://github.com/schnapsterdog/nuxt-chatgpt

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

Acknowledgments

Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!

Keywords

FAQs

Last updated on 21 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc