Spaces:
Running
Running
feat: update
Browse files- components/base/filter/demos/basic.py +1 -1
- components/pro/chatbot/README-zh_CN.md +15 -12
- components/pro/chatbot/README.md +15 -12
- components/pro/chatbot/demos/chatbot_config.py +2 -2
- components/pro/chatbot/demos/multimodal.py +2 -2
- components/pro/chatbot/demos/thinking.py +2 -2
- components/pro/multimodal_input/README-zh_CN.md +7 -0
- components/pro/multimodal_input/README.md +7 -1
- layout_templates/chatbot/demos/basic.py +2 -2
- requirements.txt +1 -1
- src/pyproject.toml +1 -1
components/base/filter/demos/basic.py
CHANGED
@@ -10,7 +10,7 @@ with gr.Blocks() as demo:
|
|
10 |
with antd.Space(direction="vertical"):
|
11 |
antd.Divider("Without Filter")
|
12 |
with ms.Each(value=data):
|
13 |
-
antd.Button()
|
14 |
antd.Divider("With Filter")
|
15 |
with ms.Each(value=data):
|
16 |
with ms.Filter():
|
|
|
10 |
with antd.Space(direction="vertical"):
|
11 |
antd.Divider("Without Filter")
|
12 |
with ms.Each(value=data):
|
13 |
+
antd.Button("Run")
|
14 |
antd.Divider("With Filter")
|
15 |
with ms.Each(value=data):
|
16 |
with ms.Filter():
|
components/pro/chatbot/README-zh_CN.md
CHANGED
@@ -42,17 +42,19 @@
|
|
42 |
|
43 |
#### 属性
|
44 |
|
45 |
-
| 属性
|
46 |
-
|
|
47 |
-
| value
|
48 |
-
| welcome_config
|
49 |
-
| markdown_config
|
50 |
-
| user_config
|
51 |
-
| bot_config
|
52 |
-
| auto_scroll
|
53 |
-
|
|
54 |
-
|
|
55 |
-
|
|
|
|
|
|
56 |
|
57 |
#### 事件
|
58 |
|
@@ -164,7 +166,7 @@ class ChatbotMarkdownConfig(GradioModel):
|
|
164 |
sanitize_html: Optional[bool] = True
|
165 |
line_breaks: Optional[bool] = True
|
166 |
rtl: Optional[bool] = False
|
167 |
-
allow_tags: Optional[List[str]] =
|
168 |
|
169 |
|
170 |
class ChatbotActionConfig(GradioModel):
|
@@ -269,6 +271,7 @@ class ChatbotDataFileContentOptions(GradioModel):
|
|
269 |
flex: Optional[str] = "normal"
|
270 |
gap: Optional[Union[Literal["small", "middle", "large"], str, int,
|
271 |
float]] = "small"
|
|
|
272 |
|
273 |
|
274 |
# Ant Design X prompts props: https://x.ant.design/components/prompts
|
|
|
42 |
|
43 |
#### 属性
|
44 |
|
45 |
+
| 属性 | 类型 | 默认值 | 描述 |
|
46 |
+
| ------------------------------ | ----------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
|
47 |
+
| value | `list[dict \| ChatbotDataMessage] \| ChatbotDataMessages \| None` | None | 聊天机器人中显示的默认消息列表,每条消息的格式为`ChatbotDataMessage`。 |
|
48 |
+
| welcome_config | `ChatbotWelcomeConfig \| dict \| None` | None | 欢迎界面配置。若`value`为空则会显示欢迎界面。 |
|
49 |
+
| markdown_config | `ChatbotMarkdownConfig \| dict \| None` | None | 所有消息的 Markdown 配置。 |
|
50 |
+
| user_config | `ChatbotUserConfig \| dict \| None` | None | 用户配置,当 message 的 role 为 'user'时生效。 |
|
51 |
+
| bot_config | `ChatbotBotConfig \| dict \| None` | None | 机器人配置,当 message 的 role 为 'assistant'时生效。 |
|
52 |
+
| auto_scroll | `bool` | True | 如果为 `True`,则当值改变时将自动滚动到文本框底部,除非用户向上滚动。如果为 `False`,则当值改变时不会滚动到文本框底部。 |
|
53 |
+
| show_scroll_to_bottom_button | `bool` | True | 如果为 `True`,则会在滚动条向上一定距离时显示滚动到底部按钮。 |
|
54 |
+
| scroll_to_bottom_button_offset | `int \| float` | 200 | 滚动到底部按钮出现时距离底部的偏移量。 |
|
55 |
+
| height | `int \| float \| str` | 400 | 组件的高度,如果值为数字,则以像素为单位指定,如果传递的是字符串,则以 CSS 单位指定。如果 messages 超出了组件高度,则组件将可滚动。 |
|
56 |
+
| max_height | `int \| float \| str \| None` | None | 组件的最大高度,如果传递的是数字,则以像素为单位指定,如果传递的是字符串,则以 CSS 单位指定。 |
|
57 |
+
| min_height | `int \| float \| str \| None` | None | 组件的最小高度,如果传递的是数字,则以像素为单位指定,如果传递的是字符串,则以 CSS 单位指定。 |
|
58 |
|
59 |
#### 事件
|
60 |
|
|
|
166 |
sanitize_html: Optional[bool] = True
|
167 |
line_breaks: Optional[bool] = True
|
168 |
rtl: Optional[bool] = False
|
169 |
+
allow_tags: Optional[Union[List[str], bool]] = False
|
170 |
|
171 |
|
172 |
class ChatbotActionConfig(GradioModel):
|
|
|
271 |
flex: Optional[str] = "normal"
|
272 |
gap: Optional[Union[Literal["small", "middle", "large"], str, int,
|
273 |
float]] = "small"
|
274 |
+
image_props: Optional[dict] = None
|
275 |
|
276 |
|
277 |
# Ant Design X prompts props: https://x.ant.design/components/prompts
|
components/pro/chatbot/README.md
CHANGED
@@ -41,17 +41,19 @@ The `message` object includes all configurations from `bot_config` and `user_con
|
|
41 |
|
42 |
### Props
|
43 |
|
44 |
-
| Attribute
|
45 |
-
|
|
46 |
-
| value
|
47 |
-
| welcome_config
|
48 |
-
| markdown_config
|
49 |
-
| user_config
|
50 |
-
| bot_config
|
51 |
-
| auto_scroll
|
52 |
-
|
|
53 |
-
|
|
54 |
-
|
|
|
|
|
|
55 |
|
56 |
#### Events
|
57 |
|
@@ -163,7 +165,7 @@ class ChatbotMarkdownConfig(GradioModel):
|
|
163 |
sanitize_html: Optional[bool] = True
|
164 |
line_breaks: Optional[bool] = True
|
165 |
rtl: Optional[bool] = False
|
166 |
-
allow_tags: Optional[List[str]] =
|
167 |
|
168 |
|
169 |
class ChatbotActionConfig(GradioModel):
|
@@ -268,6 +270,7 @@ class ChatbotDataFileContentOptions(GradioModel):
|
|
268 |
flex: Optional[str] = "normal"
|
269 |
gap: Optional[Union[Literal["small", "middle", "large"], str, int,
|
270 |
float]] = "small"
|
|
|
271 |
|
272 |
|
273 |
# Ant Design X prompts props: https://x.ant.design/components/prompts
|
|
|
41 |
|
42 |
### Props
|
43 |
|
44 |
+
| Attribute | Type | Default Value | Description |
|
45 |
+
| ------------------------------ | ----------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
46 |
+
| value | `list[dict \| ChatbotDataMessage] \| ChatbotDataMessages \| None` | None | Default list of messages to show in chatbot, where each message is of the format `ChatbotDataMessage`. |
|
47 |
+
| welcome_config | `ChatbotWelcomeConfig \| dict \| None` | None | Configuration of the welcome interface. If the `value` is empty, the welcome interface will be displayed. |
|
48 |
+
| markdown_config | `ChatbotMarkdownConfig \| dict \| None` | None | Markdown configuration for all messages. |
|
49 |
+
| user_config | `ChatbotUserConfig \| dict \| None` | None | User configuration, will be applied when the message role is 'user'. |
|
50 |
+
| bot_config | `ChatbotBotConfig \| dict \| None` | None | Bot configuration, will be applied when the message role is 'assistant'. |
|
51 |
+
| auto_scroll | `bool` | True | If `True`, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes. |
|
52 |
+
| show_scroll_to_bottom_button | `bool` | True | If `True`, the `Scroll To Bottom` button will be shown when the scrollbar is up a certain distance. |
|
53 |
+
| scroll_to_bottom_button_offset | `int \| float` | 200 | The offset from the bottom where the `Scroll To Bottom` button appears. |
|
54 |
+
| height | `int \| float \| str` | 400 | The height of the component, specified in pixels if a number is passed, or in CSS units if a string is passed. If messages exceed the height, the component will scroll. |
|
55 |
+
| max_height | `int \| float \| str \| None` | None | The maximum height of the component, specified in pixels if a number is passed, or in CSS units if a string is passed. |
|
56 |
+
| min_height | `int \| float \| str \| None` | None | The minimum height of the component, specified in pixels if a number is passed, or in CSS units if a string is passed. |
|
57 |
|
58 |
#### Events
|
59 |
|
|
|
165 |
sanitize_html: Optional[bool] = True
|
166 |
line_breaks: Optional[bool] = True
|
167 |
rtl: Optional[bool] = False
|
168 |
+
allow_tags: Optional[Union[List[str], bool]] = False
|
169 |
|
170 |
|
171 |
class ChatbotActionConfig(GradioModel):
|
|
|
270 |
flex: Optional[str] = "normal"
|
271 |
gap: Optional[Union[Literal["small", "middle", "large"], str, int,
|
272 |
float]] = "small"
|
273 |
+
image_props: Optional[dict] = None
|
274 |
|
275 |
|
276 |
# Ant Design X prompts props: https://x.ant.design/components/prompts
|
components/pro/chatbot/demos/chatbot_config.py
CHANGED
@@ -61,7 +61,7 @@ with gr.Blocks() as demo, ms.Application(), antdx.XProvider():
|
|
61 |
},
|
62 |
items=[{
|
63 |
"label":
|
64 |
-
"
|
65 |
"children": [{
|
66 |
"description":
|
67 |
"Help me with a plan to start a business"
|
@@ -74,7 +74,7 @@ with gr.Blocks() as demo, ms.Application(), antdx.XProvider():
|
|
74 |
}]
|
75 |
}, {
|
76 |
"label":
|
77 |
-
"
|
78 |
"children": [{
|
79 |
"description":
|
80 |
"Help me write a story with a twist ending"
|
|
|
61 |
},
|
62 |
items=[{
|
63 |
"label":
|
64 |
+
"📅 Make a plan",
|
65 |
"children": [{
|
66 |
"description":
|
67 |
"Help me with a plan to start a business"
|
|
|
74 |
}]
|
75 |
}, {
|
76 |
"label":
|
77 |
+
"🖋 Help me write",
|
78 |
"children": [{
|
79 |
"description":
|
80 |
"Help me write a story with a twist ending"
|
components/pro/chatbot/demos/multimodal.py
CHANGED
@@ -162,7 +162,7 @@ with gr.Blocks() as demo, ms.Application(), antdx.XProvider(), ms.AutoLoading(
|
|
162 |
},
|
163 |
items=[{
|
164 |
"label":
|
165 |
-
"
|
166 |
"children": [{
|
167 |
"description":
|
168 |
"Help me with a plan to start a business"
|
@@ -175,7 +175,7 @@ with gr.Blocks() as demo, ms.Application(), antdx.XProvider(), ms.AutoLoading(
|
|
175 |
}]
|
176 |
}, {
|
177 |
"label":
|
178 |
-
"
|
179 |
"children": [{
|
180 |
"description":
|
181 |
"Help me write a story with a twist ending"
|
|
|
162 |
},
|
163 |
items=[{
|
164 |
"label":
|
165 |
+
"📅 Make a plan",
|
166 |
"children": [{
|
167 |
"description":
|
168 |
"Help me with a plan to start a business"
|
|
|
175 |
}]
|
176 |
}, {
|
177 |
"label":
|
178 |
+
"🖋 Help me write",
|
179 |
"children": [{
|
180 |
"description":
|
181 |
"Help me write a story with a twist ending"
|
components/pro/chatbot/demos/thinking.py
CHANGED
@@ -159,7 +159,7 @@ with gr.Blocks() as demo, ms.Application(), antdx.XProvider():
|
|
159 |
},
|
160 |
items=[{
|
161 |
"label":
|
162 |
-
"
|
163 |
"children": [{
|
164 |
"description":
|
165 |
"Help me with a plan to start a business"
|
@@ -172,7 +172,7 @@ with gr.Blocks() as demo, ms.Application(), antdx.XProvider():
|
|
172 |
}]
|
173 |
}, {
|
174 |
"label":
|
175 |
-
"
|
176 |
"children": [{
|
177 |
"description":
|
178 |
"Help me write a story with a twist ending"
|
|
|
159 |
},
|
160 |
items=[{
|
161 |
"label":
|
162 |
+
"📅 Make a plan",
|
163 |
"children": [{
|
164 |
"description":
|
165 |
"Help me with a plan to start a business"
|
|
|
172 |
}]
|
173 |
}, {
|
174 |
"label":
|
175 |
+
"🖋 Help me write",
|
176 |
"children": [{
|
177 |
"description":
|
178 |
"Help me write a story with a twist ending"
|
components/pro/multimodal_input/README-zh_CN.md
CHANGED
@@ -46,6 +46,8 @@ class MultimodalInputUploadConfig(GradioModel):
|
|
46 |
"""
|
47 |
fullscreen_drop: Whether to allow fullscreen drop files to the attachments.
|
48 |
|
|
|
|
|
49 |
allow_paste_file: Whether to allow paste file to the attachments.
|
50 |
|
51 |
allow_speech: Whether to allow speech input.
|
@@ -65,11 +67,15 @@ class MultimodalInputUploadConfig(GradioModel):
|
|
65 |
multiple: Whether to support selected multiple files. IE10+ supported. You can select multiple files with CTRL holding down while multiple is set to be True.
|
66 |
|
67 |
overflow: Behavior when the file list overflows.
|
|
|
68 |
title: Title of the attachments panel.
|
69 |
|
|
|
|
|
70 |
placeholder: Placeholder information when there is no file.
|
71 |
"""
|
72 |
fullscreen_drop: Optional[bool] = False
|
|
|
73 |
allow_paste_file: Optional[bool] = True
|
74 |
allow_speech: Optional[bool] = False
|
75 |
show_count: Optional[bool] = True
|
@@ -81,6 +87,7 @@ class MultimodalInputUploadConfig(GradioModel):
|
|
81 |
disabled: Optional[bool] = False
|
82 |
overflow: Literal['wrap', 'scrollX', 'scrollY'] | None = None
|
83 |
title: Optional[str] = "Attachments"
|
|
|
84 |
placeholder: Optional[dict] = field(
|
85 |
default_factory=lambda: {
|
86 |
"inline": {
|
|
|
46 |
"""
|
47 |
fullscreen_drop: Whether to allow fullscreen drop files to the attachments.
|
48 |
|
49 |
+
allow_upload: Whether to allow upload files to the attachments.
|
50 |
+
|
51 |
allow_paste_file: Whether to allow paste file to the attachments.
|
52 |
|
53 |
allow_speech: Whether to allow speech input.
|
|
|
67 |
multiple: Whether to support selected multiple files. IE10+ supported. You can select multiple files with CTRL holding down while multiple is set to be True.
|
68 |
|
69 |
overflow: Behavior when the file list overflows.
|
70 |
+
|
71 |
title: Title of the attachments panel.
|
72 |
|
73 |
+
image_props: Image config, same as [Image](https://ant.design/components/image)
|
74 |
+
|
75 |
placeholder: Placeholder information when there is no file.
|
76 |
"""
|
77 |
fullscreen_drop: Optional[bool] = False
|
78 |
+
allow_upload: Optional[bool] = True
|
79 |
allow_paste_file: Optional[bool] = True
|
80 |
allow_speech: Optional[bool] = False
|
81 |
show_count: Optional[bool] = True
|
|
|
87 |
disabled: Optional[bool] = False
|
88 |
overflow: Literal['wrap', 'scrollX', 'scrollY'] | None = None
|
89 |
title: Optional[str] = "Attachments"
|
90 |
+
image_props: Optional[dict] = None
|
91 |
placeholder: Optional[dict] = field(
|
92 |
default_factory=lambda: {
|
93 |
"inline": {
|
components/pro/multimodal_input/README.md
CHANGED
@@ -46,6 +46,8 @@ class MultimodalInputUploadConfig(GradioModel):
|
|
46 |
"""
|
47 |
fullscreen_drop: Whether to allow fullscreen drop files to the attachments.
|
48 |
|
|
|
|
|
49 |
allow_paste_file: Whether to allow paste file to the attachments.
|
50 |
|
51 |
allow_speech: Whether to allow speech input.
|
@@ -65,11 +67,15 @@ class MultimodalInputUploadConfig(GradioModel):
|
|
65 |
multiple: Whether to support selected multiple files. IE10+ supported. You can select multiple files with CTRL holding down while multiple is set to be True.
|
66 |
|
67 |
overflow: Behavior when the file list overflows.
|
|
|
68 |
title: Title of the attachments panel.
|
69 |
|
|
|
|
|
70 |
placeholder: Placeholder information when there is no file.
|
71 |
"""
|
72 |
fullscreen_drop: Optional[bool] = False
|
|
|
73 |
allow_paste_file: Optional[bool] = True
|
74 |
allow_speech: Optional[bool] = False
|
75 |
show_count: Optional[bool] = True
|
@@ -81,6 +87,7 @@ class MultimodalInputUploadConfig(GradioModel):
|
|
81 |
disabled: Optional[bool] = False
|
82 |
overflow: Literal['wrap', 'scrollX', 'scrollY'] | None = None
|
83 |
title: Optional[str] = "Attachments"
|
|
|
84 |
placeholder: Optional[dict] = field(
|
85 |
default_factory=lambda: {
|
86 |
"inline": {
|
@@ -92,7 +99,6 @@ class MultimodalInputUploadConfig(GradioModel):
|
|
92 |
}
|
93 |
})
|
94 |
|
95 |
-
|
96 |
class MultimodalInputValue(GradioModel):
|
97 |
files: Optional[ListFiles] = None
|
98 |
text: Optional[str] = None
|
|
|
46 |
"""
|
47 |
fullscreen_drop: Whether to allow fullscreen drop files to the attachments.
|
48 |
|
49 |
+
allow_upload: Whether to allow upload files to the attachments.
|
50 |
+
|
51 |
allow_paste_file: Whether to allow paste file to the attachments.
|
52 |
|
53 |
allow_speech: Whether to allow speech input.
|
|
|
67 |
multiple: Whether to support selected multiple files. IE10+ supported. You can select multiple files with CTRL holding down while multiple is set to be True.
|
68 |
|
69 |
overflow: Behavior when the file list overflows.
|
70 |
+
|
71 |
title: Title of the attachments panel.
|
72 |
|
73 |
+
image_props: Image config, same as [Image](https://ant.design/components/image)
|
74 |
+
|
75 |
placeholder: Placeholder information when there is no file.
|
76 |
"""
|
77 |
fullscreen_drop: Optional[bool] = False
|
78 |
+
allow_upload: Optional[bool] = True
|
79 |
allow_paste_file: Optional[bool] = True
|
80 |
allow_speech: Optional[bool] = False
|
81 |
show_count: Optional[bool] = True
|
|
|
87 |
disabled: Optional[bool] = False
|
88 |
overflow: Literal['wrap', 'scrollX', 'scrollY'] | None = None
|
89 |
title: Optional[str] = "Attachments"
|
90 |
+
image_props: Optional[dict] = None
|
91 |
placeholder: Optional[dict] = field(
|
92 |
default_factory=lambda: {
|
93 |
"inline": {
|
|
|
99 |
}
|
100 |
})
|
101 |
|
|
|
102 |
class MultimodalInputValue(GradioModel):
|
103 |
files: Optional[ListFiles] = None
|
104 |
text: Optional[str] = None
|
layout_templates/chatbot/demos/basic.py
CHANGED
@@ -530,7 +530,7 @@ with gr.Blocks(css=css, fill_width=True) as demo:
|
|
530 |
},
|
531 |
items=[{
|
532 |
"label":
|
533 |
-
"
|
534 |
"children": [{
|
535 |
"description":
|
536 |
"Help me with a plan to start a business"
|
@@ -543,7 +543,7 @@ with gr.Blocks(css=css, fill_width=True) as demo:
|
|
543 |
}]
|
544 |
}, {
|
545 |
"label":
|
546 |
-
"
|
547 |
"children": [{
|
548 |
"description":
|
549 |
"Help me write a story with a twist ending"
|
|
|
530 |
},
|
531 |
items=[{
|
532 |
"label":
|
533 |
+
"📅 Make a plan",
|
534 |
"children": [{
|
535 |
"description":
|
536 |
"Help me with a plan to start a business"
|
|
|
543 |
}]
|
544 |
}, {
|
545 |
"label":
|
546 |
+
"🖋 Help me write",
|
547 |
"children": [{
|
548 |
"description":
|
549 |
"Help me write a story with a twist ending"
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
modelscope_studio==1.2.
|
2 |
openai
|
|
|
1 |
+
modelscope_studio==1.2.3
|
2 |
openai
|
src/pyproject.toml
CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
|
|
8 |
|
9 |
[project]
|
10 |
name = "modelscope_studio"
|
11 |
-
version = "1.2.
|
12 |
description = "A third-party component library based on Gradio."
|
13 |
readme = "README.md"
|
14 |
license = "Apache-2.0"
|
|
|
8 |
|
9 |
[project]
|
10 |
name = "modelscope_studio"
|
11 |
+
version = "1.2.3"
|
12 |
description = "A third-party component library based on Gradio."
|
13 |
readme = "README.md"
|
14 |
license = "Apache-2.0"
|