Skip to content

Commit 38249a1

Browse files
committed
update workflow, bump chat ui
1 parent 68edc43 commit 38249a1

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

llama-index-server/llama_index/server/chat_ui.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import requests
77

8-
CHAT_UI_VERSION = "0.1.0"
8+
CHAT_UI_VERSION = "0.1.1"
99

1010

1111
def download_chat_ui(
@@ -21,8 +21,7 @@ def download_chat_ui(
2121

2222
def _get_download_link(version: str) -> str:
2323
"""Get the download link for the chat UI from the npm registry."""
24-
# return f"https://registry.npmjs.org/@llamaindex/server/-/server-{version}.tgz"
25-
return "https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/server@1838"
24+
return f"https://registry.npmjs.org/@llamaindex/server/-/server-{version}.tgz"
2625

2726

2827
def _download_package(url: str) -> Path:

llama-index-server/llama_index/server/gen_ui/main.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class GenUIWorkflow(Workflow):
8181

8282
code_structure: str = """
8383
```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).
8585
e.g: import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
8686
8787
// export the component
@@ -194,8 +194,7 @@ async def generate_event_aggregations(
194194
# Your role
195195
You are a frontend developer who is developing a React component for given events that are emitted from a backend workflow.
196196
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:
199198
```
200199
{ui_description}
201200
```
@@ -216,7 +215,10 @@ async def generate_event_aggregations(
216215
"""
217216

218217
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+
),
220222
formatted=True,
221223
)
222224
await ctx.set("aggregation_context", response.text)
@@ -261,7 +263,7 @@ async def write_ui_component(
261263
You should display the jump, run and meow actions in different ways. don't try to render "height" for the "run" and "meow" action.
262264
263265
## 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).
265267
- Be careful on state handling, make sure the update should be updated in the state and there is no duplicate state.
266268
- For a long content, consider to use markdown along with dropdown to show the full content.
267269
e.g:
@@ -313,7 +315,7 @@ async def refine_code(
313315
{code_structure}
314316
315317
# 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.
317319
- Don't be verbose, only return the code, wrap it in ```jsx <code>```
318320
"""
319321
prompt = PromptTemplate(prompt_template).format(
@@ -405,7 +407,7 @@ async def generate_ui_for_workflow(
405407

406408
# Generate UI component from event schemas
407409
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)
409411
workflow = GenUIWorkflow(llm=llm, timeout=500.0)
410412
code = await workflow.run(events=event_schemas)
411413

0 commit comments

Comments
 (0)