Skip to content

Commit 2eced12

Browse files
committed
Merge branch 'main' into fix/problem-in-vector-db
2 parents c37a702 + 3dd7bfe commit 2eced12

File tree

17 files changed

+1724
-1
lines changed

17 files changed

+1724
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ Minima currently supports three modes:
5050
}
5151
```
5252

53-
8. Ask anything, and you'll get answers based on local files in {LOCAL_FILES_PATH} folder.
53+
8. To use fully local installation go to `cd electron`, then run `npm install` and `npm start` which will launch Minima electron app.
54+
55+
9. Ask anything, and you'll get answers based on local files in {LOCAL_FILES_PATH} folder.
5456

5557
Explanation of Variables:
5658

electron/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Installation
2+
3+
```bash
4+
npm install
5+
```
6+
7+
## Run
8+
9+
```bash
10+
npm start
11+
```
12+
13+
## Build
14+
15+
Binary files for Windows, Linux and Mac are available in the `release-builds/` folder.
16+
17+
### For Windows
18+
19+
```bash
20+
npm run package-win
21+
```
22+
23+
### For Linux
24+
25+
```bash
26+
npm run package-linux
27+
```
28+
29+
### For Mac
30+
31+
```bash
32+
npm run package-mac
33+
```

electron/assets/css/no-topbar.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* No topbar */
2+
3+
#webview {
4+
position: absolute;
5+
top: 0;
6+
left: 0;
7+
width: 100%;
8+
height: 100%;
9+
display: inline-flex !important;
10+
}

electron/assets/css/style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* Main */
2+
3+
body {
4+
margin: 0;
5+
padding: 0;
6+
-webkit-user-select: none;
7+
-webkit-app-region: drag;
8+
}
191 KB
Binary file not shown.
33.9 KB
Loading
4.19 KB
Binary file not shown.

electron/assets/js/renderer.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const getControlsHeight = () => {
2+
const controls = document.querySelector("#controls");
3+
if (controls) {
4+
return controls.offsetHeight;
5+
}
6+
return 0;
7+
};
8+
9+
const calculateLayoutSize = () => {
10+
const webview = document.querySelector("webview");
11+
const windowWidth = document.documentElement.clientWidth;
12+
const windowHeight = document.documentElement.clientHeight;
13+
const controlsHeight = getControlsHeight();
14+
const webviewHeight = windowHeight - controlsHeight;
15+
16+
webview.style.width = windowWidth + "px";
17+
webview.style.height = webviewHeight + "px";
18+
};
19+
20+
window.addEventListener("DOMContentLoaded", () => {
21+
calculateLayoutSize();
22+
23+
// Dynamic resize function (responsive)
24+
window.onresize = calculateLayoutSize;
25+
26+
// Home button exists
27+
if (document.querySelector("#home")) {
28+
document.querySelector("#home").onclick = () => {
29+
const home = document.getElementById("webview").getAttribute("data-home");
30+
document.querySelector("webview").src = home;
31+
};
32+
}
33+
34+
// Print button exits
35+
if (document.querySelector("#print_button")) {
36+
document
37+
.querySelector("#print_button")
38+
.addEventListener("click", async () => {
39+
const url = document.querySelector("webview").getAttribute("src");
40+
41+
// Launch print window
42+
await window.electron.print(url);
43+
});
44+
}
45+
});

electron/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<html>
2+
<head>
3+
<link rel="stylesheet" href="assets/css/style.css" />
4+
<link rel="stylesheet" href="assets/css/no-topbar.css">
5+
<script defer src="assets/js/renderer.js"></script>
6+
<meta
7+
http-equiv="Content-Security-Policy"
8+
content="default-src 'self'; style-src 'self' 'unsafe-inline';"
9+
/>
10+
</head>
11+
<body>
12+
<webview
13+
id="webview"
14+
autosize="on"
15+
src="http://localhost:3000/"
16+
></webview>
17+
</body>
18+
</html>

electron/main.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { app } = require("electron");
2+
3+
app.allowRendererProcessReuse = true;
4+
app.on("ready", () => {
5+
const window = require("./src/window");
6+
mainWindow = window.createBrowserWindow(app);
7+
8+
mainWindow.loadURL(`file://${__dirname}/index.html`, { userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36' });
9+
10+
require("./src/print");
11+
});
12+
13+
app.on("window-all-closed", () => {
14+
app.quit();
15+
});

0 commit comments

Comments
 (0)