Skip to content

Commit 9cacf63

Browse files
committed
[UI] fix build error; remove electron build (#861)
1 parent fedbe8b commit 9cacf63

File tree

10 files changed

+2907
-8377
lines changed

10 files changed

+2907
-8377
lines changed

services/app/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.DS_Store
22
node_modules
33
/build
4-
/build-electron
54
/.svelte-kit
65
/package
76
.env

services/app/README.md

Lines changed: 1 addition & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -8,119 +8,4 @@ Create a copy of `.env.example` with
88
cp .env.example .env
99
```
1010

11-
Install dependencies with `npm i` and start the dev server `npm run dev`.
12-
13-
### Building Electron app
14-
15-
> [!IMPORTANT]
16-
> Make sure to install the dependencies and copy the `.env.example` before continuing as [shown above](#developing).
17-
>
18-
> Once copied, change the following values in the `.env` file as shown here:
19-
> ```bash
20-
> PUBLIC_JAMAI_URL="http://localhost:6969"
21-
> PUBLIC_IS_SPA="true"
22-
> CHECK_ORIGIN="false"
23-
> ```
24-
25-
Ensure that all cloud modules are removed from the project by running `scripts/remove_cloud_modules.sh` while in the root directory. Cloud frontend cannot be built into static file for a single-page application.
26-
27-
The following is an equivalent script that can be run in PowerShell for building on Windows by running `scripts/remove_cloud_modules.ps1`:
28-
29-
```powershell
30-
Get-ChildItem -Recurse -File -Filter "cloud*.py" | Remove-Item -Force
31-
Get-ChildItem -Recurse -File -Filter "compose.*.cloud.yml" | Remove-Item -Force
32-
Get-ChildItem -Recurse -Directory -Filter "(cloud)" | Remove-Item -Recurse -Force
33-
Remove-Item -Force "services/app/ecosystem.config.cjs"
34-
Remove-Item -Force "services/app/ecosystem.json"
35-
```
36-
37-
Next, run the following to build the app in whatever OS you're currently in:
38-
39-
```bash
40-
cd services/app
41-
npm run package
42-
```
43-
44-
The Electron Forge Package command packages the app into platform-specific executables. To create distributables, run `npm run make`. [See docs](https://www.electronforge.io/cli#package#:~:text=Please%20note%20that%20this%20does%20not%20make%20a%20distributable%20format.%20To%20make%20proper%20distributables%2C%20please%20use%20the%20Make%20command.)
45-
46-
Once done, the packaged app will be in `services/app/build-electron`.
47-
48-
[Electron Forge docs](https://www.electronforge.io/config/makers)
49-
50-
## Build Complete JamAIBase Electron App
51-
1. Follow all the steps in [Building Electron app](#building-electron-app). But run the following compilation steps.
52-
```powershell
53-
cd services/app
54-
npm run make
55-
```
56-
57-
2. Extract the compiled zip file:
58-
```powershell
59-
cd .\services\app\build-electron\make\zip\win32\x64
60-
Expand-Archive -Path 'jamaibase-app-win32-x64-0.2.0.zip' -DestinationPath 'jamaibase-app-win32-x64-0.2.0' -Force
61-
```
62-
3. Copy the executable into `services\app\build-electron\make\zip\win32\x64\jamaibase-app-win32-x64-0.2.0` (doing it this way speeds up compilation of the electron app) *Compiling through the electron-forge is too slow*:
63-
- `infinity_server` (pyinstaller compile all the python services).
64-
- `ellm_api_server` (pyinstaller compile all the python services).
65-
- `docio` (pyinstaller compile all the python services).
66-
- `unstructuredio_api` (pyinstaller compile all the python services).
67-
- `api` (pyinstaller compile all the python services).
68-
69-
4. Download the embedding model and, reranker model into `services\app\build-electron\make\zip\win32\x64\jamaibase-app-win32-x64-0.2.0`.
70-
```powershell
71-
conda create -n hfcli python=3.10
72-
conda activate hfcli
73-
pip install -U "huggingface_hub[cli]"
74-
cd .\services\app\build-electron\make\zip\win32\x64\jamaibase-app-win32-x64-0.2.0\resources
75-
huggingface-cli download sentence-transformers/all-MiniLM-L6-v2 --local-dir .\sentence-transformers_all-MiniLM-L6-v2
76-
huggingface-cli download cross-encoder/ms-marco-TinyBERT-L-2 --local-dir .\cross-encoder_ms-marco-TinyBERT-L-2
77-
78-
# Windows has limit to the filepath length
79-
# So download the model in Documents
80-
huggingface-cli download EmbeddedLLM/Phi-3-mini-4k-instruct-062024-onnx --include="onnx/directml/Phi-3-mini-4k-instruct-062024-int4/*" --local-dir .\llm_model
81-
# copy the content of # C:\Users\{user}\Documents\llm_model\onnx\directml\Phi-3-mini-4k-instruct-062024-int4
82-
# into .\services\app\build-electron\make\zip\win32\x64\jamaibase-app-win32-x64-0.2.0\resources\llm_model
83-
```
84-
5. The directory structure looks like this
85-
```
86-
jamaibase-app-win32-x64-0.2.0
87-
|-- resources
88-
|-- cross-encoder_ms-marco-TinyBERT-L-2
89-
|-- sentence-transformers_all-MiniLM-L6-v2
90-
|-- llm_model
91-
|-- infinity_server
92-
|-- _internal
93-
|-- infinity_server.exe
94-
|-- ellm_api_server
95-
|-- _internal
96-
|-- ellm_api_server.exe
97-
|-- docio
98-
|-- _internal
99-
|-- docio.exe
100-
|-- unstructuredio_api
101-
|-- _internal
102-
|-- unstructuredio_api.exe
103-
|-- api
104-
|-- _internal
105-
|-- api.exe
106-
```
107-
6. To run the application. Double-click on `jamaibase-app.exe`.
108-
109-
## Build app installer with Innosetup (Windows)
110-
### Prerequisite
111-
* Install [Innosetup](https://jrsoftware.org/isdl.php) from [link](https://jrsoftware.org/isdl.php)
112-
113-
1. [Build a complete JamAIBase Electron App](#build-complete-jamaibase-electron-app)
114-
115-
2. Copy the Innosetup configuration and icon into the unzipped directory:
116-
```powershell
117-
cd .\services\app
118-
Copy-Item -Path .\JamAIBase.iss -Destination .\build-electron\make\zip\win32\x64\jamaibase-app-win32-x64-0.2.0
119-
Copy-Item -Path .\electron\icons -Destination .\build-electron\make\zip\win32\x64\jamaibase-app-win32-x64-0.2.0\ -Recurse
120-
```
121-
3. Open the `JamAIBase.iss` file using Innosetup.
122-
4. Start building the executable using Innosetup. `Build -> Compile`(`Ctrl+F9`) (Note that to package everything requires a few hours.)
123-
5. After compilation you can find the installation files and resources in `Output` folder under `jamaibase-app-win32-x64-0.2.0`.
124-
125-
## Developer
126-
1. To run the UI in debug mode. `npm run start:debug_electron`.
11+
Install dependencies with `npm i` and start the dev server `npm run dev`.
-219 KB
Binary file not shown.
-23.5 KB
Binary file not shown.
-36.7 KB
Binary file not shown.

services/app/electron/main.js

Lines changed: 0 additions & 133 deletions
This file was deleted.

services/app/forge.config.cjs

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)