Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

refactor: clean up unused apis

Louis2bdbce2e4085
diff --git a/core/src/browser/core.ts b/core/src/browser/core.ts
index 93bea50c9..3c35212a3 100644
--- a/core/src/browser/core.ts
+++ b/core/src/browser/core.ts
@@ -78,13 +78,6 @@ const log: (message: string, fileName?: string) => void = (message, fileName) =>
const isSubdirectory: (from: string, to: string) => Promise<boolean> = (from: string, to: string) =>
globalThis.core.api?.isSubdirectory(from, to)
-/**
- * Get system information
- * @returns {Promise<any>} - A promise that resolves with the system information.
- */
-const systemInformation: () => Promise<SystemInformation> = () =>
- globalThis.core.api?.systemInformation()
-
/**
* Show toast message from browser processes.
* @param title
@@ -117,7 +110,6 @@ export {
log,
isSubdirectory,
getUserHomePath,
- systemInformation,
showToast,
dirName,
}
diff --git a/core/src/types/api/index.ts b/core/src/types/api/index.ts
index b9584725d..853195178 100644
--- a/core/src/types/api/index.ts
+++ b/core/src/types/api/index.ts
@@ -49,7 +49,6 @@ export enum AppRoute {
isSubdirectory = 'isSubdirectory',
baseName = 'baseName',
log = 'log',
- systemInformation = 'systemInformation',
showToast = 'showToast',
}
diff --git a/web-app/src/lib/service.ts b/web-app/src/lib/service.ts
index 99e958ff2..351780445 100644
--- a/web-app/src/lib/service.ts
+++ b/web-app/src/lib/service.ts
@@ -1,12 +1,5 @@
-import {
- CoreRoutes,
- APIRoutes,
- HardwareManagementExtension,
- ExtensionTypeEnum,
-} from '@janhq/core'
+import { CoreRoutes, APIRoutes } from '@janhq/core'
import { invoke, InvokeArgs } from '@tauri-apps/api/core'
-import { ExtensionManager } from './extension'
-import { useVulkan } from '@/hooks/useVulkan'
export const AppRoutes = [
'installExtensions',
@@ -43,35 +36,6 @@ export function openExternalUrl(url: string) {
window?.open(url, '_blank')
}
-export const systemInformation = async () => {
- const hardwareExtension =
- ExtensionManager.getInstance().get<HardwareManagementExtension>(
- ExtensionTypeEnum.Hardware
- )
-
- if (!hardwareExtension) return undefined
-
- const hardwareInfo = await hardwareExtension?.getHardware()
-
- const gpuSettingInfo = {
- gpus: hardwareInfo.gpus.filter((gpu) => gpu.total_vram > 0),
- vulkan: useVulkan.getState().vulkanEnabled,
- cpu: hardwareInfo.cpu,
- }
-
- const updateOsInfo = {
- platform: PLATFORM,
- arch: hardwareInfo.cpu.arch,
- freeMem: hardwareInfo.ram.available,
- totalMem: hardwareInfo.ram.total,
- }
-
- return {
- gpuSetting: gpuSettingInfo,
- osInfo: updateOsInfo,
- }
-}
-
export const APIs = {
...Object.values(Routes).reduce((acc, proxy) => {
return {
@@ -86,5 +50,4 @@ export const APIs = {
}
}, {}),
openExternalUrl,
- systemInformation,
}
diff --git a/web-app/src/services/models.ts b/web-app/src/services/models.ts
index c97a67ed1..264b7f8c3 100644
--- a/web-app/src/services/models.ts
+++ b/web-app/src/services/models.ts
@@ -5,7 +5,6 @@ import {
SettingComponentProps,
} from '@janhq/core'
import { Model as CoreModel } from '@janhq/core'
-import { fetch as fetchTauri } from '@tauri-apps/plugin-http'
// Types for model catalog
export interface ModelQuant {
model_id: string
@@ -45,7 +44,7 @@ export const fetchModels = async () => {
*/
export const fetchModelCatalog = async (): Promise<ModelCatalog> => {
try {
- const response = await fetchTauri(MODEL_CATALOG_URL)
+ const response = await fetch(MODEL_CATALOG_URL)
if (!response.ok) {
throw new Error(