([]);
const [input, setInput] = useState("");
@@ -244,22 +267,9 @@ export default function AIChatBot({
)}
- {msg.content.split("\n").map((line, i) => (
-
- {line
- .split(/(\*\*[^*]+\*\*)/)
- .map((part, j) =>
- part.startsWith("**") && part.endsWith("**") ? (
-
- {part.slice(2, -2)}
-
- ) : (
- {part}
- ),
- )}
- {i < msg.content.split("\n").length - 1 &&
}
-
- ))}
+ {renderMessage
+ ? renderMessage(msg)
+ : defaultRenderMessage(msg)}
{msg.role === "user" && (
diff --git a/src/client/index.ts b/src/client/index.ts
index 7f5624d..896895a 100644
--- a/src/client/index.ts
+++ b/src/client/index.ts
@@ -1,4 +1,5 @@
export { default as AIAssistantProvider, useAIAssistant } from "./AIAssistantProvider";
export { default as AIChatBot } from "./AIChatBot";
+export type { MessageRenderer } from "./AIChatBot";
export { default as AIFloatingButton } from "./AIFloatingButton";
export type { Message, ExplainContext, ExplainEvent } from "../types";
\ No newline at end of file