wingbot 3.76.4 → 3.76.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/LLMRouter.js +15 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.76.4",
3
+ "version": "3.76.5",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/LLMRouter.js CHANGED
@@ -185,10 +185,21 @@ class LLMRouter {
185
185
  .setData(routing)
186
186
  .systemPrompt(prompt);
187
187
 
188
- const userText = typeof req?.text === 'function' ? req.text() : null;
189
- if (userText) {
190
- session.user(userText);
191
- }
188
+ // Load recent conversation history so the router classifies the last
189
+ // user message in context (e.g. an answer to a bot question) rather
190
+ // than in isolation, where a bare "the protocol is wrong" reads as an
191
+ // intent to reject. Length/flag come from the 'routing' preset;
192
+ // getTranscript already includes this turn's user message as the
193
+ // final entry, so it is not appended separately.
194
+ const { transcriptLength, transcriptFlag } = llm.llmOptions('routing');
195
+ const transcript = await llm.res.getTranscript(
196
+ Math.abs(transcriptLength),
197
+ transcriptFlag
198
+ );
199
+ transcript.forEach((turn) => {
200
+ if (turn.fromBot) session.assistant(turn.text);
201
+ else session.user(turn.text);
202
+ });
192
203
 
193
204
  let res;
194
205
  try {