@mmon-co/ncept-default-theory 3.0.12 → 3.0.13
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/chat.d.ts +5 -0
- package/dist/chat.js +16 -0
- package/package.json +1 -1
package/dist/chat.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ type Recommendation = ProductDocument & {
|
|
|
14
14
|
readonly raiseWhen: string;
|
|
15
15
|
readonly documentUrl: string;
|
|
16
16
|
};
|
|
17
|
+
/** Only an unambiguous official title can identify the intended link. */
|
|
18
|
+
export declare function officialDocumentLinks(ctx: ChatContext<DefaultState>): Map<string, {
|
|
19
|
+
url: string;
|
|
20
|
+
materialUrl: string;
|
|
21
|
+
}>;
|
|
17
22
|
export declare function documentListing(ctx: ChatContext<DefaultState>): {
|
|
18
23
|
documents: ProductDocument[];
|
|
19
24
|
candidates: Recommendation[];
|
package/dist/chat.js
CHANGED
|
@@ -82,6 +82,22 @@ function recommendableAffordances(ctx, documents) {
|
|
|
82
82
|
return [{ ...document, raiseWhen, documentUrl }];
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
+
/** Only an unambiguous official title can identify the intended link. */
|
|
86
|
+
export function officialDocumentLinks(ctx) {
|
|
87
|
+
const links = new Map();
|
|
88
|
+
const seen = new Set();
|
|
89
|
+
for (const { node, label, documentId } of officialDocuments(ctx)) {
|
|
90
|
+
if (seen.has(label)) {
|
|
91
|
+
links.delete(label);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
seen.add(label);
|
|
95
|
+
const url = docsUrl(ctx, node);
|
|
96
|
+
if (url)
|
|
97
|
+
links.set(label, { url, materialUrl: "/ncept/playgrounds/document?material=" + documentId });
|
|
98
|
+
}
|
|
99
|
+
return links;
|
|
100
|
+
}
|
|
85
101
|
export function documentListing(ctx) {
|
|
86
102
|
const documents = officialDocuments(ctx);
|
|
87
103
|
return { documents, candidates: recommendableAffordances(ctx, documents) };
|