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

leftfieldai

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leftfieldai

Add ChatGPT to any <form> field with a few lines of code

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

LeftField.ai

Add ChatGPT to any

field with a few lines of code.

Usage Examples

With React:

import { lfaiCreatePopup } from 'leftfieldai';

function MyForm() {
    // ...

    return (
        <form>
            <input id="title" type="text" />
            <a onClick={() => lfaiCreatePopup({ elementId: 'title', pubKey: 'lfai_xxxx' })}>Use AI for title suggestions</a>
        </form>
    );
}

With Other JavaScript:

// Assuming the following HTML is in the DOM:
// <input id="title" type="text" /> <a href="#" id="titleAILink">Use AI for title suggestions</a>

// Javascript to add:
import { lfaiCreatePopup } from 'leftfieldai';

document.getElementById('titleAILink').addEventListener('click', () => lfaiCreatePopup({ elementId: 'title', pubKey: 'lfai_xxxx' }));

All Options

The package exports a type that has all the available options:

export type TLeftFieldPopupOptions = {
  pubKey: string; // Public key from your LeftFieldAI account
  elementId: string; // ID of the input field you want to fill in with the ChatGPT response
  prompt?: {
    default?: string; // Default ChatGPT prompt to pre-fill for the user
    placeholder?: string; // Placeholder text in the ChatGPT field
    suggested?: string[]; // Suggested starting prompts that your user can click on to get started without typing
  };
  popup?: {
    title?: string; // Title displayed to the user in the popup window UI
  };
};

Keywords

FAQs

Package last updated on 11 May 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc