kimiflare 0.26.0 → 0.26.1
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/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -251,7 +251,7 @@ function stableStringify(value, replacer, space) {
|
|
|
251
251
|
function stripOldImages(messages, keepLastTurns) {
|
|
252
252
|
if (keepLastTurns < 0) return messages;
|
|
253
253
|
let userCount = 0;
|
|
254
|
-
let cutoffIndex =
|
|
254
|
+
let cutoffIndex = 0;
|
|
255
255
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
256
256
|
if (messages[i].role === "user") {
|
|
257
257
|
userCount++;
|
|
@@ -8283,13 +8283,24 @@ function makePrefixMessages(cacheStable, model, mode, tools) {
|
|
|
8283
8283
|
}
|
|
8284
8284
|
function findImagePaths(text) {
|
|
8285
8285
|
const paths = [];
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8286
|
+
const quotedRegex = /"([^"]+)"|'([^']+)'/g;
|
|
8287
|
+
let match;
|
|
8288
|
+
while ((match = quotedRegex.exec(text)) !== null) {
|
|
8289
|
+
const path = match[1] ?? match[2];
|
|
8290
|
+
if (path && isImagePath(path) && existsSync(path)) {
|
|
8291
|
+
paths.push(path);
|
|
8292
|
+
}
|
|
8293
|
+
}
|
|
8294
|
+
const remaining = text.replace(/"[^"]+"|'[^']+'/g, "");
|
|
8295
|
+
const ESCAPED_SPACE = "\0";
|
|
8296
|
+
const processed = remaining.replace(/\\ /g, ESCAPED_SPACE);
|
|
8297
|
+
for (const token of processed.split(/\s+/)) {
|
|
8298
|
+
const clean = token.replace(new RegExp(ESCAPED_SPACE, "g"), " ").replace(/^["']|["',;:!?]$/g, "").replace(/[.,;:!?]$/, "");
|
|
8299
|
+
if (clean && isImagePath(clean) && existsSync(clean) && !paths.includes(clean)) {
|
|
8289
8300
|
paths.push(clean);
|
|
8290
8301
|
}
|
|
8291
8302
|
}
|
|
8292
|
-
return
|
|
8303
|
+
return paths;
|
|
8293
8304
|
}
|
|
8294
8305
|
function App({ initialCfg, initialUpdateResult }) {
|
|
8295
8306
|
const { exit } = useApp();
|