Roshan1162003 commited on
Commit
2806c4e
·
1 Parent(s): 11fb88a

Full project overwrite upload

Browse files
Files changed (6) hide show
  1. .gitattributes +2 -0
  2. document.md +18 -4
  3. index.html +48 -15
  4. main.js +38 -24
  5. package-lock.json +2 -2
  6. report.md +6 -1
.gitattributes CHANGED
@@ -6,3 +6,5 @@
6
  *.gguf filter=lfs diff=lfs merge=lfs -text
7
  *.zip filter=lfs diff=lfs merge=lfs -text
8
  *.ico filter=lfs diff=lfs merge=lfs -text
 
 
 
6
  *.gguf filter=lfs diff=lfs merge=lfs -text
7
  *.zip filter=lfs diff=lfs merge=lfs -text
8
  *.ico filter=lfs diff=lfs merge=lfs -text
9
+ *.exe filter=lfs diff=lfs merge=lfs -text
10
+ *.dll filter=lfs diff=lfs merge=lfs -text
document.md CHANGED
@@ -3,7 +3,17 @@
3
  ## Overview
4
  Welcome to the RemiAI Framework! This document is designed to help you understand how to customize, configure, and make this application your own. This framework is built to be "Plug-and-Play"—meaning you don't need to know Python or complex AI coding to use it.
5
 
6
- ## 🛠️ How to Customize
 
 
 
 
 
 
 
 
 
 
7
 
8
  ### 1. Changing the AI Name
9
  Want to name the AI "Jarvis" or "MyBot"?
