File tree Expand file tree Collapse file tree 4 files changed +20
-0
lines changed Expand file tree Collapse file tree 4 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,17 @@ import { EXTRACTED_DATA_COLLECTION } from "./config";
1111
1212const platformToken = import . meta. env . VITE_LLAMA_CLOUD_API_KEY ;
1313const apiBaseUrl = import . meta. env . VITE_LLAMA_CLOUD_BASE_URL ;
14+ const projectId = import . meta. env . VITE_LLAMA_CLOUD_PROJECT_ID ;
1415
1516// Configure the platform client
1617cloudApiClient . setConfig ( {
1718 baseUrl : apiBaseUrl ,
1819 headers : {
20+ // optionally use a backend API token scoped to a project. For local development,
1921 ...( platformToken && { authorization : `Bearer ${ platformToken } ` } ) ,
22+ // This header is required for requests to correctly scope to the agent's project
23+ // when authenticating with a user cookie
24+ ...( projectId && { "Project-Id" : projectId } ) ,
2025 } ,
2126} ) ;
2227
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import path from "path";
66export default defineConfig ( ( { } ) => {
77 const deploymentId = process . env . LLAMA_DEPLOY_NEXTJS_DEPLOYMENT_NAME ;
88 const basePath = `/deployments/${ deploymentId } /ui` ;
9+ const projectId = process . env . LLAMA_DEPLOY_PROJECT_ID ;
910
1011 return {
1112 plugins : [ react ( ) ] ,
@@ -30,6 +31,10 @@ export default defineConfig(({}) => {
3031 "import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_NAME" :
3132 JSON . stringify ( deploymentId ) ,
3233 "import.meta.env.VITE_LLAMA_DEPLOY_BASE_PATH" : JSON . stringify ( basePath ) ,
34+ ...( projectId && {
35+ "import.meta.env.VITE_LLAMA_CLOUD_PROJECT_ID" :
36+ JSON . stringify ( projectId ) ,
37+ } ) ,
3338 } ,
3439 } ;
3540} ) ;
Original file line number Diff line number Diff line change @@ -11,12 +11,17 @@ import { EXTRACTED_DATA_COLLECTION } from "./config";
1111
1212const platformToken = import . meta. env . VITE_LLAMA_CLOUD_API_KEY ;
1313const apiBaseUrl = import . meta. env . VITE_LLAMA_CLOUD_BASE_URL ;
14+ const projectId = import . meta. env . VITE_LLAMA_CLOUD_PROJECT_ID ;
1415
1516// Configure the platform client
1617cloudApiClient . setConfig ( {
1718 baseUrl : apiBaseUrl ,
1819 headers : {
20+ // optionally use a backend API token scoped to a project. For local development,
1921 ...( platformToken && { authorization : `Bearer ${ platformToken } ` } ) ,
22+ // This header is required for requests to correctly scope to the agent's project
23+ // when authenticating with a user cookie
24+ ...( projectId && { "Project-Id" : projectId } ) ,
2025 } ,
2126} ) ;
2227
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import path from "path";
66export default defineConfig ( ( { } ) => {
77 const deploymentId = process . env . LLAMA_DEPLOY_NEXTJS_DEPLOYMENT_NAME ;
88 const basePath = `/deployments/${ deploymentId } /ui` ;
9+ const projectId = process . env . LLAMA_DEPLOY_PROJECT_ID ;
910
1011 return {
1112 plugins : [ react ( ) ] ,
@@ -30,6 +31,10 @@ export default defineConfig(({}) => {
3031 "import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_NAME" :
3132 JSON . stringify ( deploymentId ) ,
3233 "import.meta.env.VITE_LLAMA_DEPLOY_BASE_PATH" : JSON . stringify ( basePath ) ,
34+ ...( projectId && {
35+ "import.meta.env.VITE_LLAMA_CLOUD_PROJECT_ID" :
36+ JSON . stringify ( projectId ) ,
37+ } ) ,
3338 } ,
3439 } ;
3540} ) ;
You can’t perform that action at this time.
0 commit comments