Merge pull request #502 from janhq/chore-refactor-code

Chore: refactor code, hide plugin menu in web
This commit is contained in:
nam-john-ho 2023-10-31 16:10:11 +07:00 committed by GitHub
commit 7fff63367a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -19,7 +19,7 @@ module.exports = {
new webpack.DefinePlugin({
PLUGIN_NAME: JSON.stringify(packageJson.name),
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: {

View File

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

View File

@ -18,7 +18,11 @@ import {
extensionPoints,
} 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 [activeStaticMenu, setActiveStaticMenu] = useState('Appearance')