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