Commit
·
7d26e2d
1
Parent(s):
417d245
commit
Browse files
app.py
CHANGED
@@ -71,44 +71,84 @@ def create_interface():
|
|
71 |
border-radius: 8px;
|
72 |
margin-bottom: 1rem;
|
73 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
"""
|
75 |
) as interface:
|
76 |
|
77 |
gr.HTML("""
|
78 |
<div class="header">
|
79 |
<h1>Code Gen Prompt Reformatter</h1>
|
80 |
-
<p>Text
|
81 |
</div>
|
82 |
""")
|
83 |
|
84 |
-
with gr.
|
85 |
-
with gr.
|
86 |
-
api_key_input = gr.Textbox(
|
87 |
-
label="OpenAI API Key",
|
88 |
-
placeholder="sk-...",
|
89 |
-
type="password",
|
90 |
-
info="Your API key is not stored and only used for this session"
|
91 |
-
)
|
92 |
-
|
93 |
-
rough_draft_input = gr.Textbox(
|
94 |
-
label="Rough Draft",
|
95 |
-
placeholder="Enter your rough draft describing the desired functionalities of the AI code generation agent...",
|
96 |
-
lines=10,
|
97 |
-
max_lines=20
|
98 |
-
)
|
99 |
-
|
100 |
with gr.Row():
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
-
with gr.
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
show_copy_button=True,
|
110 |
-
interactive=False
|
|
|
111 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
# Event handlers
|
114 |
submit_btn.click(
|
|
|
71 |
border-radius: 8px;
|
72 |
margin-bottom: 1rem;
|
73 |
}
|
74 |
+
.system-prompt-display {
|
75 |
+
background-color: #f8f9fa;
|
76 |
+
padding: 1rem;
|
77 |
+
border-radius: 8px;
|
78 |
+
font-family: monospace;
|
79 |
+
white-space: pre-wrap;
|
80 |
+
border: 1px solid #dee2e6;
|
81 |
+
}
|
82 |
"""
|
83 |
) as interface:
|
84 |
|
85 |
gr.HTML("""
|
86 |
<div class="header">
|
87 |
<h1>Code Gen Prompt Reformatter</h1>
|
88 |
+
<p>Text transformation processor which attempts to improve a rough draft of a definition for a subagent in an agentic code generation system.</p>
|
89 |
</div>
|
90 |
""")
|
91 |
|
92 |
+
with gr.Tabs():
|
93 |
+
with gr.TabItem("Prompt Reformatter"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
with gr.Row():
|
95 |
+
with gr.Column():
|
96 |
+
api_key_input = gr.Textbox(
|
97 |
+
label="OpenAI API Key",
|
98 |
+
placeholder="sk-...",
|
99 |
+
type="password",
|
100 |
+
info="Your API key is not stored and only used for this session"
|
101 |
+
)
|
102 |
+
|
103 |
+
rough_draft_input = gr.Textbox(
|
104 |
+
label="Rough Draft",
|
105 |
+
placeholder="Enter your rough draft describing the desired functionalities of the AI code generation agent...",
|
106 |
+
lines=10,
|
107 |
+
max_lines=20
|
108 |
+
)
|
109 |
+
|
110 |
+
with gr.Row():
|
111 |
+
clear_btn = gr.Button("Clear", variant="secondary")
|
112 |
+
submit_btn = gr.Button("Reformat Prompt", variant="primary", scale=2)
|
113 |
+
|
114 |
+
with gr.Column():
|
115 |
+
output = gr.Textbox(
|
116 |
+
label="Reformatted System Prompt",
|
117 |
+
lines=15,
|
118 |
+
max_lines=25,
|
119 |
+
show_copy_button=True,
|
120 |
+
interactive=False
|
121 |
+
)
|
122 |
|
123 |
+
with gr.TabItem("System Prompt"):
|
124 |
+
gr.HTML("""
|
125 |
+
<h3>System Prompt Used in Workflow</h3>
|
126 |
+
<p>This is the system prompt that guides the AI in reformatting your rough drafts into polished system prompts:</p>
|
127 |
+
""")
|
128 |
+
|
129 |
+
gr.Textbox(
|
130 |
+
value=SYSTEM_PROMPT,
|
131 |
+
label="Current System Prompt",
|
132 |
+
lines=20,
|
133 |
+
max_lines=30,
|
134 |
show_copy_button=True,
|
135 |
+
interactive=False,
|
136 |
+
elem_classes=["system-prompt-display"]
|
137 |
)
|
138 |
+
|
139 |
+
gr.HTML("""
|
140 |
+
<div style="margin-top: 1rem; padding: 1rem; background-color: #e3f2fd; border-radius: 8px;">
|
141 |
+
<h4>About This System Prompt</h4>
|
142 |
+
<p>This system prompt instructs the AI to:</p>
|
143 |
+
<ul>
|
144 |
+
<li>Convert rough notes into polished system prompts for code generation agents</li>
|
145 |
+
<li>Focus on sub-agents within multi-agent frameworks</li>
|
146 |
+
<li>Ensure all desired functionalities are clearly reflected</li>
|
147 |
+
<li>Return results in markdown format within code fences</li>
|
148 |
+
<li>Treat each input as a new, independent specification</li>
|
149 |
+
</ul>
|
150 |
+
</div>
|
151 |
+
""")
|
152 |
|
153 |
# Event handlers
|
154 |
submit_btn.click(
|