Commit
·
6776e04
1
Parent(s):
90c1674
improve frontend
Browse files
app.py
CHANGED
|
@@ -104,76 +104,111 @@ def create_gradio_app():
|
|
| 104 |
"""Creates and launches the Gradio web application."""
|
| 105 |
print("Launching Gradio app...")
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
show_label=False,
|
| 127 |
-
)
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
demo.queue()
|
| 179 |
demo.launch(debug=True)
|
|
|
|
| 104 |
"""Creates and launches the Gradio web application."""
|
| 105 |
print("Launching Gradio app...")
|
| 106 |
|
| 107 |
+
AVATAR_BOT = "pmcp/assets/pmcp_bot.png"
|
| 108 |
+
|
| 109 |
+
theme = gr.themes.Soft(
|
| 110 |
+
primary_hue="green",
|
| 111 |
+
secondary_hue="teal",
|
| 112 |
+
neutral_hue="slate",
|
| 113 |
+
font=["Arial", "sans-serif"]
|
| 114 |
+
).set(
|
| 115 |
+
body_background_fill="linear-gradient(135deg,#e8f5e9 0%,#f4fcf4 100%)",
|
| 116 |
+
block_background_fill="white",
|
| 117 |
+
block_border_width="1px",
|
| 118 |
+
block_shadow="*shadow_drop_lg",
|
| 119 |
+
button_primary_background_fill="#02B900",
|
| 120 |
+
button_primary_text_color="white",
|
| 121 |
+
button_secondary_background_fill="#35C733",
|
| 122 |
+
button_secondary_text_color="white",
|
| 123 |
)
|
| 124 |
+
|
| 125 |
+
# Extra CSS (font, bubble colors, subtle animations)
|
| 126 |
+
custom_css = """
|
| 127 |
+
body { font-family: 'Inter', sans-serif; }
|
| 128 |
+
#header { text-align:center; margin-bottom: 1.25rem; }
|
| 129 |
+
#header h1 { font-size:2.25rem; font-weight:700; background:linear-gradient(90deg,#02B900 0%,#35C733 100%); -webkit-background-clip:text; color:transparent; }
|
| 130 |
+
#chatbot .message.user { background:#E8FBE8; }
|
| 131 |
+
#chatbot .message.assistant { background:#F9FDF9; }
|
| 132 |
+
"""
|
| 133 |
|
| 134 |
+
with gr.Blocks( theme=theme,
|
| 135 |
+
title="LangGraph Multi-Agent Chat",
|
| 136 |
+
css=custom_css,
|
| 137 |
+
fill_height=True,) as demo:
|
| 138 |
+
|
| 139 |
+
session_state = gr.State({})
|
|
|
|
|
|
|
| 140 |
|
| 141 |
+
gr.HTML(
|
| 142 |
+
"""
|
| 143 |
+
<div id='header'>
|
| 144 |
+
<h1>PMCP — Agentic Project Management</h1>
|
| 145 |
+
<p class='tagline'>Manage your projects with PMCP, a multi-agent system capable to interact with Trello and GitHub.</p>
|
| 146 |
+
</div>
|
| 147 |
+
"""
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
with gr.Row():
|
| 152 |
+
with gr.Column(scale=1):
|
| 153 |
+
with gr.Accordion("🔑 API Configuration", open=True):
|
| 154 |
+
gr.Markdown(
|
| 155 |
+
"Please enter your credentials. The agent will be configured when you send your first message."
|
| 156 |
+
)
|
| 157 |
+
github_repo = gr.Textbox(
|
| 158 |
+
label="📁 GitHub Repo",
|
| 159 |
+
placeholder="e.g., username/repository",
|
| 160 |
+
info="The target repository for GitHub operations.",
|
| 161 |
+
)
|
| 162 |
+
github_token = gr.Textbox(
|
| 163 |
+
label="🔐 GitHub Token",
|
| 164 |
+
placeholder="ghp_xxxxxxxxxxxx",
|
| 165 |
+
type="password",
|
| 166 |
+
info="A fine-grained personal access token.",
|
| 167 |
+
)
|
| 168 |
+
trello_api = gr.Textbox(
|
| 169 |
+
label="🗂️ Trello API Key",
|
| 170 |
+
placeholder="Your Trello API key",
|
| 171 |
+
info="Your API key from trello.com/power-ups/admin.",
|
| 172 |
+
)
|
| 173 |
+
trello_token = gr.Textbox(
|
| 174 |
+
label="🔐 Trello Token",
|
| 175 |
+
placeholder="Your Trello token",
|
| 176 |
+
type="password",
|
| 177 |
+
info="A token generated from your Trello account.",
|
| 178 |
+
)
|
| 179 |
+
hf_token = gr.Textbox(
|
| 180 |
+
label="🤗 Hugging Face Token",
|
| 181 |
+
placeholder="hf_xxxxxxxxxxxx",
|
| 182 |
+
type="password",
|
| 183 |
+
info="Used for tools requiring Hugging Face models.",
|
| 184 |
+
)
|
| 185 |
+
|
| 186 |
+
with gr.Column(scale=2):
|
| 187 |
+
chatbot = gr.Chatbot(
|
| 188 |
+
[],
|
| 189 |
+
elem_id="chatbot",
|
| 190 |
+
bubble_full_width=False,
|
| 191 |
+
height=600,
|
| 192 |
+
label="Multi-Agent Chat",
|
| 193 |
+
show_label=False,
|
| 194 |
+
avatar_images=(None, AVATAR_BOT)
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
gr.ChatInterface(
|
| 199 |
+
fn=chat_logic,
|
| 200 |
+
chatbot=chatbot,
|
| 201 |
+
additional_inputs=[
|
| 202 |
+
session_state,
|
| 203 |
+
github_repo,
|
| 204 |
+
github_token,
|
| 205 |
+
trello_api,
|
| 206 |
+
trello_token,
|
| 207 |
+
hf_token,
|
| 208 |
+
],
|
| 209 |
+
title=None,
|
| 210 |
+
description="Ask **PMCP** to create tickets, open PRs, or coordinate tasks across your boards and repositories.",
|
| 211 |
+
)
|
| 212 |
|
| 213 |
demo.queue()
|
| 214 |
demo.launch(debug=True)
|