Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
·
da74a1d
1
Parent(s):
73d2fd7
refactor: remove style parameter, 适配 gradio#4374
Browse files- ChuanhuChatbot.py +13 -8
ChuanhuChatbot.py
CHANGED
|
@@ -47,16 +47,17 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 47 |
ok_btn=i18n("好"),
|
| 48 |
), visible=check_update)
|
| 49 |
|
| 50 |
-
with gr.Row(
|
| 51 |
with gr.Column(scale=5):
|
| 52 |
with gr.Row():
|
| 53 |
-
chatbot = gr.Chatbot(label="Chuanhu Chat", elem_id="chuanhu_chatbot", latex_delimiters=latex_delimiters_set
|
| 54 |
with gr.Row():
|
| 55 |
with gr.Column(min_width=225, scale=12):
|
| 56 |
user_input = gr.Textbox(
|
| 57 |
elem_id="user_input_tb",
|
| 58 |
-
show_label=False, placeholder=i18n("在这里输入")
|
| 59 |
-
|
|
|
|
| 60 |
with gr.Column(min_width=42, scale=1):
|
| 61 |
submitBtn = gr.Button(value="", variant="primary", elem_id="submit_btn")
|
| 62 |
cancelBtn = gr.Button(value="", variant="secondary", visible=False, elem_id="cancel_btn")
|
|
@@ -116,7 +117,8 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 116 |
label="System prompt",
|
| 117 |
value=INITIAL_SYSTEM_PROMPT,
|
| 118 |
lines=10,
|
| 119 |
-
|
|
|
|
| 120 |
with gr.Accordion(label=i18n("加载Prompt模板"), open=True):
|
| 121 |
with gr.Column():
|
| 122 |
with gr.Row():
|
|
@@ -126,7 +128,8 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 126 |
choices=get_template_names(plain=True),
|
| 127 |
multiselect=False,
|
| 128 |
value=get_template_names(plain=True)[0],
|
| 129 |
-
|
|
|
|
| 130 |
with gr.Column(scale=1):
|
| 131 |
templateRefreshBtn = gr.Button(i18n("🔄 刷新"))
|
| 132 |
with gr.Row():
|
|
@@ -137,7 +140,8 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 137 |
get_template_names(plain=True)[0], mode=1
|
| 138 |
),
|
| 139 |
multiselect=False,
|
| 140 |
-
|
|
|
|
| 141 |
|
| 142 |
with gr.Tab(label=i18n("保存/加载")):
|
| 143 |
with gr.Accordion(label=i18n("保存/加载对话历史记录"), open=True):
|
|
@@ -161,7 +165,8 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 161 |
placeholder=i18n("设置文件名: 默认为.json,可选为.md"),
|
| 162 |
label=i18n("设置保存文件名"),
|
| 163 |
value=i18n("对话历史记录"),
|
| 164 |
-
|
|
|
|
| 165 |
with gr.Column(scale=1):
|
| 166 |
saveHistoryBtn = gr.Button(i18n("💾 保存对话"))
|
| 167 |
exportMarkdownBtn = gr.Button(i18n("📝 导出为Markdown"))
|
|
|
|
| 47 |
ok_btn=i18n("好"),
|
| 48 |
), visible=check_update)
|
| 49 |
|
| 50 |
+
with gr.Row(equal_height=True):
|
| 51 |
with gr.Column(scale=5):
|
| 52 |
with gr.Row():
|
| 53 |
+
chatbot = gr.Chatbot(label="Chuanhu Chat", elem_id="chuanhu_chatbot", latex_delimiters=latex_delimiters_set, height=700)
|
| 54 |
with gr.Row():
|
| 55 |
with gr.Column(min_width=225, scale=12):
|
| 56 |
user_input = gr.Textbox(
|
| 57 |
elem_id="user_input_tb",
|
| 58 |
+
show_label=False, placeholder=i18n("在这里输入"),
|
| 59 |
+
container=False
|
| 60 |
+
)
|
| 61 |
with gr.Column(min_width=42, scale=1):
|
| 62 |
submitBtn = gr.Button(value="", variant="primary", elem_id="submit_btn")
|
| 63 |
cancelBtn = gr.Button(value="", variant="secondary", visible=False, elem_id="cancel_btn")
|
|
|
|
| 117 |
label="System prompt",
|
| 118 |
value=INITIAL_SYSTEM_PROMPT,
|
| 119 |
lines=10,
|
| 120 |
+
container=False,
|
| 121 |
+
)
|
| 122 |
with gr.Accordion(label=i18n("加载Prompt模板"), open=True):
|
| 123 |
with gr.Column():
|
| 124 |
with gr.Row():
|
|
|
|
| 128 |
choices=get_template_names(plain=True),
|
| 129 |
multiselect=False,
|
| 130 |
value=get_template_names(plain=True)[0],
|
| 131 |
+
container=False,
|
| 132 |
+
)
|
| 133 |
with gr.Column(scale=1):
|
| 134 |
templateRefreshBtn = gr.Button(i18n("🔄 刷新"))
|
| 135 |
with gr.Row():
|
|
|
|
| 140 |
get_template_names(plain=True)[0], mode=1
|
| 141 |
),
|
| 142 |
multiselect=False,
|
| 143 |
+
container=False,
|
| 144 |
+
)
|
| 145 |
|
| 146 |
with gr.Tab(label=i18n("保存/加载")):
|
| 147 |
with gr.Accordion(label=i18n("保存/加载对话历史记录"), open=True):
|
|
|
|
| 165 |
placeholder=i18n("设置文件名: 默认为.json,可选为.md"),
|
| 166 |
label=i18n("设置保存文件名"),
|
| 167 |
value=i18n("对话历史记录"),
|
| 168 |
+
container=False,
|
| 169 |
+
)
|
| 170 |
with gr.Column(scale=1):
|
| 171 |
saveHistoryBtn = gr.Button(i18n("💾 保存对话"))
|
| 172 |
exportMarkdownBtn = gr.Button(i18n("📝 导出为Markdown"))
|