@@ -81,7 +81,7 @@ class GenUIWorkflow(Workflow):
81
81
82
82
code_structure : str = """
83
83
```jsx
84
- // Note: Only shadcn/ui (@/components/ui/<component_name>) and lucide-react and tailwind css are allowed.
84
+ // Note: Only shadcn/ui (@/components/ui/<component_name>) and lucide-react and tailwind css are allowed (but cn() is not supported yet) .
85
85
e.g: import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
86
86
87
87
// export the component
@@ -194,8 +194,7 @@ async def generate_event_aggregations(
194
194
# Your role
195
195
You are a frontend developer who is developing a React component for given events that are emitted from a backend workflow.
196
196
Here are the events that you need to work on: {events}
197
-
198
- Here is the description of the UI:
197
+ Here is the description of the UI:
199
198
```
200
199
{ui_description}
201
200
```
@@ -216,7 +215,10 @@ async def generate_event_aggregations(
216
215
"""
217
216
218
217
response = await self .llm .acomplete (
219
- PromptTemplate (prompt_template ).format (events = ev .events ),
218
+ PromptTemplate (prompt_template ).format (
219
+ events = ev .events ,
220
+ ui_description = ev .ui_description ,
221
+ ),
220
222
formatted = True ,
221
223
)
222
224
await ctx .set ("aggregation_context" , response .text )
@@ -261,7 +263,7 @@ async def write_ui_component(
261
263
You should display the jump, run and meow actions in different ways. don't try to render "height" for the "run" and "meow" action.
262
264
263
265
## UI notice
264
- - Use shadcn/ui and lucide-react and tailwind CSS for the UI.
266
+ - Use shadcn/ui and lucide-react and tailwind CSS for the UI (cn() is not supported yet) .
265
267
- Be careful on state handling, make sure the update should be updated in the state and there is no duplicate state.
266
268
- For a long content, consider to use markdown along with dropdown to show the full content.
267
269
e.g:
@@ -313,7 +315,7 @@ async def refine_code(
313
315
{code_structure}
314
316
315
317
# Requirements:
316
- - Refine the code to ensure there are no potential bugs.
318
+ - Refine the code if needed to ensure there are no potential bugs. Be careful on code placement, make sure it doesn't call any undefined code .
317
319
- Don't be verbose, only return the code, wrap it in ```jsx <code>```
318
320
"""
319
321
prompt = PromptTemplate (prompt_template ).format (
@@ -405,7 +407,7 @@ async def generate_ui_for_workflow(
405
407
406
408
# Generate UI component from event schemas
407
409
console .rule ("[bold blue]Generate UI Components[/bold blue]" )
408
- llm = Anthropic (model = "claude-3-7-sonnet-latest" , max_tokens = 4096 )
410
+ llm = Anthropic (model = "claude-3-7-sonnet-latest" , max_tokens = 8192 )
409
411
workflow = GenUIWorkflow (llm = llm , timeout = 500.0 )
410
412
code = await workflow .run (events = event_schemas )
411
413
0 commit comments