Skip to content

Commit ad5dcce

Browse files
authored
update llama ui (#41)
1 parent 328d025 commit ad5dcce

File tree

6 files changed

+28
-18
lines changed

6 files changed

+28
-18
lines changed

test-proj/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@babel/runtime": "^7.27.6",
1818
"@lezer/highlight": "^1.2.1",
19-
"@llamaindex/ui": "^1.0.3",
19+
"@llamaindex/ui": "^2.1.1",
2020
"@radix-ui/themes": "^3.2.1",
2121
"class-variance-authority": "^0.7.1",
2222
"clsx": "^2.1.1",

test-proj/ui/src/lib/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { MySchema } from "@/schemas/MySchema";
22
import { ExtractedData } from "llama-cloud-services/beta/agent";
33
import {
44
ApiClients,
5-
createWorkflowClient,
6-
createWorkflowConfig,
5+
createWorkflowsClient,
6+
createWorkflowsConfig,
77
} from "@llamaindex/ui";
88
import { createCloudAgentClient, cloudApiClient } from "@llamaindex/ui";
99
import { AGENT_NAME, EXTRACTED_DATA_COLLECTION } from "./config";
@@ -30,8 +30,8 @@ const agentClient = createCloudAgentClient<ExtractedData<MySchema>>({
3030
collection: EXTRACTED_DATA_COLLECTION,
3131
});
3232

33-
const workflowsClient = createWorkflowClient(
34-
createWorkflowConfig({
33+
const workflowsClient = createWorkflowsClient(
34+
createWorkflowsConfig({
3535
baseUrl: `/deployments/${AGENT_NAME}/`,
3636
}),
3737
);

test-proj/ui/src/pages/HomePage.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
WorkflowTrigger,
44
WorkflowProgressBar,
55
ExtractedDataItemGrid,
6-
useWorkflowTaskList,
6+
useWorkflowHandlerList,
77
} from "@llamaindex/ui";
88
import type { TypedAgentData } from "llama-cloud-services/beta/agent";
99
import styles from "./HomePage.module.css";
@@ -20,8 +20,10 @@ export default function HomePage() {
2020
* Returns a key that increments when a task is completed, can be used to force a re-render of the task list
2121
*/
2222
function taskCompletedState() {
23-
const { tasks } = useWorkflowTaskList();
24-
const runningTasks = tasks.filter((task) => task.status === "running");
23+
const { handlers } = useWorkflowHandlerList("process-file");
24+
const runningTasks = handlers.filter(
25+
(handler) => handler.status === "running",
26+
);
2527
const [runningTaskCount, setRunningTaskCount] = useState(runningTasks.length);
2628
const [taskKey, setTaskKey] = useState(0);
2729
useEffect(() => {
@@ -69,7 +71,10 @@ function TaskList() {
6971
}}
7072
/>
7173
</div>
72-
<WorkflowProgressBar className={styles.progressBar} />
74+
<WorkflowProgressBar
75+
className={styles.progressBar}
76+
workflowName="process-file"
77+
/>
7378
<ExtractedDataItemGrid
7479
onRowClick={goToItem}
7580
builtInColumns={{

ui/package.json.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@babel/runtime": "^7.27.6",
1818
"@lezer/highlight": "^1.2.1",
19-
"@llamaindex/ui": "^1.0.3",
19+
"@llamaindex/ui": "^2.1.1",
2020
"@radix-ui/themes": "^3.2.1",
2121
"class-variance-authority": "^0.7.1",
2222
"clsx": "^2.1.1",

ui/src/lib/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { MySchema } from "@/schemas/MySchema";
22
import { ExtractedData } from "llama-cloud-services/beta/agent";
33
import {
44
ApiClients,
5-
createWorkflowClient,
6-
createWorkflowConfig,
5+
createWorkflowsClient,
6+
createWorkflowsConfig,
77
} from "@llamaindex/ui";
88
import { createCloudAgentClient, cloudApiClient } from "@llamaindex/ui";
99
import { AGENT_NAME, EXTRACTED_DATA_COLLECTION } from "./config";
@@ -30,8 +30,8 @@ const agentClient = createCloudAgentClient<ExtractedData<MySchema>>({
3030
collection: EXTRACTED_DATA_COLLECTION,
3131
});
3232

33-
const workflowsClient = createWorkflowClient(
34-
createWorkflowConfig({
33+
const workflowsClient = createWorkflowsClient(
34+
createWorkflowsConfig({
3535
baseUrl: `/deployments/${AGENT_NAME}/`,
3636
}),
3737
);

ui/src/pages/HomePage.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
WorkflowTrigger,
44
WorkflowProgressBar,
55
ExtractedDataItemGrid,
6-
useWorkflowTaskList,
6+
useWorkflowHandlerList,
77
} from "@llamaindex/ui";
88
import type { TypedAgentData } from "llama-cloud-services/beta/agent";
99
import styles from "./HomePage.module.css";
@@ -20,8 +20,10 @@ export default function HomePage() {
2020
* Returns a key that increments when a task is completed, can be used to force a re-render of the task list
2121
*/
2222
function taskCompletedState() {
23-
const { tasks } = useWorkflowTaskList();
24-
const runningTasks = tasks.filter((task) => task.status === "running");
23+
const { handlers } = useWorkflowHandlerList("process-file");
24+
const runningTasks = handlers.filter(
25+
(handler) => handler.status === "running",
26+
);
2527
const [runningTaskCount, setRunningTaskCount] = useState(runningTasks.length);
2628
const [taskKey, setTaskKey] = useState(0);
2729
useEffect(() => {
@@ -69,7 +71,10 @@ function TaskList() {
6971
}}
7072
/>
7173
</div>
72-
<WorkflowProgressBar className={styles.progressBar} />
74+
<WorkflowProgressBar
75+
className={styles.progressBar}
76+
workflowName="process-file"
77+
/>
7378
<ExtractedDataItemGrid
7479
onRowClick={goToItem}
7580
builtInColumns={{

0 commit comments

Comments
 (0)