tommyaie99 commited on
Commit
6776e04
·
1 Parent(s): 90c1674

improve frontend

Browse files
Files changed (1) hide show
  1. app.py +102 -67
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
- with gr.Blocks(theme=gr.themes.Soft(), title="LangGraph Multi-Agent Chat") as demo:
108
- session_state = gr.State({})
109
-
110
- gr.Markdown(
111
- """
112
- # LangGraph Multi-Agent Project Manager
113
-
114
- Interact with a multi-agent system powered by LangGraph.
115
- You can assign tasks related to Trello and Github.
116
- The system can be interrupted for human feedback when it needs to use a tool.
117
- """
 
 
 
 
 
118
  )
 
 
 
 
 
 
 
 
 
119
 
120
- chatbot = gr.Chatbot(
121
- [],
122
- elem_id="chatbot",
123
- bubble_full_width=False,
124
- height=600,
125
- label="Multi-Agent Chat",
126
- show_label=False,
127
- )
128
 
129
- # --- FIX: Added an accordion for API keys and configuration ---
130
- with gr.Accordion("API Configuration", open=True):
131
- gr.Markdown(
132
- "Please enter your credentials. The agent will be configured when you send your first message."
133
- )
134
- github_repo = gr.Textbox(
135
- label="GitHub Repo",
136
- placeholder="e.g., username/repository",
137
- info="The target repository for GitHub operations.",
138
- )
139
- github_token = gr.Textbox(
140
- label="GitHub Token",
141
- placeholder="ghp_xxxxxxxxxxxx",
142
- type="password",
143
- info="A fine-grained personal access token.",
144
- )
145
- trello_api = gr.Textbox(
146
- label="Trello API Key",
147
- placeholder="Your Trello API key",
148
- info="Your API key from trello.com/power-ups/admin.",
149
- )
150
- trello_token = gr.Textbox(
151
- label="Trello Token",
152
- placeholder="Your Trello token",
153
- type="password",
154
- info="A token generated from your Trello account.",
155
- )
156
- hf_token = gr.Textbox(
157
- label="Hugging Face Token",
158
- placeholder="hf_xxxxxxxxxxxx",
159
- type="password",
160
- info="Used for tools requiring Hugging Face models.",
161
- )
162
-
163
- gr.ChatInterface(
164
- fn=chat_logic,
165
- chatbot=chatbot,
166
- additional_inputs=[
167
- session_state,
168
- github_repo,
169
- github_token,
170
- trello_api,
171
- trello_token,
172
- hf_token,
173
- ],
174
- title=None,
175
- description=None,
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)