Chore: refactor code, hide plugin menu in web

This commit is contained in:
John 2023-10-31 15:03:59 +07:00
parent a6bd417b86
commit 7a1f713229
3 changed files with 9 additions and 3 deletions

View File

@ -19,7 +19,7 @@ module.exports = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
PLUGIN_NAME: JSON.stringify(packageJson.name), PLUGIN_NAME: JSON.stringify(packageJson.name),
MODULE_PATH: JSON.stringify(`${packageJson.name}/${packageJson.module}`), MODULE_PATH: JSON.stringify(`${packageJson.name}/${packageJson.module}`),
INFERENCE_URL: JSON.stringify("http://127.0.0.1:3928/inferences/llamacpp/chat_completion"), INFERENCE_URL: JSON.stringify(process.env.INFERENCE_URL || "http://127.0.0.1:3928/inferences/llamacpp/chat_completion"),
}), }),
], ],
output: { output: {

View File

@ -132,7 +132,9 @@ function getModelById(modelId: string): Promise<any> {
function onStart() { function onStart() {
store.createCollection("models", {}); store.createCollection("models", {});
if (!(window as any)?.electronAPI) {
fetchDownloadProgress(null, null).then((fileName: string) => fileName && checkDownloadProgress(fileName)); fetchDownloadProgress(null, null).then((fileName: string) => fileName && checkDownloadProgress(fileName));
}
} }
// Register all the above functions and objects with the relevant extension points // Register all the above functions and objects with the relevant extension points

View File

@ -18,7 +18,11 @@ import {
extensionPoints, extensionPoints,
} from '@/../../electron/core/plugin-manager/execution/index' } from '@/../../electron/core/plugin-manager/execution/index'
const staticMenu = ['Appearance', 'Core Plugins'] const staticMenu = ['Appearance']
if (typeof window !== "undefined" && window.electronAPI) {
staticMenu.push('Core Plugins');
}
const SettingsScreen = () => { const SettingsScreen = () => {
const [activeStaticMenu, setActiveStaticMenu] = useState('Appearance') const [activeStaticMenu, setActiveStaticMenu] = useState('Appearance')