Skip to content

Commit c103816

Browse files
committed
Merge remote-tracking branch 'origin/main' into lee/fullstack
2 parents 98f8054 + 6925676 commit c103816

File tree

24 files changed

+164
-167
lines changed

24 files changed

+164
-167
lines changed

.changeset/swift-donuts-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-llama": patch
3+
---
4+
5+
chore: update eslint 9, nextjs 15, react 19

.changeset/wet-pears-matter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-llama": patch
3+
---
4+
5+
feat: use latest chat UI

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# create-llama
22

3+
## 0.3.13
4+
5+
### Patch Changes
6+
7+
- 282eaa0: Ensure that the index and document store are created when uploading a file with no available index.
8+
39
## 0.3.12
410

511
### Patch Changes

helpers/env-variables.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,13 @@ Otherwise, use CHROMA_HOST and CHROMA_PORT config above`,
217217
},
218218
];
219219
default:
220-
return [];
220+
return [
221+
{
222+
name: "STORAGE_CACHE_DIR",
223+
description: "The directory to store the local storage cache.",
224+
value: ".cache",
225+
},
226+
];
221227
}
222228
};
223229

helpers/typescript.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ export const installTSTemplate = async ({
5858
console.log("\nUsing static site generation\n");
5959
} else {
6060
if (vectorDb === "milvus") {
61-
nextConfigJson.experimental.serverComponentsExternalPackages =
62-
nextConfigJson.experimental.serverComponentsExternalPackages ?? [];
63-
nextConfigJson.experimental.serverComponentsExternalPackages.push(
64-
"@zilliz/milvus2-sdk-node",
65-
);
61+
nextConfigJson.serverExternalPackages =
62+
nextConfigJson.serverExternalPackages ?? [];
63+
nextConfigJson.serverExternalPackages.push("@zilliz/milvus2-sdk-node");
6664
}
6765
}
6866
await fs.writeFile(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-llama",
3-
"version": "0.3.12",
3+
"version": "0.3.13",
44
"description": "Create LlamaIndex-powered apps with one command",
55
"keywords": [
66
"rag",

templates/components/llamaindex/typescript/documents/pipeline.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
IngestionPipeline,
44
Settings,
55
SimpleNodeParser,
6+
storageContextFromDefaults,
67
VectorStoreIndex,
78
} from "llamaindex";
89

@@ -28,11 +29,20 @@ export async function runPipeline(
2829
return documents.map((document) => document.id_);
2930
} else {
3031
// Initialize a new index with the documents
31-
const newIndex = await VectorStoreIndex.fromDocuments(documents);
32-
newIndex.storageContext.docStore.persist();
3332
console.log(
3433
"Got empty index, created new index with the uploaded documents",
3534
);
35+
const persistDir = process.env.STORAGE_CACHE_DIR;
36+
if (!persistDir) {
37+
throw new Error("STORAGE_CACHE_DIR environment variable is required!");
38+
}
39+
const storageContext = await storageContextFromDefaults({
40+
persistDir,
41+
});
42+
const newIndex = await VectorStoreIndex.fromDocuments(documents, {
43+
storageContext,
44+
});
45+
await newIndex.storageContext.docStore.persist();
3646
return documents.map((document) => document.id_);
3747
}
3848
}

templates/components/vectordbs/typescript/none/generate.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as dotenv from "dotenv";
55

66
import { getDocuments } from "./loader";
77
import { initSettings } from "./settings";
8-
import { STORAGE_CACHE_DIR } from "./shared";
98

109
// Load environment variables from local .env file
1110
dotenv.config();
@@ -20,9 +19,13 @@ async function getRuntime(func: any) {
2019
async function generateDatasource() {
2120
console.log(`Generating storage context...`);
2221
// Split documents, create embeddings and store them in the storage context
22+
const persistDir = process.env.STORAGE_CACHE_DIR;
23+
if (!persistDir) {
24+
throw new Error("STORAGE_CACHE_DIR environment variable is required!");
25+
}
2326
const ms = await getRuntime(async () => {
2427
const storageContext = await storageContextFromDefaults({
25-
persistDir: STORAGE_CACHE_DIR,
28+
persistDir,
2629
});
2730
const documents = await getDocuments();
2831

templates/components/vectordbs/typescript/none/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { SimpleDocumentStore, VectorStoreIndex } from "llamaindex";
22
import { storageContextFromDefaults } from "llamaindex/storage/StorageContext";
3-
import { STORAGE_CACHE_DIR } from "./shared";
43

54
export async function getDataSource(params?: any) {
5+
const persistDir = process.env.STORAGE_CACHE_DIR;
6+
if (!persistDir) {
7+
throw new Error("STORAGE_CACHE_DIR environment variable is required!");
8+
}
69
const storageContext = await storageContextFromDefaults({
7-
persistDir: `${STORAGE_CACHE_DIR}`,
10+
persistDir,
811
});
912

1013
const numberOfDocs = Object.keys(

templates/components/vectordbs/typescript/none/shared.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)