chore: refactor core folder structure - module based
This commit is contained in:
parent
77cbdc2dcf
commit
14a67463dc
@ -1,4 +1,4 @@
|
|||||||
import { DownloadRequest, FileStat, NetworkConfig, SystemInformation } from './types'
|
import { DownloadRequest, FileStat, NetworkConfig, SystemInformation } from '../types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a extension module function in main process
|
* Execute a extension module function in main process
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { Assistant, AssistantInterface } from '../index'
|
import { Assistant, AssistantInterface } from '../../types'
|
||||||
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { Thread, ThreadInterface, ThreadMessage, MessageInterface } from '../index'
|
import { Thread, ThreadInterface, ThreadMessage, MessageInterface } from '../../types'
|
||||||
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2,7 +2,7 @@ import { getJanDataFolderPath, joinPath } from '../../core'
|
|||||||
import { events } from '../../events'
|
import { events } from '../../events'
|
||||||
import { BaseExtension } from '../../extension'
|
import { BaseExtension } from '../../extension'
|
||||||
import { fs } from '../../fs'
|
import { fs } from '../../fs'
|
||||||
import { MessageRequest, Model, ModelEvent } from '../../types'
|
import { MessageRequest, Model, ModelEvent } from '../../../types'
|
||||||
import { EngineManager } from './EngineManager'
|
import { EngineManager } from './EngineManager'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,4 +1,3 @@
|
|||||||
import { log } from '../../core'
|
|
||||||
import { AIEngine } from './AIEngine'
|
import { AIEngine } from './AIEngine'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +27,3 @@ export class EngineManager {
|
|||||||
return window.core?.engineManager as EngineManager
|
return window.core?.engineManager as EngineManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The singleton instance of the ExtensionManager.
|
|
||||||
*/
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { executeOnMain, getJanDataFolderPath, joinPath, systemInformation } from '../../core'
|
import { executeOnMain, getJanDataFolderPath, joinPath, systemInformation } from '../../core'
|
||||||
import { events } from '../../events'
|
import { events } from '../../events'
|
||||||
import { Model, ModelEvent } from '../../types'
|
import { Model, ModelEvent } from '../../../types'
|
||||||
import { OAIEngine } from './OAIEngine'
|
import { OAIEngine } from './OAIEngine'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,7 +13,7 @@ import {
|
|||||||
ModelInfo,
|
ModelInfo,
|
||||||
ThreadContent,
|
ThreadContent,
|
||||||
ThreadMessage,
|
ThreadMessage,
|
||||||
} from '../../types'
|
} from '../../../types'
|
||||||
import { events } from '../../events'
|
import { events } from '../../events'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { Observable } from 'rxjs'
|
import { Observable } from 'rxjs'
|
||||||
import { ModelRuntimeParams } from '../../../types'
|
import { ModelRuntimeParams } from '../../../../types'
|
||||||
/**
|
/**
|
||||||
* Sends a request to the inference server to generate a response based on the recent messages.
|
* Sends a request to the inference server to generate a response based on the recent messages.
|
||||||
* @param recentMessages - An array of recent messages to use as context for the inference.
|
* @param recentMessages - An array of recent messages to use as context for the inference.
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
||||||
import { HuggingFaceInterface, HuggingFaceRepoData, Quantization } from '../types/huggingface'
|
import { HuggingFaceInterface, HuggingFaceRepoData, Quantization } from '../../types/huggingface'
|
||||||
import { Model } from '../types/model'
|
import { Model } from '../../types/model'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hugging Face extension for converting HF models to GGUF.
|
* Hugging Face extension for converting HF models to GGUF.
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { InferenceInterface, MessageRequest, ThreadMessage } from '../index'
|
import { InferenceInterface, MessageRequest, ThreadMessage } from '../../types'
|
||||||
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
||||||
import { GpuSetting, ImportingModel, Model, ModelInterface, OptionType } from '../index'
|
import { GpuSetting, ImportingModel, Model, ModelInterface, OptionType } from '../../types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model extension for managing models.
|
* Model extension for managing models.
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
import { BaseExtension, ExtensionTypeEnum } from '../extension'
|
||||||
import { GpuSetting, MonitoringInterface, OperatingSystemInfo } from '../index'
|
import { GpuSetting, MonitoringInterface, OperatingSystemInfo } from '../../types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitoring extension for system monitoring.
|
* Monitoring extension for system monitoring.
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { FileStat } from './types'
|
import { FileStat } from '../types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes data to a file at the specified path.
|
* Writes data to a file at the specified path.
|
||||||
29
core/src/browser/index.ts
Normal file
29
core/src/browser/index.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* Export Core module
|
||||||
|
* @module
|
||||||
|
*/
|
||||||
|
export * from './core'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export Event module.
|
||||||
|
* @module
|
||||||
|
*/
|
||||||
|
export * from './events'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export Filesystem module.
|
||||||
|
* @module
|
||||||
|
*/
|
||||||
|
export * from './fs'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export Extension module.
|
||||||
|
* @module
|
||||||
|
*/
|
||||||
|
export * from './extension'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export all base extensions.
|
||||||
|
* @module
|
||||||
|
*/
|
||||||
|
export * from './extensions'
|
||||||
@ -2,42 +2,13 @@
|
|||||||
* Export all types.
|
* Export all types.
|
||||||
* @module
|
* @module
|
||||||
*/
|
*/
|
||||||
export * from './types/index'
|
export * from './types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export all routes
|
* Export browser module
|
||||||
*/
|
|
||||||
export * from './api'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Export Core module
|
|
||||||
* @module
|
* @module
|
||||||
*/
|
*/
|
||||||
export * from './core'
|
export * from './browser'
|
||||||
|
|
||||||
/**
|
|
||||||
* Export Event module.
|
|
||||||
* @module
|
|
||||||
*/
|
|
||||||
export * from './events'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Export Filesystem module.
|
|
||||||
* @module
|
|
||||||
*/
|
|
||||||
export * from './fs'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Export Extension module.
|
|
||||||
* @module
|
|
||||||
*/
|
|
||||||
export * from './extension'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Export all base extensions.
|
|
||||||
* @module
|
|
||||||
*/
|
|
||||||
export * from './extensions/index'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare global object
|
* Declare global object
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import {
|
|||||||
ExtensionRoute,
|
ExtensionRoute,
|
||||||
FileManagerRoute,
|
FileManagerRoute,
|
||||||
FileSystemRoute,
|
FileSystemRoute,
|
||||||
} from '../../../api'
|
} from '../../../types/api'
|
||||||
import { Downloader } from '../processors/download'
|
import { Downloader } from '../processors/download'
|
||||||
import { FileSystem } from '../processors/fs'
|
import { FileSystem } from '../processors/fs'
|
||||||
import { Extension } from '../processors/extension'
|
import { Extension } from '../processors/extension'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { CoreRoutes } from '../../../api'
|
import { CoreRoutes } from '../../../types/api'
|
||||||
import { RequestAdapter } from './adapter'
|
import { RequestAdapter } from './adapter'
|
||||||
|
|
||||||
export type Handler = (route: string, args: any) => any
|
export type Handler = (route: string, args: any) => any
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { resolve, sep } from 'path'
|
import { resolve, sep } from 'path'
|
||||||
import { DownloadEvent } from '../../../api'
|
import { DownloadEvent } from '../../../types/api'
|
||||||
import { normalizeFilePath } from '../../helper/path'
|
import { normalizeFilePath } from '../../helper/path'
|
||||||
import { getJanDataFolderPath } from '../../helper'
|
import { getJanDataFolderPath } from '../../helper'
|
||||||
import { DownloadManager } from '../../helper/download'
|
import { DownloadManager } from '../../helper/download'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { DownloadRoute } from '../../../../api'
|
import { DownloadRoute } from '../../../../types/api'
|
||||||
import { DownloadManager } from '../../../helper/download'
|
import { DownloadManager } from '../../../helper/download'
|
||||||
import { HttpServer } from '../../HttpServer'
|
import { HttpServer } from '../../HttpServer'
|
||||||
|
|
||||||
|
|||||||
@ -5,4 +5,4 @@ export * from './extension/store'
|
|||||||
export * from './api'
|
export * from './api'
|
||||||
export * from './helper'
|
export * from './helper'
|
||||||
export * from './../types'
|
export * from './../types'
|
||||||
export * from './../api'
|
export * from '../types/api'
|
||||||
|
|||||||
@ -8,3 +8,4 @@ export * from './file'
|
|||||||
export * from './config'
|
export * from './config'
|
||||||
export * from './huggingface'
|
export * from './huggingface'
|
||||||
export * from './miscellaneous'
|
export * from './miscellaneous'
|
||||||
|
export * from './api'
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import { toaster } from '@/containers/Toast'
|
|||||||
|
|
||||||
import { LAST_USED_MODEL_ID } from './useRecommendedModel'
|
import { LAST_USED_MODEL_ID } from './useRecommendedModel'
|
||||||
|
|
||||||
import { extensionManager } from '@/extension'
|
|
||||||
import { downloadedModelsAtom } from '@/helpers/atoms/Model.atom'
|
import { downloadedModelsAtom } from '@/helpers/atoms/Model.atom'
|
||||||
import { activeThreadAtom } from '@/helpers/atoms/Thread.atom'
|
import { activeThreadAtom } from '@/helpers/atoms/Thread.atom'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user