@ksm0709/context 0.0.4 → 0.0.5
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 +8 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1310,13 +1310,6 @@ var plugin = async ({ directory, client }) => {
|
|
|
1310
1310
|
${lines}` }];
|
|
1311
1311
|
}
|
|
1312
1312
|
},
|
|
1313
|
-
"experimental.chat.system.transform": async (_input, output) => {
|
|
1314
|
-
const knowledgeSources = [config.knowledge.dir, ...config.knowledge.sources].filter((s) => Boolean(s));
|
|
1315
|
-
const entries = buildKnowledgeIndex(directory, knowledgeSources);
|
|
1316
|
-
const indexContent = formatKnowledgeIndex(entries);
|
|
1317
|
-
if (indexContent)
|
|
1318
|
-
output.system.push(indexContent);
|
|
1319
|
-
},
|
|
1320
1313
|
"experimental.chat.messages.transform": async (_input, output) => {
|
|
1321
1314
|
if (output.messages.length === 0)
|
|
1322
1315
|
return;
|
|
@@ -1325,13 +1318,19 @@ ${lines}` }];
|
|
|
1325
1318
|
return;
|
|
1326
1319
|
const turnStartPath = join4(directory, config.prompts.turnStart ?? join4(DEFAULTS.promptDir, DEFAULTS.turnStartFile));
|
|
1327
1320
|
const turnStart = readPromptFile(turnStartPath);
|
|
1328
|
-
|
|
1321
|
+
const knowledgeSources = [config.knowledge.dir, ...config.knowledge.sources].filter((s) => Boolean(s));
|
|
1322
|
+
const entries = buildKnowledgeIndex(directory, knowledgeSources);
|
|
1323
|
+
const indexContent = formatKnowledgeIndex(entries);
|
|
1324
|
+
const combinedContent = [turnStart, indexContent].filter(Boolean).join(`
|
|
1325
|
+
|
|
1326
|
+
`);
|
|
1327
|
+
if (combinedContent) {
|
|
1329
1328
|
lastUserMsg.parts.push({
|
|
1330
1329
|
id: `context-turn-start-${Date.now()}`,
|
|
1331
1330
|
sessionID: lastUserMsg.info.sessionID,
|
|
1332
1331
|
messageID: lastUserMsg.info.id,
|
|
1333
1332
|
type: "text",
|
|
1334
|
-
text:
|
|
1333
|
+
text: combinedContent
|
|
1335
1334
|
});
|
|
1336
1335
|
}
|
|
1337
1336
|
const turnEndPath = join4(directory, config.prompts.turnEnd ?? join4(DEFAULTS.promptDir, DEFAULTS.turnEndFile));
|