chore: update core services and module export (#376)
* chore: update core services and module export * Correct version of plugins (#374) Co-authored-by: Hien To <tominhhien97@gmail.com> * janhq/jan: Update tag build 1.0.2 for data-plugin * janhq/jan: Update tag build 1.0.2 for inference-plugin * janhq/jan: Update tag build 1.0.2 for model-management-plugin * janhq/jan: Update tag build 1.0.2 for monitoring-plugin * janhq/jan: Update tag build 1.0.2 for openai-plugin * chore: update web to use @janhq/core module --------- Co-authored-by: hiento09 <136591877+hiento09@users.noreply.github.com> Co-authored-by: Hien To <tominhhien97@gmail.com> Co-authored-by: Service Account <service@jan.ai>
This commit is contained in:
parent
c220d7cd68
commit
b46042654c
@ -11,7 +11,7 @@
|
||||
const core = require("@janhq/core");
|
||||
|
||||
// typescript
|
||||
import { core } from "@janhq/core";
|
||||
import * as core from "@janhq/core";
|
||||
```
|
||||
|
||||
### Register Plugin Extensions
|
||||
@ -186,7 +186,7 @@ In your main entry code (e.g., `index.ts`), start by importing the necessary mod
|
||||
|
||||
```js
|
||||
// index.ts
|
||||
import { core } from "@janhq/core";
|
||||
import * as core from "@janhq/core";
|
||||
```
|
||||
|
||||
#### Perform File Operations
|
||||
@ -223,7 +223,7 @@ In your main process code (e.g., `index.ts`), start by importing the `core` obje
|
||||
|
||||
```js
|
||||
// index.ts
|
||||
import { core } from "@janhq/core";
|
||||
import * as core from "@janhq/core";
|
||||
```
|
||||
|
||||
##### Define the Module Path
|
||||
|
||||
@ -37,11 +37,18 @@ export type RegisterExtensionPoint = (
|
||||
method: Function,
|
||||
priority?: number
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Core exports
|
||||
* @deprecated This object is deprecated and should not be used.
|
||||
* Use individual functions instead.
|
||||
*/
|
||||
export const core = {
|
||||
invokePluginFunc,
|
||||
downloadFile,
|
||||
deleteFile,
|
||||
};
|
||||
|
||||
/**
|
||||
* Functions exports
|
||||
*/
|
||||
export { invokePluginFunc, downloadFile, deleteFile };
|
||||
|
||||
@ -117,6 +117,11 @@ export enum InferenceService {
|
||||
* Stops a running inference model.
|
||||
*/
|
||||
StopModel = "stopModel",
|
||||
|
||||
/**
|
||||
* Single inference response.
|
||||
*/
|
||||
InferenceRequest = "inferenceRequest",
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,16 +129,6 @@ export enum InferenceService {
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum ModelManagementService {
|
||||
/**
|
||||
* Gets a list of downloaded models.
|
||||
*/
|
||||
GetDownloadedModels = "getDownloadedModels",
|
||||
|
||||
/**
|
||||
* Gets a list of available models from the server.
|
||||
*/
|
||||
GetAvailableModels = "getAvailableModels",
|
||||
|
||||
/**
|
||||
* Deletes a downloaded model.
|
||||
*/
|
||||
@ -144,11 +139,6 @@ export enum ModelManagementService {
|
||||
*/
|
||||
DownloadModel = "downloadModel",
|
||||
|
||||
/**
|
||||
* Searches for models on the server.
|
||||
*/
|
||||
SearchModels = "searchModels",
|
||||
|
||||
/**
|
||||
* Gets configued models from the database.
|
||||
*/
|
||||
@ -164,11 +154,6 @@ export enum ModelManagementService {
|
||||
*/
|
||||
UpdateFinishedDownloadAt = "updateFinishedDownloadAt",
|
||||
|
||||
/**
|
||||
* Gets a list of unfinished download models from the database.
|
||||
*/
|
||||
GetUnfinishedDownloadModels = "getUnfinishedDownloadModels",
|
||||
|
||||
/**
|
||||
* Gets a list of finished download models from the database.
|
||||
*/
|
||||
@ -244,11 +229,17 @@ export enum PluginService {
|
||||
*/
|
||||
export { store } from "./store";
|
||||
|
||||
/**
|
||||
* @deprecated This object is deprecated and should not be used.
|
||||
* Use individual functions instead.
|
||||
*/
|
||||
export { core } from "./core";
|
||||
|
||||
/**
|
||||
* Core module exports.
|
||||
* @module
|
||||
*/
|
||||
export { core, RegisterExtensionPoint } from "./core";
|
||||
export { RegisterExtensionPoint, deleteFile, downloadFile, invokePluginFunc } from "./core";
|
||||
|
||||
/**
|
||||
* Events module exports.
|
||||
|
||||
@ -2,7 +2,7 @@ import React from "react";
|
||||
import { useAtomValue, useSetAtom } from "jotai";
|
||||
import Image from "next/image";
|
||||
import { Conversation } from "@/_models/Conversation";
|
||||
import { ModelManagementService } from "@janhq/plugin-core";
|
||||
import { ModelManagementService } from "@janhq/core";
|
||||
import { executeSerial } from "../../../../electron/core/plugin-manager/execution/extension-manager";
|
||||
import {
|
||||
conversationStatesAtom,
|
||||
|
||||
@ -10,7 +10,7 @@ import { ChartPieIcon, CommandLineIcon, PlayIcon } from "@heroicons/react/24/out
|
||||
|
||||
import { MagnifyingGlassIcon } from "@heroicons/react/20/solid";
|
||||
import classNames from "classnames";
|
||||
import { PluginService, preferences } from "@janhq/plugin-core";
|
||||
import { PluginService, preferences } from "@janhq/core";
|
||||
import { execute } from "../../../electron/core/plugin-manager/execution/extension-manager";
|
||||
|
||||
export const Preferences = () => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { addNewMessageAtom, updateMessageAtom } from "@/_helpers/atoms/ChatMessage.atom";
|
||||
import { toChatMessage } from "@/_models/ChatMessage";
|
||||
import { events, EventName, NewMessageResponse } from "@janhq/plugin-core";
|
||||
import { events, EventName, NewMessageResponse } from "@janhq/core";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { ReactNode, useEffect } from "react";
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import { ReactNode, useEffect } from "react";
|
||||
import { appDownloadProgress } from "./JotaiWrapper";
|
||||
import { DownloadState } from "@/_models/DownloadState";
|
||||
import { executeSerial } from "../../../electron/core/plugin-manager/execution/extension-manager";
|
||||
import { ModelManagementService } from "@janhq/plugin-core";
|
||||
import { ModelManagementService } from "@janhq/core";
|
||||
import { setDownloadStateAtom, setDownloadStateSuccessAtom } from "./atoms/DownloadState.atom";
|
||||
import { getDownloadedModels } from "@/_hooks/useGetDownloadedModels";
|
||||
import { downloadedModelAtom } from "./atoms/DownloadedModel.atom";
|
||||
|
||||
@ -2,7 +2,7 @@ import { ChatMessage, RawMessage, toChatMessage } from "@/_models/ChatMessage";
|
||||
import { executeSerial } from "@/_services/pluginService";
|
||||
import { useAtomValue, useSetAtom } from "jotai";
|
||||
import { useEffect, useState } from "react";
|
||||
import { DataService } from "@janhq/plugin-core";
|
||||
import { DataService } from "@janhq/core";
|
||||
import { addOldMessagesAtom } from "@/_helpers/atoms/ChatMessage.atom";
|
||||
import {
|
||||
currentConversationAtom,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useAtom, useSetAtom } from "jotai";
|
||||
import { Conversation } from "@/_models/Conversation";
|
||||
import { executeSerial } from "@/_services/pluginService";
|
||||
import { DataService } from "@janhq/plugin-core";
|
||||
import { DataService } from "@janhq/core";
|
||||
import {
|
||||
userConversationsAtom,
|
||||
setActiveConvoIdAtom,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { currentPromptAtom } from "@/_helpers/JotaiWrapper";
|
||||
import { execute } from "@/_services/pluginService";
|
||||
import { useAtom, useAtomValue, useSetAtom } from "jotai";
|
||||
import { DataService } from "@janhq/plugin-core";
|
||||
import { DataService } from "@janhq/core";
|
||||
import { deleteConversationMessage } from "@/_helpers/atoms/ChatMessage.atom";
|
||||
import {
|
||||
userConversationsAtom,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { execute, executeSerial } from "@/_services/pluginService";
|
||||
import { ModelManagementService } from "@janhq/plugin-core";
|
||||
import { ModelManagementService } from "@janhq/core";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { downloadedModelAtom } from "@/_helpers/atoms/DownloadedModel.atom";
|
||||
import { getDownloadedModels } from "./useGetDownloadedModels";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { executeSerial } from "@/_services/pluginService";
|
||||
import { DataService, ModelManagementService } from "@janhq/plugin-core";
|
||||
import { DataService, ModelManagementService } from "@janhq/core";
|
||||
import { ModelVersion } from "@/_models/ModelVersion";
|
||||
import { Product } from "@/_models/Product";
|
||||
import { AssistantModel } from "@/_models/AssistantModel";
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Product } from "@/_models/Product";
|
||||
import { useEffect } from "react";
|
||||
import { executeSerial } from "../../../electron/core/plugin-manager/execution/extension-manager";
|
||||
import { ModelManagementService } from "@janhq/plugin-core";
|
||||
import { ModelManagementService } from "@janhq/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { downloadedModelAtom } from "@/_helpers/atoms/DownloadedModel.atom";
|
||||
import { AssistantModel } from "@/_models/AssistantModel";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { executeSerial } from "@/_services/pluginService";
|
||||
import { SystemMonitoringService } from "@janhq/plugin-core";
|
||||
import { SystemMonitoringService } from "@janhq/core";
|
||||
import { ModelVersion } from "@/_models/ModelVersion";
|
||||
import { useState } from "react";
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { executeSerial } from "../../../electron/core/plugin-manager/execution/extension-manager";
|
||||
import { SystemMonitoringService } from "@janhq/plugin-core";
|
||||
import { SystemMonitoringService } from "@janhq/core";
|
||||
import { useState } from "react";
|
||||
import { ModelVersion } from "@/_models/ModelVersion";
|
||||
import { ModelPerformance, TagType } from "@/_components/SimpleTag/TagType";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { executeSerial } from "../../../electron/core/plugin-manager/execution/extension-manager";
|
||||
import { SystemMonitoringService } from "@janhq/plugin-core";
|
||||
import { SystemMonitoringService } from "@janhq/core";
|
||||
|
||||
export default function useGetSystemResources() {
|
||||
const [ram, setRam] = useState<number>(0);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Conversation, ConversationState } from "@/_models/Conversation";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { executeSerial } from "@/_services/pluginService";
|
||||
import { DataService } from "@janhq/plugin-core";
|
||||
import { DataService } from "@janhq/core";
|
||||
import {
|
||||
conversationStatesAtom,
|
||||
userConversationsAtom,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { executeSerial } from "@/_services/pluginService";
|
||||
import { InferenceService } from "@janhq/plugin-core";
|
||||
import { InferenceService } from "@janhq/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { activeAssistantModelAtom } from "@/_helpers/atoms/Model.atom";
|
||||
import { AssistantModel } from "@/_models/AssistantModel";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { currentPromptAtom } from "@/_helpers/JotaiWrapper";
|
||||
import { useAtom, useAtomValue, useSetAtom } from "jotai";
|
||||
import { DataService, EventName, events } from "@janhq/plugin-core";
|
||||
import { DataService, EventName, events } from "@janhq/core";
|
||||
import { RawMessage, toChatMessage } from "@/_models/ChatMessage";
|
||||
import { executeSerial } from "@/_services/pluginService";
|
||||
import { addNewMessageAtom } from "@/_helpers/atoms/ChatMessage.atom";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { executeSerial } from "@/_services/pluginService";
|
||||
import { ModelManagementService, InferenceService } from "@janhq/plugin-core";
|
||||
import { ModelManagementService, InferenceService } from "@janhq/core";
|
||||
import useInitModel from "./useInitModel";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { activeAssistantModelAtom } from "@/_helpers/atoms/Model.atom";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { NewMessageResponse } from "@janhq/plugin-core";
|
||||
import { NewMessageResponse } from "@janhq/core";
|
||||
export enum MessageType {
|
||||
Text = "Text",
|
||||
Image = "Image",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { extensionPoints, plugins } from "../../../electron/core/plugin-manager/execution/index";
|
||||
import { CoreService, DataService, InferenceService, ModelManagementService } from "@janhq/plugin-core";
|
||||
import { CoreService, DataService, InferenceService, ModelManagementService } from "@janhq/core";
|
||||
|
||||
export const isCorePluginInstalled = () => {
|
||||
if (!extensionPoints.get(DataService.GetConversations)) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { StoreService } from "@janhq/plugin-core";
|
||||
import { StoreService } from "@janhq/core";
|
||||
import { executeSerial } from "./pluginService";
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { PluginService } from "@janhq/plugin-core";
|
||||
import { PluginService } from "@janhq/core";
|
||||
import { ThemeWrapper } from "./_helpers/ThemeWrapper";
|
||||
import JotaiWrapper from "./_helpers/JotaiWrapper";
|
||||
import { ModalWrapper } from "./_helpers/ModalWrapper";
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^1.7.15",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@janhq/plugin-core": "^0.1.8",
|
||||
"@janhq/core": "^0.1.1",
|
||||
"@tailwindcss/typography": "^0.5.9",
|
||||
"@types/react": "18.2.15",
|
||||
"@types/react-dom": "18.2.7",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user