Skip to content

Commit 6117cd8

Browse files
authored
llamactl updates (#12)
* fix: update for new llamactl compatibility * Fixing template
1 parent a46c002 commit 6117cd8

File tree

12 files changed

+24
-92
lines changed

12 files changed

+24
-92
lines changed

README.md.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ The backend python workflow and frontend ui share values from this single file.
2929

3030
These apps are built on top of `llama_deploy`, which comes bundled with a `llamactl` cli for serving your workflows as an API, and your app, side by side.
3131

32-
You can serve it locally with `uv run llamactl serve llama_deploy.local` from within this directory.
32+
You can serve it locally with `uvx llamactl serve` from within this directory.
3333

34-
After starting with `llamactl`, visit `http://localhost:4501/deployments/{{package_name}}/ui` to see the UI.
34+
After starting with `llamactl`, visit `http://localhost:4501/deployments/{{ project_name }}/ui` to see the UI.
3535

3636
## Exporting types
3737

llama_deploy.local.jinja

Lines changed: 0 additions & 25 deletions
This file was deleted.

llama_deploy.yaml.jinja

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ default-service: process-file
88
services:
99
process-file:
1010
name: Process File
11-
source:
12-
type: local
13-
name: .
14-
sync_policy: merge
1511
path: "src/{{project_name_snake}}.process_file:workflow"
16-
python-dependencies:
17-
- "."
12+
env-files:
13+
- ".env"
1814

1915
ui:
2016
name: "{{project_name}} UI"
2117
source:
22-
type: local
2318
name: ./ui
24-
sync_policy: merge

test-proj/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ The backend python workflow and frontend ui share values from this single file.
2929

3030
These apps are built on top of `llama_deploy`, which comes bundled with a `llamactl` cli for serving your workflows as an API, and your app, side by side.
3131

32-
You can serve it locally with `uv run llamactl serve llama_deploy.local` from within this directory.
32+
You can serve it locally with `uvx llamactl serve` from within this directory.
3333

34-
After starting with `llamactl`, visit `http://localhost:4501/deployments//ui` to see the UI.
34+
After starting with `llamactl`, visit `http://localhost:4501/deployments/test-proj/ui` to see the UI.
3535

3636
## Exporting types
3737

test-proj/llama_deploy.local

Lines changed: 0 additions & 25 deletions
This file was deleted.

test-proj/llama_deploy.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ default-service: process-file
88
services:
99
process-file:
1010
name: Process File
11-
source:
12-
type: local
13-
name: .
14-
sync_policy: merge
1511
path: "src/test_proj.process_file:workflow"
16-
python-dependencies:
17-
- "."
12+
env-files:
13+
- ".env"
1814

1915
ui:
2016
name: "test-proj UI"
2117
source:
22-
type: local
2318
name: ./ui
24-
sync_policy: merge

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { EXTRACTED_DATA_COLLECTION } from "./config";
1111

1212
const platformToken = import.meta.env.VITE_LLAMA_CLOUD_API_KEY;
1313
const apiBaseUrl = import.meta.env.VITE_LLAMA_CLOUD_BASE_URL;
14-
const projectId = import.meta.env.VITE_LLAMA_CLOUD_PROJECT_ID;
14+
const projectId = import.meta.env.VITE_LLAMA_DEPLOY_PROJECT_ID;
1515

1616
// Configure the platform client
1717
cloudApiClient.setConfig({

test-proj/ui/src/main.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import { StrictMode } from "react";
22
import { createRoot } from "react-dom/client";
3-
import { BrowserRouter } from "react-router-dom";
3+
import { HashRouter } from "react-router-dom";
44
import App from "./App";
55
import "@llamaindex/ui/styles.css";
66
import "./index.css";
77

8-
// https://github.com/run-llama/llama_deploy/blob/main/llama_deploy/apiserver/deployment.py#L183
9-
const base = import.meta.env.VITE_LLAMA_DEPLOY_BASE_PATH ?? "/";
10-
118
createRoot(document.getElementById("root")!).render(
129
<StrictMode>
13-
<BrowserRouter basename={base}>
10+
<HashRouter>
1411
<App />
15-
</BrowserRouter>
12+
</HashRouter>
1613
</StrictMode>,
1714
);

test-proj/ui/vite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import path from "path";
44

55
// https://vitejs.dev/config/
66
export default defineConfig(({}) => {
7-
const deploymentId = process.env.LLAMA_DEPLOY_NEXTJS_DEPLOYMENT_NAME;
8-
const basePath = `/deployments/${deploymentId}/ui`;
7+
const deploymentId = process.env.LLAMA_DEPLOY_DEPLOYMENT_URL_ID;
8+
const basePath = process.env.LLAMA_DEPLOY_DEPLOYMENT_BASE_PATH;
99
const projectId = process.env.LLAMA_DEPLOY_PROJECT_ID;
1010

1111
return {
@@ -30,9 +30,9 @@ export default defineConfig(({}) => {
3030
define: {
3131
"import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_NAME":
3232
JSON.stringify(deploymentId),
33-
"import.meta.env.VITE_LLAMA_DEPLOY_BASE_PATH": JSON.stringify(basePath),
33+
"import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_BASE_PATH": JSON.stringify(basePath),
3434
...(projectId && {
35-
"import.meta.env.VITE_LLAMA_CLOUD_PROJECT_ID":
35+
"import.meta.env.VITE_LLAMA_DEPLOY_PROJECT_ID":
3636
JSON.stringify(projectId),
3737
}),
3838
},

ui/src/lib/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { EXTRACTED_DATA_COLLECTION } from "./config";
1111

1212
const platformToken = import.meta.env.VITE_LLAMA_CLOUD_API_KEY;
1313
const apiBaseUrl = import.meta.env.VITE_LLAMA_CLOUD_BASE_URL;
14-
const projectId = import.meta.env.VITE_LLAMA_CLOUD_PROJECT_ID;
14+
const projectId = import.meta.env.VITE_LLAMA_DEPLOY_PROJECT_ID;
1515

1616
// Configure the platform client
1717
cloudApiClient.setConfig({

0 commit comments

Comments
 (0)