docs: init
This commit is contained in:
parent
0d824fb203
commit
857cee9b92
@ -1,4 +1,5 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
title: "Azure OpenAI integration"
|
||||
title: "Azure OpenAI Plugin"
|
||||
---
|
||||
|
||||
NPM Package: [@janhq/azure-openai-plugin](https://www.npmjs.com/package/@janhq/azure-openai-plugin)
|
||||
|
||||
5
docs/docs/apps/data.md
Normal file
5
docs/docs/apps/data.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Data Plugin"
|
||||
---
|
||||
|
||||
NPM Package: [@janhq/data-plugin](https://www.npmjs.com/package/@janhq/data-plugin)
|
||||
5
docs/docs/apps/inference.md
Normal file
5
docs/docs/apps/inference.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Inference Plugin"
|
||||
---
|
||||
|
||||
NPM Package: [@janhq/inference-plugin](https://www.npmjs.com/package/@janhq/inference-plugin)
|
||||
5
docs/docs/apps/model-management.md
Normal file
5
docs/docs/apps/model-management.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Model Management Plugin"
|
||||
---
|
||||
|
||||
NPM Package: [@janhq/model-management-plugin](https://www.npmjs.com/package/@janhq/model-management-plugin)
|
||||
5
docs/docs/apps/monitoring.md
Normal file
5
docs/docs/apps/monitoring.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Monitoring Plugin"
|
||||
---
|
||||
|
||||
NPM Package: [@janhq/monitoring-plugin](https://www.npmjs.com/package/@janhq/monitoring-plugin)
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
title: "Data retrieval app"
|
||||
title: "RAG Plugin"
|
||||
---
|
||||
|
||||
Coming soon.
|
||||
|
||||
@ -2,10 +2,12 @@
|
||||
title: "init"
|
||||
---
|
||||
|
||||
`init` is the main entrypoint for mounting your application and its custom logic. It is a reserved function that Jan will look for to initialize your application.
|
||||
`init` is the entrypoint for your application and its custom logic. `init` is a reserved function that Jan will look for to initialize your application.
|
||||
|
||||
## Usage
|
||||
|
||||
Importing
|
||||
|
||||
```js
|
||||
// javascript
|
||||
const core = require("@janhq/core");
|
||||
@ -14,15 +16,27 @@ const core = require("@janhq/core");
|
||||
import * as core from "@janhq/core";
|
||||
```
|
||||
|
||||
## init
|
||||
Setting up event listeners
|
||||
|
||||
TODO
|
||||
```js
|
||||
export function init({ register }) {
|
||||
myListener();
|
||||
}
|
||||
```
|
||||
|
||||
Setting up core service implementation
|
||||
|
||||
```js
|
||||
export function init({ register }: { register: RegisterExtensionPoint }) {
|
||||
register(DataService.GetConversations, "my-app-id", myImplementation);
|
||||
}
|
||||
```
|
||||
|
||||
## RegisterExtensionPoint
|
||||
|
||||
`RegisterExtensionPoint` is used for app initialization.
|
||||
|
||||
It lets you register functions/methods with the main application.
|
||||
It lets you register `CoreService` functions/methods with the main application.
|
||||
|
||||
```js
|
||||
import { RegisterExtensionPoint } from "@janhq/core";
|
||||
@ -39,9 +53,22 @@ type RegisterExtensionPoint = (
|
||||
|
||||
## invokePluginFunc
|
||||
|
||||
`invokePluginFunc` is a way to invoke your custom functions (defined in your `module.ts`) from your application client (defined in your `index.ts`)
|
||||
|
||||
```js
|
||||
// index.ts
|
||||
// index.ts: your application "frontend" and entrypoint
|
||||
function foo(id: number) {
|
||||
return core.invokePluginFunc(MODULE_PATH, "getConvMessages", id);
|
||||
return core.invokePluginFunc(MODULE_PATH, "foo", param1, ...);
|
||||
}
|
||||
|
||||
export function init({ register }: { register: RegisterExtensionPoint }) {
|
||||
register(Service.Foo, "my-app-id", foo);
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
// module.ts: your application "backend"
|
||||
export function foo(param1, ...) {
|
||||
// Your code here
|
||||
}
|
||||
```
|
||||
|
||||
@ -73,9 +73,9 @@ const sidebars = {
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Apps",
|
||||
label: "Apps (Plugins)",
|
||||
collapsible: true,
|
||||
collapsed: false,
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user