sapper-iq 1.0.14 → 1.0.16
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 +21 -1
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -115,7 +115,13 @@ async function runSapper() {
|
|
|
115
115
|
let messages = [];
|
|
116
116
|
if (fs.existsSync(CONTEXT_FILE)) {
|
|
117
117
|
const resume = await safeQuestion(chalk.green('Resume previous session? (y/n): '));
|
|
118
|
-
if (resume.toLowerCase() === 'y')
|
|
118
|
+
if (resume.toLowerCase() === 'y') {
|
|
119
|
+
messages = JSON.parse(fs.readFileSync(CONTEXT_FILE, 'utf8'));
|
|
120
|
+
} else {
|
|
121
|
+
// User said no - delete the old context file
|
|
122
|
+
fs.unlinkSync(CONTEXT_FILE);
|
|
123
|
+
console.log(chalk.gray('Starting fresh session...\n'));
|
|
124
|
+
}
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
const localModels = await ollama.list();
|
|
@@ -155,6 +161,20 @@ Don't keep executing tools endlessly - provide insights after reading!`
|
|
|
155
161
|
const ask = () => {
|
|
156
162
|
safeQuestion(chalk.blue.bold('\nIbrahim ➔ ')).then(async (input) => {
|
|
157
163
|
if (input.toLowerCase() === 'exit') process.exit();
|
|
164
|
+
|
|
165
|
+
// Handle reset command
|
|
166
|
+
if (input.toLowerCase() === '/reset' || input.toLowerCase() === '/clear') {
|
|
167
|
+
if (fs.existsSync(CONTEXT_FILE)) {
|
|
168
|
+
fs.unlinkSync(CONTEXT_FILE);
|
|
169
|
+
console.log(chalk.green('✅ Context cleared! Starting fresh...\n'));
|
|
170
|
+
}
|
|
171
|
+
messages = [{
|
|
172
|
+
role: 'system',
|
|
173
|
+
content: messages[0].content // Keep system prompt
|
|
174
|
+
}];
|
|
175
|
+
return ask();
|
|
176
|
+
}
|
|
177
|
+
|
|
158
178
|
messages.push({ role: 'user', content: input });
|
|
159
179
|
|
|
160
180
|
let active = true;
|