diff --git a/website/docs/tutorial/plugin/example.mdx b/website/docs/tutorial/plugin/example.mdx
index daf6db31..a60e666f 100644
--- a/website/docs/tutorial/plugin/example.mdx
+++ b/website/docs/tutorial/plugin/example.mdx
@@ -11,13 +11,22 @@ import Messenger from "@site/src/components/Messenger";
## 命令式问答示例
import WeatherSource from "!!raw-loader!../../../../tests/examples/weather.py";
+import WeatherTest from "!!raw-loader!../../../../tests/test_examples/test_weather.py";
{WeatherSource}
-
+
-### 测试示例
-
-import WeatherTest from "!!raw-loader!../../../../tests/test_examples/test_weather.py";
+
+ 测试示例
{WeatherTest}
+
+
diff --git a/website/src/components/Messenger/index.tsx b/website/src/components/Messenger/index.tsx
index 4dbf7a47..9db3eccc 100644
--- a/website/src/components/Messenger/index.tsx
+++ b/website/src/components/Messenger/index.tsx
@@ -1,16 +1,58 @@
+import clsx from "clsx";
import React from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import Logo from "@theme/Logo";
+
+import styles from "./styles.module.css";
export type Message = {
position?: "left" | "right";
msg: string;
};
-export default function Messenger() {
+function MessageBox({
+ msg,
+ isRight,
+}: {
+ msg: string;
+ isRight: boolean;
+}): JSX.Element {
return (
-
+ );
+}
+
+export default function Messenger({
+ msgs = [],
+}: {
+ msgs?: Message[];
+}): JSX.Element {
+ const isRight = (msg: Message): boolean => msg.position === "right";
+
+ return (
+
+
@@ -21,6 +63,43 @@ export default function Messenger() {
+
+ {msgs.map((msg, i) => (
+
+ ))}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
);
}
diff --git a/website/src/components/Messenger/styles.module.css b/website/src/components/Messenger/styles.module.css
new file mode 100644
index 00000000..1a7f8b34
--- /dev/null
+++ b/website/src/components/Messenger/styles.module.css
@@ -0,0 +1,30 @@
+.message {
+ @apply flex flex-row flex-wrap justify-start;
+}
+
+.messageRight {
+ @apply justify-end;
+}
+
+.message .messageAvatar {
+ @apply relative inline-flex items-center justify-center text-center align-middle h-9 w-9 rounded-full;
+}
+
+.message .messageBox {
+ @apply relative w-fit max-w-[55%] px-2 py-[0.375rem] mx-3 my-2 rounded-lg bg-light;
+}
+:global(.dark) .message .messageBox {
+ @apply bg-dark;
+}
+
+.message .messageBox::after {
+ content: "";
+ border-bottom: 7px solid;
+ @apply absolute top-0 right-full w-2 h-3 text-light rounded-bl-lg;
+}
+:global(.dark) .message .messageBox::after {
+ @apply text-dark;
+}
+.message.messageRight .messageBox::after {
+ @apply !left-full !right-auto !rounded-bl-[0] !rounded-br-lg;
+}