* docs: Update README.md * fix: quick ask improvement Signed-off-by: James <james@jan.ai> --------- Signed-off-by: James <james@jan.ai> Co-authored-by: hieu-jan <150573299+henryh0x1@users.noreply.github.com> Co-authored-by: James <james@jan.ai>
31 lines
771 B
TypeScript
31 lines
771 B
TypeScript
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()
|
|
}
|
|
}
|
|
}
|