@ivotoby/postgram-cli 1.3.0 → 1.5.0
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/pgm.js +10 -1
- package/package.json +1 -1
package/dist/pgm.js
CHANGED
|
@@ -29,6 +29,13 @@ function formatSearchResults(results) {
|
|
|
29
29
|
if (result.entity.content && result.entity.content !== result.chunk_content) {
|
|
30
30
|
lines.push(` entity: ${result.entity.content}`);
|
|
31
31
|
}
|
|
32
|
+
if (result.related && result.related.length > 0) {
|
|
33
|
+
lines.push(` related (${result.related.length}):`);
|
|
34
|
+
for (const rel of result.related) {
|
|
35
|
+
const arrow = rel.direction === 'outgoing' ? '->' : '<-';
|
|
36
|
+
lines.push(` ${arrow} [${rel.relation}] ${rel.entity.type} ${shortId(rel.entity.id)}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
return lines;
|
|
34
41
|
}
|
|
@@ -237,6 +244,7 @@ program
|
|
|
237
244
|
.option('--limit <limit>', 'result limit', '10')
|
|
238
245
|
.option('--threshold <threshold>', 'similarity threshold', '0.35')
|
|
239
246
|
.option('--recency-weight <recencyWeight>', 'recency weight', '0.1')
|
|
247
|
+
.option('--expand-graph', 'include graph-connected entities in results')
|
|
240
248
|
.action(async (query, options, command) => {
|
|
241
249
|
await runWithClient(command, async (client, json) => {
|
|
242
250
|
const body = await client.searchEntities({
|
|
@@ -247,7 +255,8 @@ program
|
|
|
247
255
|
owner: options.owner,
|
|
248
256
|
limit: Number(options.limit),
|
|
249
257
|
threshold: Number(options.threshold),
|
|
250
|
-
recency_weight: Number(options.recencyWeight)
|
|
258
|
+
recency_weight: Number(options.recencyWeight),
|
|
259
|
+
expand_graph: options.expandGraph === true ? true : undefined
|
|
251
260
|
});
|
|
252
261
|
return json ? body : formatSearchResults(body.results);
|
|
253
262
|
});
|