* chore: bump cortex 1.0.11-rc10 * chore: bump to latest cortex release * feat: Cortex API Authorization * chore: correct CI CD repo name * chore: correct new menloresearch repo name * feat: rotate api token for each run (#4820) * feat: rotate api token for each run * chore: correct github repo url * chore: correct github api url * chore: should not filter out models first launch * chore: bump cortex release * chore: should get hardware information on launch (#4821) * chore: should have an option to not revalidate hardware information * chore: cortex.cpp gpu activation could cause a race condition (#4825) * fix: jan beta logo displayed in jan release (#4828) --------- Co-authored-by: David <davidpt.janai@gmail.com> Co-authored-by: Nguyen Ngoc Minh <91668012+Minh141120@users.noreply.github.com>
@janhq/core
This module includes functions for communicating with core APIs, registering app extensions, and exporting type definitions.
Usage
Import the package
// Web / extension runtime
import * as core from '@janhq/core'
// Node runtime
import * as node from '@janhq/core/node'
Build an Extension
-
Download an extension template, for example, https://github.com/menloresearch/extension-template.
-
Update the source code:
-
Open
index.tsin your code editor. -
Rename the extension class from
SampleExtensionto your preferred extension name. -
Import modules from the core package.
import * as core from '@janhq/core' -
In the
onLoad()method, add your code:// Example of listening to app events and providing customized inference logic: import * as core from '@janhq/core' export default class MyExtension extends BaseExtension { // On extension load onLoad() { core.events.on(MessageEvent.OnMessageSent, (data) => MyExtension.inference(data, this)) } // Customized inference logic private static inference(incomingMessage: MessageRequestData) { // Prepare customized message content const content: ThreadContent = { type: ContentType.Text, text: { value: "I'm Jan Assistant!", annotations: [], }, } // Modify message and send out const outGoingMessage: ThreadMessage = { ...incomingMessage, content, } } }
-
-
Build the extension:
- Navigate to the extension directory.
- Install dependencies.
yarn install - Compile the source code. The following command keeps running in the terminal and rebuilds the extension when you modify the source code.
yarn build - Select the generated .tgz from Jan > Settings > Extension > Manual Installation.