diff --git a/electron/core/plugins/data-plugin/module.ts b/electron/core/plugins/data-plugin/module.ts
index a9bc20040..8ee49798a 100644
--- a/electron/core/plugins/data-plugin/module.ts
+++ b/electron/core/plugins/data-plugin/module.ts
@@ -116,22 +116,10 @@ function storeModel(params: any) {
model.nsfw,
modelTags,
model.greeting,
- model.type,
- function (err: any) {
- if (err) {
- // Handle the insertion error here
- console.error(err.message);
- res(undefined);
- return;
- }
- // @ts-ignoreF
- const id = this.lastID;
- res(id);
- return;
- }
+ model.type
);
+ stmt.finalize();
- // insert modelVersion to MODEL_VERSION_TABLE_INSERTION
const stmt2 = db.prepare(MODEL_VERSION_TABLE_INSERTION);
stmt2.run(
modelVersion.id,
@@ -143,25 +131,14 @@ function storeModel(params: any) {
modelVersion.usecase,
modelVersion.downloadLink,
model.id,
- modelVersion.startDownloadAt,
- function (err: any) {
- if (err) {
- // Handle the insertion error here
- console.error(err.message);
- res(undefined);
- return;
- }
- // @ts-ignoreF
- const id = this.lastID;
- res(id);
- return;
- }
+ modelVersion.startDownloadAt
);
- stmt.finalize();
+
stmt2.finalize();
});
db.close();
+ res(undefined);
});
}
@@ -171,7 +148,7 @@ function storeModel(params: any) {
* @param model Product
*/
function updateFinishedDownloadAt(modelVersionId: string) {
- return new Promise((res) => {
+ return new Promise((res, rej) => {
const db = new sqlite3.Database(getDbPath());
const time = Date.now();
console.debug(
@@ -181,7 +158,7 @@ function updateFinishedDownloadAt(modelVersionId: string) {
db.run(stmt, [time, modelVersionId], (err: any) => {
if (err) {
console.log(err);
- res(undefined);
+ rej(err);
} else {
console.log("Updated 1 row");
res("Updated");
@@ -299,7 +276,7 @@ function deleteDownloadModel(modelId: string) {
});
}
-async function fetchModelVersion(db: any, versionId: string) {
+function fetchModelVersion(db: any, versionId: string) {
return new Promise((resolve, reject) => {
db.get(
"SELECT * FROM model_versions WHERE id = ?",
@@ -308,32 +285,7 @@ async function fetchModelVersion(db: any, versionId: string) {
if (err) {
reject(err);
} else {
- if (row) {
- const product = {
- id: row.id,
- slug: row.slug,
- name: row.name,
- description: row.description,
- avatarUrl: row.avatar_url,
- longDescription: row.long_description,
- technicalDescription: row.technical_description,
- author: row.author,
- version: row.version,
- modelUrl: row.model_url,
- nsfw: row.nsfw,
- greeting: row.greeting,
- type: row.type,
- inputs: row.inputs,
- outputs: row.outputs,
- createdAt: new Date(row.created_at),
- updatedAt: new Date(row.updated_at),
- fileName: row.file_name,
- downloadUrl: row.download_url,
- };
- resolve(product);
- } else {
- resolve(undefined);
- }
+ resolve(row);
}
}
);
diff --git a/electron/core/plugins/data-plugin/package.json b/electron/core/plugins/data-plugin/package.json
index 2bdbf5ad4..062c53c46 100644
--- a/electron/core/plugins/data-plugin/package.json
+++ b/electron/core/plugins/data-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "data-plugin",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "Jan Database Plugin efficiently stores conversation and model data using SQLite, providing accessible data management",
"icon": "https://raw.githubusercontent.com/tailwindlabs/heroicons/88e98b0c2b458553fbadccddc2d2f878edc0387b/src/20/solid/circle-stack.svg",
"main": "dist/index.js",
diff --git a/electron/core/plugins/model-management-plugin/index.js b/electron/core/plugins/model-management-plugin/index.js
index f19382d66..699770a93 100644
--- a/electron/core/plugins/model-management-plugin/index.js
+++ b/electron/core/plugins/model-management-plugin/index.js
@@ -1,6 +1,6 @@
const MODULE_PATH = "model-management-plugin/dist/module.js";
-const getDownloadedModels = async () =>
+const getDownloadedModels = () =>
new Promise(async (resolve) => {
if (window.electronAPI) {
window.electronAPI
@@ -9,7 +9,7 @@ const getDownloadedModels = async () =>
}
});
-const getAvailableModels = async () =>
+const getAvailableModels = () =>
new Promise(async (resolve) => {
if (window.electronAPI) {
window.electronAPI
@@ -18,7 +18,7 @@ const getAvailableModels = async () =>
}
});
-const downloadModel = async (product) =>
+const downloadModel = (product) =>
new Promise(async (resolve) => {
if (window && window.electronAPI) {
window.electronAPI
@@ -29,7 +29,7 @@ const downloadModel = async (product) =>
}
});
-const deleteModel = async (path) =>
+const deleteModel = (path) =>
new Promise(async (resolve) => {
if (window.electronAPI) {
console.debug(`Delete model model management plugin: ${path}`);
@@ -38,7 +38,7 @@ const deleteModel = async (path) =>
}
});
-const searchModels = async (params) =>
+const searchModels = (params) =>
new Promise(async (resolve) => {
if (window.electronAPI) {
window.electronAPI
@@ -47,7 +47,7 @@ const searchModels = async (params) =>
}
});
-const getConfiguredModels = async () =>
+const getConfiguredModels = () =>
new Promise(async (resolve) => {
if (window.electronAPI) {
window.electronAPI
diff --git a/web/app/_components/ExploreModelContainer/index.tsx b/web/app/_components/ExploreModelContainer/index.tsx
index 09743d142..3102b2b49 100644
--- a/web/app/_components/ExploreModelContainer/index.tsx
+++ b/web/app/_components/ExploreModelContainer/index.tsx
@@ -6,10 +6,10 @@ import ExploreModelFilter from "../ExploreModelFilter";
const ExploreModelContainer: React.FC = () => (
-
+ /> */}
diff --git a/web/app/_components/ExploreModelFilter/index.tsx b/web/app/_components/ExploreModelFilter/index.tsx
index c04353e72..a3c173130 100644
--- a/web/app/_components/ExploreModelFilter/index.tsx
+++ b/web/app/_components/ExploreModelFilter/index.tsx
@@ -1,7 +1,8 @@
import React from "react";
import SearchBar from "../SearchBar";
import SimpleCheckbox from "../SimpleCheckbox";
-import SimpleTag, { TagType } from "../SimpleTag";
+import SimpleTag from "../SimpleTag";
+import { TagType } from "../SimpleTag/TagType";
const tags = [
"Roleplay",
diff --git a/web/app/_components/ExploreModelItem/index.tsx b/web/app/_components/ExploreModelItem/index.tsx
index a06a99a1f..ff16ce924 100644
--- a/web/app/_components/ExploreModelItem/index.tsx
+++ b/web/app/_components/ExploreModelItem/index.tsx
@@ -4,10 +4,11 @@
import ExploreModelItemHeader from "../ExploreModelItemHeader";
import ModelVersionList from "../ModelVersionList";
-import { Fragment, forwardRef, useState } from "react";
-import SimpleTag, { TagType } from "../SimpleTag";
+import { Fragment, forwardRef, useEffect, useState } from "react";
+import SimpleTag from "../SimpleTag";
import { displayDate } from "@/_utils/datetime";
import { Product } from "@/_models/Product";
+import useGetMostSuitableModelVersion from "@/_hooks/useGetMostSuitableModelVersion";
type Props = {
model: Product;
@@ -16,15 +17,26 @@ type Props = {
const ExploreModelItem = forwardRef
(({ model }, ref) => {
const [show, setShow] = useState(false);
+ const { availableVersions } = model;
+ const { suitableModel, getMostSuitableModelVersion } =
+ useGetMostSuitableModelVersion();
+
+ useEffect(() => {
+ getMostSuitableModelVersion(availableVersions);
+ }, [availableVersions]);
+
+ if (!suitableModel) {
+ return null;
+ }
+
return (
@@ -42,11 +54,11 @@ const ExploreModelItem = forwardRef(({ model }, ref) => {
Hardware Compatibility
-
+ /> */}
@@ -63,11 +75,11 @@ const ExploreModelItem = forwardRef(({ model }, ref) => {
Expected Performance
-
+ /> */}
@@ -77,8 +89,14 @@ const ExploreModelItem = forwardRef(({ model }, ref) => {
{model.longDescription}
-
+
Tags
+
+ {model.tags.map((tag) => (
+ // @ts-ignore
+
+ ))}
+
{model.availableVersions?.length > 0 && (
@@ -87,6 +105,7 @@ const ExploreModelItem = forwardRef(({ model }, ref) => {
)}