@gendive/chatllm 0.15.2 → 0.15.3

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.
@@ -2069,6 +2069,7 @@ ${currentContextSummary}` },
2069
2069
  const decoder = new TextDecoder();
2070
2070
  let buffer = "";
2071
2071
  let accumulatedContent = "";
2072
+ let skillTagDetected = false;
2072
2073
  while (true) {
2073
2074
  const { done, value } = await reader.read();
2074
2075
  if (done) break;
@@ -2088,6 +2089,12 @@ ${currentContextSummary}` },
2088
2089
  const thinking = parsed.message?.thinking || "";
2089
2090
  if (content2 || thinking) {
2090
2091
  if (content2) accumulatedContent += content2;
2092
+ if (!skipNextSkillParsingRef.current && accumulatedContent.includes("</skill_use>")) {
2093
+ const endIdx = accumulatedContent.indexOf("</skill_use>");
2094
+ accumulatedContent = accumulatedContent.substring(0, endIdx + "</skill_use>".length);
2095
+ skillTagDetected = true;
2096
+ }
2097
+ const displayContent = skillTagDetected ? accumulatedContent : null;
2091
2098
  setSessions(
2092
2099
  (prev) => prev.map((s) => {
2093
2100
  if (s.id === capturedSessionId) {
@@ -2095,6 +2102,9 @@ ${currentContextSummary}` },
2095
2102
  ...s,
2096
2103
  messages: s.messages.map((m) => {
2097
2104
  if (m.id !== assistantMessageId) return m;
2105
+ if (displayContent) {
2106
+ return { ...m, content: displayContent };
2107
+ }
2098
2108
  let newContent = m.content;
2099
2109
  if (thinking) {
2100
2110
  if (!newContent.includes("<thinking>")) {
@@ -2116,10 +2126,12 @@ ${currentContextSummary}` },
2116
2126
  return s;
2117
2127
  })
2118
2128
  );
2129
+ if (skillTagDetected) break;
2119
2130
  }
2120
2131
  } catch {
2121
2132
  }
2122
2133
  }
2134
+ if (skillTagDetected) break;
2123
2135
  }
2124
2136
  if (buffer.trim()) {
2125
2137
  try {