changed ui
Browse files331 unmodified lines33233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942011 unmodified lines43243343443543643743827 unmodified lines46646746846947047124 unmodified lines49649749849950050150250350450550650750850951051151251351451551639 unmodified lines55655755855956056158 unmodified lines62062162262362462562662762862963063163244 unmodified lines677678679680681331 unmodified lines# ---------- CSS ----------css = """/* Full screen container adjustments */.gradio-container {max-width: 100% !important;padding: 0 !important;}#coder-artifacts {min-height: 100vh;padding: 1rem;}/* Output container adjustments */#coder-artifacts .output-empty,#coder-artifacts .output-loading {display: flex;flex-direction: column;align-items: center;justify-content: center;width: 100%;min-height: 85vh;}#coder-artifacts #output-container {height: 85vh !important;}#coder-artifacts #output-container .ms-gr-ant-tabs-content,#coder-artifacts #output-container .ms-gr-ant-tabs-tabpane {height: 100%;}#coder-artifacts .output-html {display: flex;flex-direction: column;width: 100%;height: 100%;min-height: 85vh;}#coder-artifacts .output-html > iframe {flex: 1;min-height: 85vh;}/* Code drawer adjustments */#coder-artifacts-code-drawer {height: 100vh !important;}#coder-artifacts-code-drawer .output-code {flex: 1;height: 100%;}#coder-artifacts-code-drawer .output-code .ms-gr-ant-spin-nested-loading {min-height: 100%;}/* History drawer adjustments */.history_chatbot {height: 85vh !important;}/* Responsive adjustments */@media (max-width: 768px) {#coder-artifacts {padding: 0.5rem;}#coder-artifacts #output-container,#coder-artifacts .output-html,#coder-artifacts .output-html > iframe {min-height: 70vh;}}"""# ---------- GRADIO UI ----------with gr.Blocks(css=css) as demo:# Global Statestate = gr.State({"system_prompt": "", "history": []})with ms.Application(elem_id="coder-artifacts") as app:with antd.ConfigProvider(theme=DEFAULT_THEME, locale=DEFAULT_LOCALE):with ms.AutoLoading():with antd.Row(gutter=[32, 12],elem_style=dict(marginTop=20),11 unmodified lines# height=200,# preview=False)antd.Typography.Title("My-v0",level=1,elem_style=dict(fontSize=24))# Input27 unmodified lineswith antd.Space(size="small",wrap=True,elem_id="settings-area"):history_btn = antd.Button("📜 History",type="default",24 unmodified lineswith antd.Col(span=24, md=16):with antd.Card(title="Output",elem_style=dict(height="85vh",display="flex",flexDirection="column",margin=0,borderRadius="8px",boxShadow="0 4px 6px -1px rgb(0 0 0 / 0.1)"),styles=dict(body=dict(height=0,flex=1,padding=0)),elem_id="output-container"):# Output Container Extrawith ms.Slot("extra"):39 unmodified linestitle="System Prompt",width="800px") as system_prompt_modal:system_prompt_input = antd.Input.Textarea(value="",size="large",placeholder="Enter your system prompt here",58 unmodified linesdescription="You can change chat history here.",get_target="() => document.querySelector('#settings-area')")# Event Handler wiringgr.on(fn=GradioEvents.close_modal,triggers=[usage_tour.close, usage_tour.finish],outputs=[usage_tour])tour_btn.click(fn=GradioEvents.open_modal, outputs=[usage_tour])system_prompt_modal.ok(GradioEvents.update_system_prompt,inputs=[system_prompt_input, state],outputs=[state]).then(fn=GradioEvents.close_modal,44 unmodified linesoutputs=[output_code_drawer])if __name__ == "__main__":# tune queue params as you likedemo.queue(default_concurrency_limit=10, max_size=50).launch(ssr_mode=False, max_threads=100,pwa=True)331 unmodified lines33233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137211 unmodified lines38438538638738838939027 unmodified lines41841942042142242342442524 unmodified lines45045145245345445545645745845939 unmodified lines49950050150250350450558 unmodified lines56456556656756856957057157257357457557657757844 unmodified lines623624625626627331 unmodified lines# ---------- CSS ----------css = """#coder-artifacts .output-empty,.output-loading {display: flex;flex-direction: column;align-items: center;justify-content: center;width: 100%;min-height: 680px;}#coder-artifacts #output-container .ms-gr-ant-tabs-content,.ms-gr-ant-tabs-tabpane {height: 100%;}#coder-artifacts .output-html {display: flex;flex-direction: column;width: 100%;min-height: 680px;max-height: 1200px;}#coder-artifacts .output-html > iframe {flex: 1;}#coder-artifacts-code-drawer .output-code {flex:1;}#coder-artifacts-code-drawer .output-code .ms-gr-ant-spin-nested-loading {min-height: 100%;}"""with gr.Blocks(css=css) as demo:# Global Statestate = gr.State({"system_prompt": "", "history": []})with ms.Application(elem_id="coder-artifacts") as app:with antd.ConfigProvider(theme=DEFAULT_THEME, locale=DEFAULT_LOCALE):with ms.AutoLoading():with antd.Row(gutter=[32, 12],elem_style=dict(marginTop=20),11 unmodified lines# height=200,# preview=False)antd.Typography.Title("My-v0.dev",level=1,elem_style=dict(fontSize=24))# Input27 unmodified lineswith antd.Space(size="small",wrap=True,elem_id="settings-area"):# system_prompt_btn = antd.Button(# "⚙️ Set System Prompt", type="default")history_btn = antd.Button("📜 History",type="default",24 unmodified lineswith antd.Col(span=24, md=16):with antd.Card(title="Output",elem_style=dict(height="100%",display="flex",flexDirection="column"),styles=dict(body=dict(height=0, flex=1)),elem_id="output-container"):# Output Container Extrawith ms.Slot("extra"):39 unmodified linestitle="System Prompt",width="800px") as system_prompt_modal:system_prompt_input = antd.Input.Textarea(# SYSTEM_PROMPT,value="",size="large",placeholder="Enter your system prompt here",58 unmodified linesdescription="You can change chat history here.",get_target="() => document.querySelector('#settings-area')")# Event Handlergr.on(fn=GradioEvents.close_modal,triggers=[usage_tour.close, usage_tour.finish],outputs=[usage_tour])tour_btn.click(fn=GradioEvents.open_modal, outputs=[usage_tour])# system_prompt_btn.click(fn=GradioEvents.open_modal,# outputs=[system_prompt_modal])system_prompt_modal.ok(GradioEvents.update_system_prompt,inputs=[system_prompt_input, state],outputs=[state]).then(fn=GradioEvents.close_modal,44 unmodified linesoutputs=[output_code_drawer])if __name__ == "__main__":demo.queue(default_concurrency_limit=100,max_size=100).launch(ssr_mode=False, max_threads=100)
app.py+31-85