Update app.py
Browse files
app.py
CHANGED
@@ -143,9 +143,12 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
143 |
except Exception as e:
|
144 |
raise ValueError(f'Error calling Claude API: {str(e)}')
|
145 |
|
|
|
146 |
with ms.Application() as app:
|
147 |
with antd.ConfigProvider():
|
148 |
-
|
|
|
|
|
149 |
with antd.Col(span=24, md=8):
|
150 |
with antd.Flex(vertical=True, gap="middle", wrap=True):
|
151 |
header = gr.HTML(f"""
|
@@ -163,41 +166,48 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
163 |
btn = antd.Button("send", type="primary", size="large")
|
164 |
clear_btn = antd.Button("clear history", type="default", size="large")
|
165 |
|
166 |
-
|
167 |
-
with antd.Flex(gap="small", wrap=True):
|
168 |
-
with ms.Each(DEMO_LIST):
|
169 |
-
with antd.Card(hoverable=True, as_item="card") as demoCard:
|
170 |
-
antd.CardMeta()
|
171 |
-
demoCard.click(demo_card_click, outputs=[input])
|
172 |
-
|
173 |
-
# Modal과 Drawer 컴포넌트들
|
174 |
-
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
175 |
-
systemPromptInput = antd.InputTextarea(
|
176 |
-
SystemPrompt, auto_size=True)
|
177 |
-
|
178 |
-
with antd.Drawer(open=False, title="code", placement="left", width="750px") as code_drawer:
|
179 |
-
code_output = legacy.Markdown()
|
180 |
-
|
181 |
-
with antd.Drawer(open=False, title="history", placement="left", width="900px") as history_drawer:
|
182 |
-
history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
|
183 |
-
|
184 |
with antd.Col(span=24, md=16):
|
185 |
with ms.Div(elem_classes="right_panel"):
|
186 |
-
# 우측 상단에
|
187 |
-
with antd.
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
193 |
gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
194 |
with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
195 |
with antd.Tabs.Item(key="empty"):
|
196 |
empty = antd.Empty(description="empty input", elem_classes="right_content")
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
# 버튼 이벤트 핸들러
|
203 |
settingPromptBtn.click(lambda: gr.update(
|
|
|
143 |
except Exception as e:
|
144 |
raise ValueError(f'Error calling Claude API: {str(e)}')
|
145 |
|
146 |
+
|
147 |
with ms.Application() as app:
|
148 |
with antd.ConfigProvider():
|
149 |
+
# 메인 컨텐츠 영역
|
150 |
+
with antd.Row(gutter=[32, 12], style={"margin-bottom": "24px"}) as layout:
|
151 |
+
# 좌측 패널
|
152 |
with antd.Col(span=24, md=8):
|
153 |
with antd.Flex(vertical=True, gap="middle", wrap=True):
|
154 |
header = gr.HTML(f"""
|
|
|
166 |
btn = antd.Button("send", type="primary", size="large")
|
167 |
clear_btn = antd.Button("clear history", type="default", size="large")
|
168 |
|
169 |
+
# 우측 패널
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
with antd.Col(span=24, md=16):
|
171 |
with ms.Div(elem_classes="right_panel"):
|
172 |
+
# Setting 버튼들을 우측 상단에 배치
|
173 |
+
with antd.Row(justify="end", elem_classes="setting-buttons-container"):
|
174 |
+
with antd.Space(size="small"):
|
175 |
+
settingPromptBtn = antd.Button(
|
176 |
+
"⚙️ set system Prompt", type="default")
|
177 |
+
codeBtn = antd.Button("🧑💻 view code", type="default")
|
178 |
+
historyBtn = antd.Button("📜 history", type="default")
|
179 |
+
|
180 |
gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
181 |
with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
182 |
with antd.Tabs.Item(key="empty"):
|
183 |
empty = antd.Empty(description="empty input", elem_classes="right_content")
|
184 |
+
with antd.Tabs.Item(key="loading"):
|
185 |
+
loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
|
186 |
+
with antd.Tabs.Item(key="render"):
|
187 |
+
sandbox = gr.HTML(elem_classes="html_content")
|
188 |
+
|
189 |
+
# Examples 섹션을 별도의 컨테이너로 분리
|
190 |
+
with antd.Row(justify="center", elem_classes="examples-container"):
|
191 |
+
with antd.Col(span=24):
|
192 |
+
antd.Divider("examples")
|
193 |
+
with antd.Row(gutter=[16, 16], justify="start"):
|
194 |
+
with ms.Each(DEMO_LIST):
|
195 |
+
with antd.Col(xs=24, sm=12, md=8): # 반응형 그리드
|
196 |
+
with antd.Card(hoverable=True, as_item="card") as demoCard:
|
197 |
+
antd.CardMeta()
|
198 |
+
demoCard.click(demo_card_click, outputs=[input])
|
199 |
+
|
200 |
+
# Modal과 Drawer 컴포넌트들
|
201 |
+
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
202 |
+
systemPromptInput = antd.InputTextarea(
|
203 |
+
SystemPrompt, auto_size=True)
|
204 |
+
|
205 |
+
with antd.Drawer(open=False, title="code", placement="left", width="750px") as code_drawer:
|
206 |
+
code_output = legacy.Markdown()
|
207 |
+
|
208 |
+
with antd.Drawer(open=False, title="history", placement="left", width="900px") as history_drawer:
|
209 |
+
history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
|
210 |
+
|
211 |
|
212 |
# 버튼 이벤트 핸들러
|
213 |
settingPromptBtn.click(lambda: gr.update(
|