@@ -44,10 +54,14 @@ A: **No.** The application comes with a pre-compiled engine (`bujji_engine.exe`
44
  **Q: Why does it say "AVX2"?**
45
  A: AVX2 is a feature in modern CPUs that makes the AI run faster. The app automatically detects if you have it. If not, it switches to a slower but compatible mode (AVX).
46
 
47
- **Q: The app opens but doesn't reply.**
48
  A:
49
- 1. Check if `model.gguf` exists in the correct folder.
50
- 2. Open the Developer Tools (Ctrl+Shift+I) in the app to see if there are any red errors in the Console.
 
 
 
 
51
 
52
  **Q: How do I build it into an .exe file?**
53
  A: Run the command:
 
3
  ## Overview
4
  Welcome to the RemiAI Framework! This document is designed to help you understand how to customize, configure, and make this application your own. This framework is built to be "Plug-and-Play"—meaning you don't need to know Python or complex AI coding to use it.
5
 
6
+ ## 🛠️ Setup & How to Customize
7
+
8
+ ### 0. Quick Setup (Important!)
9
+ Before running the app, you **must** ensure the AI engine files are downloaded correctly. GitHub does not store large files directly, so we use **Git LFS**.
10
+
11
+ 1. **Install Git LFS**:
12
+ * Download and install from [git-lfs.com](https://git-lfs.com).
13
+ * Open a terminal and run: `git lfs install`
14
+ 2. **Pull Files**:
15
+ * Run: `git lfs pull` inside the project folder.
16
+ * *Why?* Without this, the app will say **"RemiAI Engine Missing"** or "Connection Refused".
17
 
18
  ### 1. Changing the AI Name
19
  Want to name the AI "Jarvis" or "MyBot"?
 
54
  **Q: Why does it say "AVX2"?**
55
  A: AVX2 is a feature in modern CPUs that makes the AI run faster. The app automatically detects if you have it. If not, it switches to a slower but compatible mode (AVX).
56
 
57
+ **Q: The app opens but doesn't reply / "RemiAI Engine Missing" Error.**
58
  A:
59
+ 1. **Git LFS Issue**: This usually means you downloaded "pointers" (tiny files) instead of the real engine. Open a terminal in the folder and run `git lfs pull`.
60
+ 2. **Model Issue**: Check if `model.gguf` exists in the `engine` folder.
61
+ 3. **Console Check**: Open Developer Tools (Ctrl+Shift+I) to see errors.
62
+
63
+ **Q: I see "Content Security Policy" warnings in the console.**
64
+ A: We have configured safeguards (`index.html` meta tags) to block malicious scripts. If you see warnings about `unpkg` or `jsdelivr`, ensure your CSP matches the latest trusted domains in our code.
65
 
66
  **Q: How do I build it into an .exe file?**
67
  A: Run the command:
index.html CHANGED
@@ -1,14 +1,18 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>RemiAI - bujji</title>
7
  <link rel="icon" type="image/x-icon" href="remiai.ico">
8
  <link rel="stylesheet" href="styles.css">
 
 
9
  <script src="https://unpkg.com/lucide@latest"></script>
10
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
11
  </head>
 
12
  <body class="">
13
 
14
  <div class="app-container">
@@ -37,7 +41,7 @@
37
  <!-- Redirects to web.html -->
38
  <button class="nav-icon-btn" onclick="window.location.href='web.html'" title="Web Browser">
39
  <i data-lucide="globe"></i>
40
- </div>
41
  </div>
42
 
43
  <div class="nav-label">History</div>
@@ -49,7 +53,7 @@
49
  <div style="margin-bottom: 5px; font-size: 11px; font-weight: bold;">
50
  <span id="status-indicator" class="status-loading">Connecting...</span>
51
  </div>
52
-
53
  <div class="credits-text">
54
  Powered by <br> <strong>Google Gemma 2</strong> <br> Open Weights
55
  </div>
@@ -65,7 +69,7 @@
65
 
66
  <!-- MAIN CONTENT -->
67
  <div class="main-content">
68
-
69
  <!-- 1. CHAT VIEW -->
70
  <div id="view-chat" class="view-section active">
71
  <div class="chat-header">
@@ -93,12 +97,30 @@
93
  </div>
94
 
95
  <!-- PLACEHOLDERS for other views -->
96
- <div id="view-habits" class="view-section hidden centered-view"><h2>Habit Tracker</h2><p>Habit tools will load here.</p></div>
97
- <div id="view-games" class="view-section hidden centered-view"><h2>Games Arcade</h2><p>Games will load here.</p></div>
98
- <div id="view-fashion" class="view-section hidden centered-view"><h2>Fashion Friend</h2><p>Style advice will load here.</p></div>
99
- <div id="view-astro" class="view-section hidden centered-view"><h2>Astro Master</h2><p>Horoscope will load here.</p></div>
100
- <div id="view-productivity" class="view-section hidden centered-view"><h2>Productivity</h2><p>Task tools will load here.</p></div>
101
- <div id="view-breathing" class="view-section hidden centered-view"><h2>Breathing Coach</h2><p>Relaxation tools will load here.</p></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  </div>
104
  </div>
@@ -109,17 +131,27 @@
109
  <h3>Create New Character</h3>
110
  <div class="persona-form">
111
  <div class="form-group"><label>Name</label><input type="text" id="p-name" class="modal-input"></div>
112
- <div class="form-group"><label>Relation</label><input type="text" id="p-relation" class="modal-input"></div>
113
- <div class="form-group"><label>Gender</label><select id="p-gender" class="modal-input"><option value="Female">Female</option><option value="Male">Male</option></select></div>
114
- <div class="form-group"><label>Instructions</label><textarea id="p-instruction" class="modal-input" rows="3"></textarea></div>
 
 
 
 
 
115
  <div class="form-group full-width">
116
  <label>Avatar Image</label>
117
  <input type="file" id="p-sticker-file" class="modal-input">
118
- <img id="p-preview" src="" style="width:30px;height:30px;border-radius:50%;display:none;margin-top:5px;">
 
119
  </div>
120
  <div class="form-group full-width">
121
  <label>Response Length</label>
122
- <select id="p-length" class="modal-input"><option value="short">Short</option><option value="medium">Medium</option><option value="detailed">Detailed</option></select>
 
 
 
 
123
  </div>
124
  <button id="save-persona-btn" class="primary-btn full-width">Save</button>
125
  </div>
@@ -137,7 +169,7 @@
137
  </div>
138
  </div>
139
  </div>
140
-
141
  <div id="persona-delete-modal" class="modal-overlay hidden">
142
  <div class="modal-content">
143
  <h3>Delete Character?</h3>
@@ -151,4 +183,5 @@
151
  <script src="renderer.js"></script>
152
  <script>lucide.createIcons();</script>
153
  </body>
 
154
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
+
4
  <head>
5
  <meta charset="UTF-8">
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
  <title>RemiAI - bujji</title>
8
  <link rel="icon" type="image/x-icon" href="remiai.ico">
9
  <link rel="stylesheet" href="styles.css">
10
+ <meta http-equiv="Content-Security-Policy"
11
+ content="default-src 'self'; script-src 'self' 'unsafe-inline' https://unpkg.com https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' http://127.0.0.1:5000;">
12
  <script src="https://unpkg.com/lucide@latest"></script>
13
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
14
  </head>
15
+
16
  <body class="">
17
 
18
  <div class="app-container">
 
41
  <!-- Redirects to web.html -->
42
  <button class="nav-icon-btn" onclick="window.location.href='web.html'" title="Web Browser">
43
  <i data-lucide="globe"></i>
44
+ </div>
45
  </div>
46
 
47
  <div class="nav-label">History</div>
 
53
  <div style="margin-bottom: 5px; font-size: 11px; font-weight: bold;">
54
  <span id="status-indicator" class="status-loading">Connecting...</span>
55
  </div>
56
+
57
  <div class="credits-text">
58
  Powered by <br> <strong>Google Gemma 2</strong> <br> Open Weights
59
  </div>
 
69
 
70
  <!-- MAIN CONTENT -->
71
  <div class="main-content">
72
+
73
  <!-- 1. CHAT VIEW -->
74
  <div id="view-chat" class="view-section active">
75
  <div class="chat-header">
 
97
  </div>
98
 
99
  <!-- PLACEHOLDERS for other views -->
100
+ <div id="view-habits" class="view-section hidden centered-view">
101
+ <h2>Habit Tracker</h2>
102
+ <p>Habit tools will load here.</p>
103
+ </div>
104
+ <div id="view-games" class="view-section hidden centered-view">
105
+ <h2>Games Arcade</h2>
106
+ <p>Games will load here.</p>
107
+ </div>
108
+ <div id="view-fashion" class="view-section hidden centered-view">
109
+ <h2>Fashion Friend</h2>
110
+ <p>Style advice will load here.</p>
111
+ </div>
112
+ <div id="view-astro" class="view-section hidden centered-view">
113
+ <h2>Astro Master</h2>
114
+ <p>Horoscope will load here.</p>
115
+ </div>
116
+ <div id="view-productivity" class="view-section hidden centered-view">
117
+ <h2>Productivity</h2>
118
+ <p>Task tools will load here.</p>
119
+ </div>
120
+ <div id="view-breathing" class="view-section hidden centered-view">
121
+ <h2>Breathing Coach</h2>
122
+ <p>Relaxation tools will load here.</p>
123
+ </div>
124
 
125
  </div>
126
  </div>
 
131
  <h3>Create New Character</h3>
132
  <div class="persona-form">
133
  <div class="form-group"><label>Name</label><input type="text" id="p-name" class="modal-input"></div>
134
+ <div class="form-group"><label>Relation</label><input type="text" id="p-relation" class="modal-input">
135
+ </div>
136
+ <div class="form-group"><label>Gender</label><select id="p-gender" class="modal-input">
137
+ <option value="Female">Female</option>
138
+ <option value="Male">Male</option>
139
+ </select></div>
140
+ <div class="form-group"><label>Instructions</label><textarea id="p-instruction" class="modal-input"
141
+ rows="3"></textarea></div>
142
  <div class="form-group full-width">
143
  <label>Avatar Image</label>
144
  <input type="file" id="p-sticker-file" class="modal-input">
145
+ <img id="p-preview" src=""
146
+ style="width:30px;height:30px;border-radius:50%;display:none;margin-top:5px;">
147
  </div>
148
  <div class="form-group full-width">
149
  <label>Response Length</label>
150
+ <select id="p-length" class="modal-input">
151
+ <option value="short">Short</option>
152
+ <option value="medium">Medium</option>
153
+ <option value="detailed">Detailed</option>
154
+ </select>
155
  </div>
156
  <button id="save-persona-btn" class="primary-btn full-width">Save</button>
157
  </div>
 
169
  </div>
170
  </div>
171
  </div>
172
+
173
  <div id="persona-delete-modal" class="modal-overlay hidden">
174
  <div class="modal-content">
175
  <h3>Delete Character?</h3>
 
183
  <script src="renderer.js"></script>
184
  <script>lucide.createIcons();</script>
185
  </body>
186
+
187
  </html>
main.js CHANGED
@@ -1,4 +1,4 @@
1
- const { app, BrowserWindow, ipcMain, shell, powerMonitor } = require('electron');
2
  const path = require('path');
3
  const { spawn, exec } = require('child_process');
4
  const fs = require('fs');
@@ -9,25 +9,25 @@ let mainWindow;
9
  let apiProcess;
10
 
11
  // Empty function to prevent crashes since logging is disabled
12
- function logToDesktop(message) {}
13
 
14
  function createWindow() {
15
  mainWindow = new BrowserWindow({
16
- width: 1300,
17
  height: 900,
18
  backgroundColor: '#ffffff',
19
- icon: path.join(__dirname, 'remiai.ico'),
20
- webPreferences: {
21
- nodeIntegration: true,
22
  contextIsolation: false,
23
  webviewTag: true // RESTORED: This allows your browsing feature to work
24
  },
25
- autoHideMenuBar: true,
26
  title: "RemiAI - bujji"
27
  });
28
 
29
  mainWindow.loadFile('index.html');
30
-
31
  // --- FEATURE: TASK REMINDER SYSTEM ---
32
  mainWindow.webContents.on('did-finish-load', () => {
33
  mainWindow.webContents.send('check-tasks');
@@ -55,7 +55,7 @@ async function selectEngine() {
55
  try {
56
  const cpuFlags = await si.cpuFlags();
57
  const flagsStr = JSON.stringify(cpuFlags).toLowerCase();
58
-
59
  const basePath = app.isPackaged ? process.resourcesPath : __dirname;
60
  const engineBaseDir = path.join(basePath, 'engine');
61
  const hasFolder = (f) => fs.existsSync(path.join(engineBaseDir, f));
@@ -80,33 +80,47 @@ async function startNativeBackend() {
80
  const engineSubfolder = await selectEngine();
81
  const basePath = app.isPackaged ? process.resourcesPath : __dirname;
82
  const workingDir = path.join(basePath, 'engine', engineSubfolder);
83
-
84
- let exeName = fs.existsSync(path.join(workingDir, 'bujji_engine.exe'))
85
- ? 'bujji_engine.exe'
86
  : 'llama-server.exe';
87
-
88
  const exePath = path.join(workingDir, exeName);
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  // --- SPEED & CPU CONTROL ---
91
  // Your i5 has 8 logical threads.
92
  // Setting this to 4 uses 50% of your CPU capacity, ensuring fast 3-4s responses.
93
- const optimizedThreads = 4;
94
 
95
  const args = [
96
- '-m', '../model.gguf',
97
  '-c', '2048', // Keeps memory usage low and response snappy
98
  '--batch-size', '512', // Increases prompt processing speed
99
- '--port', '5000',
100
- '-t', optimizedThreads.toString(),
101
  '--n-gpu-layers', '0', // Forced CPU only
102
  '--no-mmap' // Pre-loads model into RAM for zero lag
103
  ];
104
 
105
  try {
106
- apiProcess = spawn(exePath, args, {
107
- cwd: workingDir,
108
- windowsHide: true,
109
- stdio: ['ignore', 'pipe', 'pipe']
110
  });
111
 
112
  apiProcess.stderr.on('data', (data) => logToDesktop(data.toString()));
@@ -119,16 +133,16 @@ function killProcess() {
119
  try {
120
  exec('taskkill /IM bujji_engine.exe /F /T');
121
  exec('taskkill /IM llama-server.exe /F /T');
122
- } catch(e) {}
123
  }
124
 
125
  ipcMain.on('restart-brain', () => {
126
  startNativeBackend();
127
- if(mainWindow) mainWindow.webContents.send('brain-restarted');
128
  });
129
 
130
  ipcMain.on('reload-window', () => {
131
- if(mainWindow) mainWindow.reload();
132
  });
133
 
134
  // --- APP LIFECYCLE ---
 
1
+ const { app, BrowserWindow, ipcMain, shell, powerMonitor, dialog } = require('electron');
2
  const path = require('path');
3
  const { spawn, exec } = require('child_process');
4
  const fs = require('fs');
 
9
  let apiProcess;
10
 
11
  // Empty function to prevent crashes since logging is disabled
12
+ function logToDesktop(message) { }
13
 
14
  function createWindow() {
15
  mainWindow = new BrowserWindow({
16
+ width: 1300,
17
  height: 900,
18
  backgroundColor: '#ffffff',
19
+ icon: path.join(__dirname, 'remiai.ico'),
20
+ webPreferences: {
21
+ nodeIntegration: true,
22
  contextIsolation: false,
23
  webviewTag: true // RESTORED: This allows your browsing feature to work
24
  },
25
+ autoHideMenuBar: true,
26
  title: "RemiAI - bujji"
27
  });
28
 
29
  mainWindow.loadFile('index.html');
30
+
31
  // --- FEATURE: TASK REMINDER SYSTEM ---
32
  mainWindow.webContents.on('did-finish-load', () => {
33
  mainWindow.webContents.send('check-tasks');
 
55
  try {
56
  const cpuFlags = await si.cpuFlags();
57
  const flagsStr = JSON.stringify(cpuFlags).toLowerCase();
58
+
59
  const basePath = app.isPackaged ? process.resourcesPath : __dirname;
60
  const engineBaseDir = path.join(basePath, 'engine');
61
  const hasFolder = (f) => fs.existsSync(path.join(engineBaseDir, f));
 
80
  const engineSubfolder = await selectEngine();
81
  const basePath = app.isPackaged ? process.resourcesPath : __dirname;
82
  const workingDir = path.join(basePath, 'engine', engineSubfolder);
83
+
84
+ let exeName = fs.existsSync(path.join(workingDir, 'bujji_engine.exe'))
85
+ ? 'bujji_engine.exe'
86
  : 'llama-server.exe';
87
+
88
  const exePath = path.join(workingDir, exeName);
89
 
90
+ // --- CHECK FOR GIT LFS POINTERS ---
91
+ try {
92
+ const stats = fs.statSync(exePath);
93
+ if (stats.size < 5000) { // Real engine is >3MB. Pointers are ~130 bytes.
94
+ dialog.showErrorBox(
95
+ "RemiAI Engine Missing",
96
+ `The engine executable is a Git LFS pointer (size: ${stats.size} bytes), not the actual file.\n\nPlease install Git LFS and run: 'git lfs pull'\nOr redownload the 'engine' folder contents correctly.`
97
+ );
98
+ return; // Stop execution
99
+ }
100
+ } catch (err) {
101
+ logToDesktop("Error checking engine file: " + err.message);
102
+ }
103
+
104
  // --- SPEED & CPU CONTROL ---
105
  // Your i5 has 8 logical threads.
106
  // Setting this to 4 uses 50% of your CPU capacity, ensuring fast 3-4s responses.
107
+ const optimizedThreads = 4;
108
 
109
  const args = [
110
+ '-m', '../model.gguf',
111
  '-c', '2048', // Keeps memory usage low and response snappy
112
  '--batch-size', '512', // Increases prompt processing speed
113
+ '--port', '5000',
114
+ '-t', optimizedThreads.toString(),
115
  '--n-gpu-layers', '0', // Forced CPU only
116
  '--no-mmap' // Pre-loads model into RAM for zero lag
117
  ];
118
 
119
  try {
120
+ apiProcess = spawn(exePath, args, {
121
+ cwd: workingDir,
122
+ windowsHide: true,
123
+ stdio: ['ignore', 'pipe', 'pipe']
124
  });
125
 
126
  apiProcess.stderr.on('data', (data) => logToDesktop(data.toString()));
 
133
  try {
134
  exec('taskkill /IM bujji_engine.exe /F /T');
135
  exec('taskkill /IM llama-server.exe /F /T');
136
+ } catch (e) { }
137
  }
138
 
139
  ipcMain.on('restart-brain', () => {
140
  startNativeBackend();
141
+ if (mainWindow) mainWindow.webContents.send('brain-restarted');
142
  });
143
 
144
  ipcMain.on('reload-window', () => {
145
+ if (mainWindow) mainWindow.reload();
146
  });
147
 
148
  // --- APP LIFECYCLE ---
package-lock.json CHANGED
@@ -1,11 +1,11 @@
1
  {
2
- "name": "remiai-loha-mp",
3
  "version": "2.0.0",
4
  "lockfileVersion": 3,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
- "name": "remiai-loha-mp",
9
  "version": "2.0.0",
10
  "dependencies": {
11
  "systeminformation": "^5.23.4"
 
1
  {
2
+ "name": "remiai-bujji-mp",
3
  "version": "2.0.0",
4
  "lockfileVersion": 3,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
+ "name": "remiai-bujji-mp",
9
  "version": "2.0.0",
10
  "dependencies": {
11
  "systeminformation": "^5.23.4"
report.md CHANGED
@@ -44,8 +44,9 @@ graph TD
44
  * **Role**: The "Brain" of the application.
45
  * **Technology**: Pre-compiled binaries (likely based on `llama.cpp`) optimized for CPU inference.
46
  * **Operation**: Runs a local server on port `5000`.
47
- * **Model**: Loads weights strictly from a file named `model.gguf` located in the root/engine folder.
48
  * **No Python Required**: The binary is self-contained with all necessary DLLs.
 
49
 
50
  3. **Renderer Process (`index.html` + `renderer.js`)**:
51
  * **Role**: The User Interface.
@@ -76,6 +77,9 @@ sequenceDiagram
76
  M->>M: Select "engine/cpu_avx/bujji_engine.exe"
77
  end
78
 
 
 
 
79
  M->>E: Spawn Process (model.gguf, port 5000, 4 threads)
80
  E-->>M: Server Started (Background)
81
  M->>W: Create Window (Load index.html)
@@ -88,6 +92,7 @@ sequenceDiagram
88
 
89
  ### 4.1 Prerequisites
90
  * **Operating System**: Windows (10/11) 64-bit.
 
91
  * **Runtime**: Node.js (LTS version recommended).
92
  * **Hardware**:
93
  * Any modern CPU (Intel/AMD) with AVX support.
 
44
  * **Role**: The "Brain" of the application.
45
  * **Technology**: Pre-compiled binaries (likely based on `llama.cpp`) optimized for CPU inference.
46
  * **Operation**: Runs a local server on port `5000`.
47
+ * **Model**: Loads weights strictly from a file named `model.gguf`.
48
  * **No Python Required**: The binary is self-contained with all necessary DLLs.
49
+ * **Git LFS integration**: Large binaries (`.exe`, `.dll`) are tracked via Git LFS to keep the repo clean. The `main.js` includes a startup check to ensure these files are fully downloaded (and not just LFS pointers) before launching.
50
 
51
  3. **Renderer Process (`index.html` + `renderer.js`)**:
52
  * **Role**: The User Interface.
 
77
  M->>M: Select "engine/cpu_avx/bujji_engine.exe"
78
  end
79
 
80
+ M->>M: Validate Engine File Size (Check for Git LFS pointers)
81
+ M-->>U: Error Dialog if File Missing/Small
82
+
83
  M->>E: Spawn Process (model.gguf, port 5000, 4 threads)
84
  E-->>M: Server Started (Background)
85
  M->>W: Create Window (Load index.html)
 
92
 
93
  ### 4.1 Prerequisites
94
  * **Operating System**: Windows (10/11) 64-bit.
95
+ * **software**: Git & Git LFS (Required for downloading engine binaries).
96
  * **Runtime**: Node.js (LTS version recommended).
97
  * **Hardware**:
98
  * Any modern CPU (Intel/AMD) with AVX support.