@yeaft/webchat-agent 1.0.449 → 1.0.450
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 +20 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.450"}
|
package/package.json
CHANGED
package/yeaft/web-bridge.js
CHANGED
|
@@ -2096,15 +2096,25 @@ async function routeEnvelopeToVpThread(sessionId, vpId, envelope) {
|
|
|
2096
2096
|
} else if (runningThreads.length === 0) {
|
|
2097
2097
|
thread = getOrCreateVpThread({ sessionId, vpId, title: fallbackTitle(text) });
|
|
2098
2098
|
} else {
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2099
|
+
let decision = null;
|
|
2100
|
+
try {
|
|
2101
|
+
decision = await threadClassifier({
|
|
2102
|
+
adapter: session?.adapter,
|
|
2103
|
+
model: session?.config?.fastModel || session?.config?.model,
|
|
2104
|
+
vp: readVpForClassifier(vpId),
|
|
2105
|
+
runningThreads: runningThreads.map(threadSnapshotForClassifier),
|
|
2106
|
+
newQuery: text,
|
|
2107
|
+
});
|
|
2108
|
+
} catch (err) {
|
|
2109
|
+
// Classification is an optimisation, not a delivery boundary. The user
|
|
2110
|
+
// message is already durable at this point; dropping the rejected route
|
|
2111
|
+
// promise would leave it visible in history without ever starting a turn.
|
|
2112
|
+
console.warn('[Yeaft] VP thread classification failed; starting a new thread:', err?.message || err);
|
|
2113
|
+
}
|
|
2114
|
+
const targetIsRunning = decision
|
|
2115
|
+
? runningThreads.some((t) => t.threadId === decision.targetThreadId)
|
|
2116
|
+
: false;
|
|
2117
|
+
if (decision?.decision === 'related' && decision.targetThreadId && targetIsRunning) {
|
|
2108
2118
|
thread = getOrCreateVpThread({
|
|
2109
2119
|
sessionId,
|
|
2110
2120
|
vpId,
|
|
@@ -2116,7 +2126,7 @@ async function routeEnvelopeToVpThread(sessionId, vpId, envelope) {
|
|
|
2116
2126
|
thread = getOrCreateVpThread({
|
|
2117
2127
|
sessionId,
|
|
2118
2128
|
vpId,
|
|
2119
|
-
title: decision
|
|
2129
|
+
title: decision?.title || fallbackTitle(text),
|
|
2120
2130
|
});
|
|
2121
2131
|
}
|
|
2122
2132
|
}
|