1.0.22 • Published 6 months ago

@janhq/inference-plugin v1.0.22

Weekly downloads
-
License
AGPL-3.0
Repository
-
Last release
6 months ago

Jan inference plugin

Created using Jan app example

Create a Jan Plugin using Typescript

Use this template to bootstrap the creation of a TypeScript Jan plugin. 🚀

Create Your Own Plugin

To create your own plugin, you can use this repository as a template! Just follow the below instructions:

  1. Click the Use this template button at the top of the repository
  2. Select Create a new repository
  3. Select an owner and name for your new repository
  4. Click Create repository
  5. Clone your new repository

Initial Setup

After you've cloned the repository to your local machine or codespace, you'll need to perform some initial setup steps before you can develop your plugin.

!NOTE

You'll need to have a reasonably modern version of Node.js handy. If you are using a version manager like nodenv or nvm, you can run nodenv install in the root of your repository to install the version specified in package.json. Otherwise, 20.x or later should work!

  1. :hammer_and_wrench: Install the dependencies

    npm install
  2. :building_construction: Package the TypeScript for distribution

    npm run bundle
  3. :white_check_mark: Check your artifact

    There will be a tgz file in your plugin directory now

Update the Plugin Metadata

The package.json file defines metadata about your plugin, such as plugin name, main entry, description and version.

When you copy this repository, update package.json with the name, description for your plugin.

Update the Plugin Code

The src/ directory is the heart of your plugin! This contains the source code that will be run when your plugin extension functions are invoked. You can replace the contents of this directory with your own code.

There are a few things to keep in mind when writing your plugin code:

  • Most Jan Plugin Extension functions are processed asynchronously. In index.ts, you will see that the extension function will return a Promise<any>.

    import { core } from "@janhq/core";
    
    function onStart(): Promise<any> {
      return core.invokePluginFunc(MODULE_PATH, "run", 0);
    }

    For more information about the Jan Plugin Core module, see the documentation.

So, what are you waiting for? Go ahead and start customizing your plugin!

1.0.22

6 months ago

1.0.21

6 months ago

1.0.20

6 months ago

1.0.19

6 months ago

1.0.18

6 months ago

1.0.17

6 months ago

1.0.16

6 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago