Update app.py
Browse files
app.py
CHANGED
@@ -73,8 +73,6 @@ def demo_card_click(e: gr.EventData):
|
|
73 |
return DEMO_CACHE[index]
|
74 |
|
75 |
|
76 |
-
|
77 |
-
|
78 |
with gr.Blocks(css_paths="app.css") as demo:
|
79 |
history = gr.State([])
|
80 |
setting = gr.State({
|
@@ -107,43 +105,16 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
107 |
with antd.Card(hoverable=True, as_item="card") as demoCard:
|
108 |
antd.CardMeta()
|
109 |
demoCard.click(demo_card_click, outputs=[input])
|
110 |
-
|
111 |
-
antd.Divider("setting")
|
112 |
|
113 |
-
|
|
|
|
|
|
|
114 |
settingPromptBtn = antd.Button(
|
115 |
"βοΈ set system Prompt", type="default")
|
116 |
codeBtn = antd.Button("π§βπ» view code", type="default")
|
117 |
historyBtn = antd.Button("π history", type="default")
|
118 |
-
|
119 |
-
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
120 |
-
systemPromptInput = antd.InputTextarea(
|
121 |
-
SystemPrompt, auto_size=True)
|
122 |
-
|
123 |
-
settingPromptBtn.click(lambda: gr.update(
|
124 |
-
open=True), inputs=[], outputs=[system_prompt_modal])
|
125 |
-
system_prompt_modal.ok(lambda input: ({"system": input}, gr.update(
|
126 |
-
open=False)), inputs=[systemPromptInput], outputs=[setting, system_prompt_modal])
|
127 |
-
system_prompt_modal.cancel(lambda: gr.update(
|
128 |
-
open=False), outputs=[system_prompt_modal])
|
129 |
-
|
130 |
-
with antd.Drawer(open=False, title="code", placement="left", width="750px") as code_drawer:
|
131 |
-
code_output = legacy.Markdown()
|
132 |
-
|
133 |
-
codeBtn.click(lambda: gr.update(open=True),
|
134 |
-
inputs=[], outputs=[code_drawer])
|
135 |
-
code_drawer.close(lambda: gr.update(
|
136 |
-
open=False), inputs=[], outputs=[code_drawer])
|
137 |
-
|
138 |
-
with antd.Drawer(open=False, title="history", placement="left", width="900px") as history_drawer:
|
139 |
-
history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
|
140 |
-
|
141 |
-
historyBtn.click(history_render, inputs=[history], outputs=[history_drawer, history_output])
|
142 |
-
history_drawer.close(lambda: gr.update(
|
143 |
-
open=False), inputs=[], outputs=[history_drawer])
|
144 |
-
|
145 |
-
with antd.Col(span=24, md=16):
|
146 |
-
with ms.Div(elem_classes="right_panel"):
|
147 |
gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
148 |
with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
149 |
with antd.Tabs.Item(key="empty"):
|
|
|
73 |
return DEMO_CACHE[index]
|
74 |
|
75 |
|
|
|
|
|
76 |
with gr.Blocks(css_paths="app.css") as demo:
|
77 |
history = gr.State([])
|
78 |
setting = gr.State({
|
|
|
105 |
with antd.Card(hoverable=True, as_item="card") as demoCard:
|
106 |
antd.CardMeta()
|
107 |
demoCard.click(demo_card_click, outputs=[input])
|
|
|
|
|
108 |
|
109 |
+
with antd.Col(span=24, md=16):
|
110 |
+
with ms.Div(elem_classes="right_panel"):
|
111 |
+
# μ°μΈ‘ μλ¨μ setting λ²νΌλ€ μΆκ°
|
112 |
+
with antd.Flex(justify="end", gap="small", style={"padding": "10px"}):
|
113 |
settingPromptBtn = antd.Button(
|
114 |
"βοΈ set system Prompt", type="default")
|
115 |
codeBtn = antd.Button("π§βπ» view code", type="default")
|
116 |
historyBtn = antd.Button("π history", type="default")
|
117 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
119 |
with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
120 |
with antd.Tabs.Item(key="empty"):
|