* fix: refactor nitro to extends localoaiengine * fix: refactor openai extension * chore: refactor groq extension * chore: refactor triton tensorrt extension * chore: add tests * chore: refactor engines
32 lines
839 B
TypeScript
32 lines
839 B
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
'use client'
|
|
import { ExtensionTypeEnum } from '@janhq/core'
|
|
|
|
import { extensionManager } from '@/extension/ExtensionManager'
|
|
|
|
export const isCoreExtensionInstalled = () => {
|
|
if (!extensionManager.get(ExtensionTypeEnum.Conversational)) {
|
|
return false
|
|
}
|
|
if (!extensionManager.get(ExtensionTypeEnum.Model)) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
export const setupBaseExtensions = async () => {
|
|
if (typeof window === 'undefined') {
|
|
return
|
|
}
|
|
const baseExtensions = await window.core?.api.baseExtensions()
|
|
|
|
if (
|
|
!extensionManager.get(ExtensionTypeEnum.Conversational) ||
|
|
!extensionManager.get(ExtensionTypeEnum.Model)
|
|
) {
|
|
const installed = await extensionManager.install(baseExtensions)
|
|
if (installed) {
|
|
window.location.reload()
|
|
}
|
|
}
|
|
}
|