sapper-iq 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sapper.mjs +16 -0
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -155,6 +155,20 @@ Don't keep executing tools endlessly - provide insights after reading!`
|
|
|
155
155
|
const ask = () => {
|
|
156
156
|
safeQuestion(chalk.blue.bold('\nIbrahim ➔ ')).then(async (input) => {
|
|
157
157
|
if (input.toLowerCase() === 'exit') process.exit();
|
|
158
|
+
|
|
159
|
+
// Handle reset command
|
|
160
|
+
if (input.toLowerCase() === '/reset' || input.toLowerCase() === '/clear') {
|
|
161
|
+
if (fs.existsSync(CONTEXT_FILE)) {
|
|
162
|
+
fs.unlinkSync(CONTEXT_FILE);
|
|
163
|
+
console.log(chalk.green('✅ Context cleared! Starting fresh...\n'));
|
|
164
|
+
}
|
|
165
|
+
messages = [{
|
|
166
|
+
role: 'system',
|
|
167
|
+
content: messages[0].content // Keep system prompt
|
|
168
|
+
}];
|
|
169
|
+
return ask();
|
|
170
|
+
}
|
|
171
|
+
|
|
158
172
|
messages.push({ role: 'user', content: input });
|
|
159
173
|
|
|
160
174
|
let active = true;
|
|
@@ -206,6 +220,8 @@ Don't keep executing tools endlessly - provide insights after reading!`
|
|
|
206
220
|
content: 'ERROR: Your tool command is malformed. Use [TOOL:TYPE]path]content[/TOOL] or [TOOL:TYPE]path[/TOOL]'
|
|
207
221
|
});
|
|
208
222
|
} else {
|
|
223
|
+
// Normal response without tools - save context and wait for next input
|
|
224
|
+
fs.writeFileSync(CONTEXT_FILE, JSON.stringify(messages));
|
|
209
225
|
active = false;
|
|
210
226
|
}
|
|
211
227
|
}
|