2023-07-18 00:53:23 +08:00
|
|
|
<script>
|
2023-08-04 06:01:18 +08:00
|
|
|
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
|
2023-08-18 23:33:07 +08:00
|
|
|
import Chatbot from "./static";
|
2023-07-18 00:53:23 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<Meta
|
|
|
|
title="Components/Chatbot"
|
|
|
|
component={Chatbot}
|
|
|
|
argTypes={{
|
|
|
|
label: {
|
|
|
|
control: "text",
|
|
|
|
description: "The textbox label",
|
2023-08-18 03:20:19 +08:00
|
|
|
name: "label"
|
2023-07-18 00:53:23 +08:00
|
|
|
},
|
|
|
|
show_label: {
|
|
|
|
options: [true, false],
|
|
|
|
description: "Whether to show the label",
|
|
|
|
control: { type: "boolean" },
|
2023-08-18 03:20:19 +08:00
|
|
|
defaultValue: true
|
2023-07-18 00:53:23 +08:00
|
|
|
},
|
|
|
|
rtl: {
|
|
|
|
options: [true, false],
|
|
|
|
description: "Whether to render right-to-left",
|
|
|
|
control: { type: "boolean" },
|
2023-08-18 03:20:19 +08:00
|
|
|
defaultValue: false
|
|
|
|
}
|
2023-07-18 00:53:23 +08:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Template let:args>
|
|
|
|
<Chatbot
|
|
|
|
{...args}
|
2023-08-04 06:01:18 +08:00
|
|
|
value={[
|
|
|
|
[
|
|
|
|
"Can you write a function in Python?",
|
2023-08-18 03:20:19 +08:00
|
|
|
"```py\ndef test():\n\tprint(x)\n```"
|
2023-08-04 06:01:18 +08:00
|
|
|
],
|
2023-08-18 03:20:19 +08:00
|
|
|
["Can you do math?", "$$1+1=2$$"]
|
2023-08-04 06:01:18 +08:00
|
|
|
]}
|
2023-07-18 00:53:23 +08:00
|
|
|
/>
|
|
|
|
</Template>
|
|
|
|
|
|
|
|
<Story
|
|
|
|
name="Chatbot with math enabled"
|
2023-08-04 06:01:18 +08:00
|
|
|
args={{ latex_delimiters: [{ left: "$$", right: "$$", display: true }] }}
|
2023-07-18 00:53:23 +08:00
|
|
|
/>
|
|
|
|
|
|
|
|
<Story
|
|
|
|
name="Chatbot with math disabled, small height"
|
|
|
|
args={{ latex_delimiters: [], height: 200 }}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Story
|
|
|
|
name="Chatbot with text rendered right-to-left"
|
2023-08-04 06:01:18 +08:00
|
|
|
args={{
|
|
|
|
rtl: true,
|
2023-08-18 03:20:19 +08:00
|
|
|
latex_delimiters: [{ left: "$$", right: "$$", display: true }]
|
2023-08-16 22:06:34 +08:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Story
|
|
|
|
name="Chatbot with copy button"
|
|
|
|
args={{
|
|
|
|
rtl: true,
|
|
|
|
latex_delimiters: [{ left: "$$", right: "$$", display: true }],
|
2023-08-18 03:20:19 +08:00
|
|
|
show_copy_button: true
|
2023-08-04 06:01:18 +08:00
|
|
|
}}
|
2023-07-18 00:53:23 +08:00
|
|
|
/>
|