Spaces:
Running
Running
Update
Browse files- app.py +9 -0
- components/antdx/actions/README-zh_CN.md +7 -0
- components/antdx/actions/README.md +7 -0
- components/antdx/actions/app.py +6 -0
- components/antdx/actions/demos/basic.py +56 -0
- requirements.txt +1 -1
- src/pyproject.toml +3 -1
app.py
CHANGED
@@ -462,6 +462,15 @@ antdx_menu_items = [{
|
|
462 |
"label": get_text("ThoughtChain", "ThoughtChain 思考链"),
|
463 |
"key": "thought_chain"
|
464 |
}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
}, {
|
466 |
"label":
|
467 |
get_text("Tools", "工具"),
|
|
|
462 |
"label": get_text("ThoughtChain", "ThoughtChain 思考链"),
|
463 |
"key": "thought_chain"
|
464 |
}]
|
465 |
+
}, {
|
466 |
+
"label":
|
467 |
+
get_text("Feedback", "反馈"),
|
468 |
+
"type":
|
469 |
+
"group",
|
470 |
+
"children": [{
|
471 |
+
"label": get_text("Actions", "Actions 操作列表"),
|
472 |
+
"key": "actions"
|
473 |
+
}]
|
474 |
}, {
|
475 |
"label":
|
476 |
get_text("Tools", "工具"),
|
components/antdx/actions/README-zh_CN.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Actions
|
2 |
+
|
3 |
+
Used for quickly configuring required action buttons or features in some AI scenarios.See [Ant Design X](https://x.ant.design/components/actions/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
components/antdx/actions/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Actions
|
2 |
+
|
3 |
+
Used for quickly configuring required action buttons or features in some AI scenarios.See [Ant Design X](https://x.ant.design/components/actions/) for more information.
|
4 |
+
|
5 |
+
## Examples
|
6 |
+
|
7 |
+
<demo name="basic"></demo>
|
components/antdx/actions/app.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from helper.Docs import Docs
|
2 |
+
|
3 |
+
docs = Docs(__file__)
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
docs.render().queue().launch()
|
components/antdx/actions/demos/basic.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import modelscope_studio.components.antd as antd
|
3 |
+
import modelscope_studio.components.antdx as antdx
|
4 |
+
import modelscope_studio.components.base as ms
|
5 |
+
|
6 |
+
|
7 |
+
def on_click(e: gr.EventData):
|
8 |
+
keyPath = ','.join(e._data["payload"][0]["keyPath"])
|
9 |
+
key = e._data["payload"][0]["key"]
|
10 |
+
gr.Info('keyPath: ' + keyPath + ', key: ' + key)
|
11 |
+
|
12 |
+
|
13 |
+
def on_delete():
|
14 |
+
gr.Success("Delete success")
|
15 |
+
|
16 |
+
|
17 |
+
with gr.Blocks() as demo:
|
18 |
+
with ms.Application():
|
19 |
+
with antdx.XProvider():
|
20 |
+
with antdx.Actions() as actions:
|
21 |
+
with antdx.Actions.Item(key="retry", label="Retry"):
|
22 |
+
with ms.Slot("icon"):
|
23 |
+
antd.Icon("RedoOutlined")
|
24 |
+
with antdx.Actions.Item(key="copy", label="Copy"):
|
25 |
+
with ms.Slot("icon"):
|
26 |
+
antd.Icon("CopyOutlined")
|
27 |
+
antd.Divider("More Menu Items")
|
28 |
+
with antdx.Actions() as actions2:
|
29 |
+
with antdx.Actions.Item(key="retry", label="Retry"):
|
30 |
+
with ms.Slot("icon"):
|
31 |
+
antd.Icon("RedoOutlined")
|
32 |
+
with antdx.Actions.Item(key="copy", label="Copy"):
|
33 |
+
with ms.Slot("icon"):
|
34 |
+
antd.Icon("CopyOutlined")
|
35 |
+
with antdx.Actions.Item(key="more"):
|
36 |
+
with antdx.Actions.Item(key="share", label="Share"):
|
37 |
+
with ms.Slot("icon"):
|
38 |
+
antd.Icon("ShareAltOutlined")
|
39 |
+
antdx.Actions.Item(key="qq", label="QQ")
|
40 |
+
antdx.Actions.Item(key="wechat", label="WeChat")
|
41 |
+
antdx.Actions.Item(key="import", label="Import")
|
42 |
+
with antdx.Actions.Item(
|
43 |
+
key="delete", label="Delete",
|
44 |
+
danger=True) as actions_delete_item:
|
45 |
+
with ms.Slot("icon"):
|
46 |
+
antd.Icon("DeleteOutlined")
|
47 |
+
with antdx.Actions.Item(key="clear", label="Clear"):
|
48 |
+
with ms.Slot("icon"):
|
49 |
+
antd.Icon("ClearOutlined")
|
50 |
+
|
51 |
+
actions.click(fn=on_click)
|
52 |
+
actions2.click(fn=on_click)
|
53 |
+
actions_delete_item.item_click(fn=on_delete)
|
54 |
+
|
55 |
+
if __name__ == "__main__":
|
56 |
+
demo.queue().launch()
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
modelscope_studio==1.4.
|
2 |
openai
|
|
|
1 |
+
modelscope_studio==1.4.1
|
2 |
openai
|
src/pyproject.toml
CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
|
|
8 |
|
9 |
[project]
|
10 |
name = "modelscope_studio"
|
11 |
-
version = "1.4.
|
12 |
description = "A third-party component library based on Gradio."
|
13 |
readme = "README.md"
|
14 |
license = "Apache-2.0"
|
@@ -213,6 +213,8 @@ artifacts = [
|
|
213 |
"/backend/modelscope_studio/components/antdx/conversations/templates",
|
214 |
"/backend/modelscope_studio/components/antdx/conversations/item/templates",
|
215 |
"/backend/modelscope_studio/components/antdx/attachments/templates",
|
|
|
|
|
216 |
"/backend/modelscope_studio/components/antdx/prompts/templates",
|
217 |
"/backend/modelscope_studio/components/antdx/prompts/item/templates",
|
218 |
"/backend/modelscope_studio/components/antdx/sender/templates",
|
|
|
8 |
|
9 |
[project]
|
10 |
name = "modelscope_studio"
|
11 |
+
version = "1.4.1"
|
12 |
description = "A third-party component library based on Gradio."
|
13 |
readme = "README.md"
|
14 |
license = "Apache-2.0"
|
|
|
213 |
"/backend/modelscope_studio/components/antdx/conversations/templates",
|
214 |
"/backend/modelscope_studio/components/antdx/conversations/item/templates",
|
215 |
"/backend/modelscope_studio/components/antdx/attachments/templates",
|
216 |
+
"/backend/modelscope_studio/components/antdx/actions/templates",
|
217 |
+
"/backend/modelscope_studio/components/antdx/actions/item/templates",
|
218 |
"/backend/modelscope_studio/components/antdx/prompts/templates",
|
219 |
"/backend/modelscope_studio/components/antdx/prompts/item/templates",
|
220 |
"/backend/modelscope_studio/components/antdx/sender/templates",
|