@kodaris/krubble-app-components 1.0.106 → 1.0.107
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/chatbot.d.ts +27 -24
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +35 -91
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +35 -91
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +6 -6
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +35 -91
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +7 -7
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -5775,10 +5775,10 @@ let KRChatbot = class KRChatbot extends i$3 {
|
|
|
5775
5775
|
*/
|
|
5776
5776
|
this._globalSkills = [];
|
|
5777
5777
|
/**
|
|
5778
|
-
* Latest results for the `/` composer menu
|
|
5779
|
-
*
|
|
5780
|
-
* buffer from the two browse-tab lists
|
|
5781
|
-
* menu never
|
|
5778
|
+
* Latest results for the `/` composer menu — everything the current user can
|
|
5779
|
+
* actually invoke, merged and role-filtered server-side by
|
|
5780
|
+
* `/conversation/availableSkills`. A separate buffer from the two browse-tab lists
|
|
5781
|
+
* so installed globals in the menu never leak into the "Your Org" tab.
|
|
5782
5782
|
*/
|
|
5783
5783
|
this._invocableSkills = [];
|
|
5784
5784
|
/**
|
|
@@ -6356,12 +6356,11 @@ let KRChatbot = class KRChatbot extends i$3 {
|
|
|
6356
6356
|
}
|
|
6357
6357
|
// --- Skills ---
|
|
6358
6358
|
/**
|
|
6359
|
-
* Search the Kodaris AI skills index and store the results in `_orgSkills
|
|
6360
|
-
*
|
|
6361
|
-
*
|
|
6362
|
-
*
|
|
6363
|
-
*
|
|
6364
|
-
* empty string matches nothing, so the "show everything" case needs it.
|
|
6359
|
+
* Search the Kodaris AI skills index and store the results in `_orgSkills` — the
|
|
6360
|
+
* browse dialog's "Your Org" tab. Mirrors the backend's own skill search (BM25
|
|
6361
|
+
* over name^3/description^2/instructions, active-only). An empty query uses
|
|
6362
|
+
* match_all — multi_match with an empty string matches nothing, so the "show
|
|
6363
|
+
* everything" case needs it.
|
|
6365
6364
|
*
|
|
6366
6365
|
* Follows the kr-combo-box `_fetch` pattern: a request-id guard drops responses
|
|
6367
6366
|
* that arrive out of order. `/aiskills/search` returns a raw OpenSearch response,
|
|
@@ -6441,107 +6440,52 @@ let KRChatbot = class KRChatbot extends i$3 {
|
|
|
6441
6440
|
});
|
|
6442
6441
|
}
|
|
6443
6442
|
/**
|
|
6444
|
-
*
|
|
6445
|
-
*
|
|
6446
|
-
*
|
|
6447
|
-
*
|
|
6448
|
-
*
|
|
6449
|
-
*
|
|
6450
|
-
*
|
|
6451
|
-
*
|
|
6443
|
+
* Load the skills for the `/` composer menu into `_invocableSkills` from
|
|
6444
|
+
* `/conversation/availableSkills` — this instance's own skills plus the installed
|
|
6445
|
+
* global ones, already merged, role-filtered and ranked by the server. That's the
|
|
6446
|
+
* same set the model sees via `list_skills`, so the menu can't offer a skill the
|
|
6447
|
+
* chat would then refuse.
|
|
6448
|
+
*
|
|
6449
|
+
* Not the `aiskills` endpoints the browse dialog's Org tab uses: those require a
|
|
6450
|
+
* skill-authoring role, which an ordinary chat user doesn't have.
|
|
6451
|
+
*
|
|
6452
|
+
* Request-id guard drops responses that arrive out of order (kr-combo-box `_fetch`
|
|
6453
|
+
* pattern).
|
|
6452
6454
|
*/
|
|
6453
6455
|
_searchInvocableSkills(query) {
|
|
6454
6456
|
this._invocableSkillRequestId++;
|
|
6455
6457
|
const requestId = this._invocableSkillRequestId;
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
if (query.trim()) {
|
|
6459
|
-
must = {
|
|
6460
|
-
bool: {
|
|
6461
|
-
should: [
|
|
6462
|
-
{
|
|
6463
|
-
wildcard: {
|
|
6464
|
-
'name.raw': {
|
|
6465
|
-
value: `*${query.trim().replace(/([*?\\])/g, '\\$1')}*`,
|
|
6466
|
-
case_insensitive: true,
|
|
6467
|
-
}
|
|
6468
|
-
}
|
|
6469
|
-
},
|
|
6470
|
-
{
|
|
6471
|
-
wildcard: {
|
|
6472
|
-
'code.raw': {
|
|
6473
|
-
value: `*${query.trim().replace(/([*?\\])/g, '\\$1')}*`,
|
|
6474
|
-
case_insensitive: true,
|
|
6475
|
-
}
|
|
6476
|
-
}
|
|
6477
|
-
},
|
|
6478
|
-
{
|
|
6479
|
-
wildcard: {
|
|
6480
|
-
'description.raw': {
|
|
6481
|
-
value: `*${query.trim().replace(/([*?\\])/g, '\\$1')}*`,
|
|
6482
|
-
case_insensitive: true,
|
|
6483
|
-
}
|
|
6484
|
-
}
|
|
6485
|
-
},
|
|
6486
|
-
],
|
|
6487
|
-
minimum_should_match: 1,
|
|
6488
|
-
},
|
|
6489
|
-
};
|
|
6490
|
-
}
|
|
6491
|
-
// Org skills — this instance's own catalog (globalPublished excluded).
|
|
6492
|
-
const orgSearch = KRHttp.fetch({
|
|
6493
|
-
url: '/api/system/opensearch/aiskills/search',
|
|
6494
|
-
method: 'POST',
|
|
6495
|
-
body: {
|
|
6496
|
-
size: 100,
|
|
6497
|
-
query: {
|
|
6498
|
-
bool: {
|
|
6499
|
-
must: [must],
|
|
6500
|
-
filter: [{ term: { active: true } }],
|
|
6501
|
-
must_not: [{ term: { globalPublished: true } }],
|
|
6502
|
-
},
|
|
6503
|
-
},
|
|
6504
|
-
},
|
|
6505
|
-
})
|
|
6506
|
-
.then((r) => r.json())
|
|
6507
|
-
.then((res) => (res?.data?.hits?.hits || []).map((hit) => hit._source))
|
|
6508
|
-
.catch((error) => {
|
|
6509
|
-
console.error('kr-chatbot: invocable skill search failed', error);
|
|
6510
|
-
return [];
|
|
6511
|
-
});
|
|
6512
|
-
// Installed globals — the registry catalog, kept only where enabled=true.
|
|
6513
|
-
const globalSearch = KRHttp.fetch({
|
|
6514
|
-
url: '/api/system/opensearch/aiskills/global/search',
|
|
6458
|
+
KRHttp.fetch({
|
|
6459
|
+
url: '/api/system/conversation/availableSkills',
|
|
6515
6460
|
method: 'POST',
|
|
6516
6461
|
body: { query: query.trim() },
|
|
6517
6462
|
})
|
|
6518
6463
|
.then((r) => r.json())
|
|
6519
|
-
.then((res) =>
|
|
6520
|
-
.catch((error) => {
|
|
6521
|
-
console.error('kr-chatbot: installed global skill search failed', error);
|
|
6522
|
-
return [];
|
|
6523
|
-
});
|
|
6524
|
-
Promise.all([orgSearch, globalSearch]).then(([orgSkills, globalSkills]) => {
|
|
6464
|
+
.then((res) => {
|
|
6525
6465
|
// Ignore a stale response superseded by a newer search.
|
|
6526
6466
|
if (requestId !== this._invocableSkillRequestId) {
|
|
6527
6467
|
return;
|
|
6528
6468
|
}
|
|
6529
|
-
this._invocableSkills = [
|
|
6469
|
+
this._invocableSkills = (res?.data || []);
|
|
6470
|
+
})
|
|
6471
|
+
.catch((error) => {
|
|
6472
|
+
console.error('kr-chatbot: invocable skill search failed', error);
|
|
6530
6473
|
});
|
|
6531
6474
|
}
|
|
6532
6475
|
/**
|
|
6533
|
-
*
|
|
6534
|
-
*
|
|
6535
|
-
*
|
|
6536
|
-
*
|
|
6537
|
-
*
|
|
6538
|
-
*
|
|
6476
|
+
* Load the browse dialog's "Kodaris" tab into `_globalSkills` — the full Kodaris
|
|
6477
|
+
* catalog, installed or not, each row carrying `enabled` = installed here.
|
|
6478
|
+
*
|
|
6479
|
+
* Uses `/conversation/globalSkillCatalog` rather than the `/aiskills/global/search`
|
|
6480
|
+
* twin, which requires a skill-authoring role an ordinary chat user doesn't have.
|
|
6481
|
+
* Both return the same catalog in `KRChatbotSkill` shape
|
|
6482
|
+
* (`data: [{ code, name, description, enabled }]`), so no `_source` lifting is needed.
|
|
6539
6483
|
*/
|
|
6540
6484
|
_searchGlobalSkills(query) {
|
|
6541
6485
|
this._globalSkillRequestId++;
|
|
6542
6486
|
const requestId = this._globalSkillRequestId;
|
|
6543
6487
|
KRHttp.fetch({
|
|
6544
|
-
url: '/api/system/
|
|
6488
|
+
url: '/api/system/conversation/globalSkillCatalog',
|
|
6545
6489
|
method: 'POST',
|
|
6546
6490
|
body: { query: query.trim() },
|
|
6547
6491
|
})
|