@yeaft/webchat-agent 1.0.393 → 1.0.394
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/local-runtime/version.json +1 -1
- package/package.json +1 -1
- package/yeaft/web-bridge.js +17 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.394"}
|
package/package.json
CHANGED
package/yeaft/web-bridge.js
CHANGED
|
@@ -1041,7 +1041,7 @@ function threadSnapshotForClassifier(thread) {
|
|
|
1041
1041
|
|
|
1042
1042
|
function readVpForClassifier(vpId) {
|
|
1043
1043
|
try {
|
|
1044
|
-
const vp =
|
|
1044
|
+
const vp = readConfiguredVp(vpId);
|
|
1045
1045
|
return vp ? { vpId, ...vp } : { vpId };
|
|
1046
1046
|
} catch {
|
|
1047
1047
|
return { vpId };
|
|
@@ -2928,6 +2928,16 @@ function configuredVpPaths() {
|
|
|
2928
2928
|
};
|
|
2929
2929
|
}
|
|
2930
2930
|
|
|
2931
|
+
function readConfiguredVp(vpId) {
|
|
2932
|
+
const { libDir } = configuredVpPaths();
|
|
2933
|
+
return readVp(vpId, libDir ? { libDir } : {});
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
function scanConfiguredVpLibrary() {
|
|
2937
|
+
const { libDir } = configuredVpPaths();
|
|
2938
|
+
return scanVpLibrary(libDir ? { dir: libDir } : {});
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2931
2941
|
export function handleYeaftVpSubscribe(msg = {}) {
|
|
2932
2942
|
if (_vpUnsubscribe) {
|
|
2933
2943
|
try { _vpUnsubscribe(); } catch { /* ignore */ }
|
|
@@ -3282,7 +3292,7 @@ export function handleYeaftCreateSession(msg) {
|
|
|
3282
3292
|
const payload = (msg && msg.payload) || {};
|
|
3283
3293
|
try {
|
|
3284
3294
|
const yeaftDir = ctx.CONFIG?.yeaftDir;
|
|
3285
|
-
const group = createSessionFromSpec(yeaftDir, payload);
|
|
3295
|
+
const group = createSessionFromSpec(yeaftDir, payload, configuredVpPaths());
|
|
3286
3296
|
recordAgentSessionCreated();
|
|
3287
3297
|
group.config = loadSessionConfig(yeaftDir, group.id);
|
|
3288
3298
|
sendSessionCrudResult({ op: 'create', requestId, ok: true, session: group });
|
|
@@ -3577,7 +3587,7 @@ export function handleYeaftSessionSetDefaultVp(msg) {
|
|
|
3577
3587
|
function buildVpPersona(vpId) {
|
|
3578
3588
|
if (!vpId) return null;
|
|
3579
3589
|
try {
|
|
3580
|
-
const vp =
|
|
3590
|
+
const vp = readConfiguredVp(vpId);
|
|
3581
3591
|
if (!vp) return null;
|
|
3582
3592
|
return {
|
|
3583
3593
|
vpId,
|
|
@@ -4538,7 +4548,7 @@ async function runYeaftSessionSend(msg) {
|
|
|
4538
4548
|
if (wantsAdd.length) {
|
|
4539
4549
|
for (const vpId of wantsAdd) {
|
|
4540
4550
|
try {
|
|
4541
|
-
const vp =
|
|
4551
|
+
const vp = readConfiguredVp(vpId);
|
|
4542
4552
|
if (!vp) continue;
|
|
4543
4553
|
addMember(yeaftDir, sessionId, vpId);
|
|
4544
4554
|
rosterMutated = true;
|
|
@@ -4817,9 +4827,9 @@ export function buildVpQueryOpts({ vpId, sessionCoordinator, sessionId, envelope
|
|
|
4817
4827
|
}
|
|
4818
4828
|
if (!resolvedVpId) {
|
|
4819
4829
|
try {
|
|
4820
|
-
const lib =
|
|
4821
|
-
if (Array.isArray(lib) && lib.length > 0 && lib[0].
|
|
4822
|
-
resolvedVpId = lib[0].
|
|
4830
|
+
const lib = scanConfiguredVpLibrary();
|
|
4831
|
+
if (Array.isArray(lib) && lib.length > 0 && lib[0].id) {
|
|
4832
|
+
resolvedVpId = lib[0].id;
|
|
4823
4833
|
}
|
|
4824
4834
|
} catch { /* library scan is best-effort */ }
|
|
4825
4835
|
}
|