@vegintech/langchain-react-agent 0.0.6 → 0.0.7
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/index.mjs +1 -26
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -208,22 +208,6 @@ const CustomParagraph = (props) => {
|
|
|
208
208
|
const { node, ...rest } = props;
|
|
209
209
|
return /* @__PURE__ */ jsx("span", { ...rest });
|
|
210
210
|
};
|
|
211
|
-
const renderMarkdown = (content, customComponents, securityConfig) => {
|
|
212
|
-
return /* @__PURE__ */ jsx(Streamdown, {
|
|
213
|
-
components: {
|
|
214
|
-
p: CustomParagraph,
|
|
215
|
-
...customComponents
|
|
216
|
-
},
|
|
217
|
-
allowedTags: securityConfig?.allowedTags,
|
|
218
|
-
literalTagContent: securityConfig?.literalTagContent,
|
|
219
|
-
controls: { table: {
|
|
220
|
-
copy: false,
|
|
221
|
-
download: false,
|
|
222
|
-
fullscreen: false
|
|
223
|
-
} },
|
|
224
|
-
children: content ?? ""
|
|
225
|
-
});
|
|
226
|
-
};
|
|
227
211
|
const renderMessageContent = (message, isLastMessage, isLoading, tools, toolExecutions, components, securityConfig) => {
|
|
228
212
|
const hasToolCalls = message.toolCalls && message.toolCalls.length > 0;
|
|
229
213
|
const shouldBlink = isLastMessage && isLoading && !message.content && message.toolCalls?.length == 0;
|
|
@@ -267,19 +251,10 @@ const renderMessageContent = (message, isLastMessage, isLoading, tools, toolExec
|
|
|
267
251
|
}, message.id);
|
|
268
252
|
};
|
|
269
253
|
const toBubbleItem = (message, isLastMessage, isLoading, tools, toolExecutions, components, securityConfig) => {
|
|
270
|
-
const hasReasoning = !!message.reasoningContent;
|
|
271
|
-
const hasToolCalls = message.toolCalls && message.toolCalls.length > 0;
|
|
272
|
-
if (hasReasoning || hasToolCalls) return {
|
|
273
|
-
key: message.id,
|
|
274
|
-
role: message.type === "human" ? "user" : "ai",
|
|
275
|
-
content: renderMessageContent(message, isLastMessage, isLoading, tools, toolExecutions, components, securityConfig),
|
|
276
|
-
placement: message.type === "human" ? "end" : "start"
|
|
277
|
-
};
|
|
278
254
|
return {
|
|
279
255
|
key: message.id,
|
|
280
256
|
role: message.type === "human" ? "user" : "ai",
|
|
281
|
-
content: message
|
|
282
|
-
contentRender: (content) => renderMarkdown(content, components, securityConfig),
|
|
257
|
+
content: renderMessageContent(message, isLastMessage, isLoading, tools, toolExecutions, components, securityConfig),
|
|
283
258
|
placement: message.type === "human" ? "end" : "start"
|
|
284
259
|
};
|
|
285
260
|
};
|