Skip to content
Snippets Groups Projects
Commit 2c20d303 authored by yisding's avatar yisding
Browse files

fix #182 (thanks @RayFernando1337)

add license
make contextchatengine the default
change git commit message
parent 00339d20
No related branches found
No related tags found
No related merge requests found
The MIT License (MIT)
Copyright (c) 2023 LlamaIndex, Vercel, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Create LlamaIndex App
The easiest way to get started with [LlamaIndex](https://www.llamaindex.ai/) is by using `create-llama`. This CLI tool enables you to quickly start building a new LlamaIndex application, with everything set up for you.
The easiest way to get started with [LlamaIndex](https://www.llamaindex.ai/) is by using `create-llama`. This CLI tool enables you to quickly start building a new LlamaIndex application, with everything set up for you.
## Features
......@@ -19,11 +19,11 @@ You can create a new project interactively by running:
```bash
npx create-llama@latest
# or
npm create llama
npm create llama@latest
# or
yarn create llama
# or
pnpm create llama
pnpm create llama@latest
```
You will be asked for the name of your project, along with other configuration options.
......@@ -33,14 +33,14 @@ Here is an example:
```bash
>> npm create llama
Need to install the following packages:
create-llama@0.0.3
create-llama@latest
Ok to proceed? (y) y
✔ What is your project named? … my-app
✔ Which template would you like to use? › Chat with streaming
✔ Which framework would you like to use? › NextJS
✔ Which UI would you like to use? › Just HTML
✔ Which chat engine would you like to use? › ContextChatEngine
✔ Please provide your OpenAI API key (leave blank to skip): …
✔ Please provide your OpenAI API key (leave blank to skip): …
✔ Would you like to use ESLint? … No / Yes
Creating a new LlamaIndex app in /home/my-app.
```
......@@ -55,7 +55,6 @@ create-llama <project-directory> [options]
Options:
-V, --version output the version number
--use-npm
......@@ -75,3 +74,5 @@ Options:
- [TS/JS docs](https://ts.llamaindex.ai/)
- [Python docs](https://docs.llamaindex.ai/en/stable/)
Inspired by and adapted from [create-next-app](https://github.com/vercel/next.js/tree/canary/packages/create-next-app)
......@@ -43,7 +43,7 @@ export function tryGitInit(root: string): boolean {
}
execSync("git add -A", { stdio: "ignore" });
execSync('git commit -m "Initial commit from Create Next App"', {
execSync('git commit -m "Initial commit from Create Llama"', {
stdio: "ignore",
});
return true;
......
......@@ -288,8 +288,11 @@ async function run(): Promise<void> {
name: "engine",
message: "Which chat engine would you like to use?",
choices: [
{ title: "SimpleChatEngine", value: "simple" },
{ title: "ContextChatEngine", value: "context" },
{
title: "SimpleChatEngine",
value: "simple (no data, just chat)",
},
],
initial: 0,
},
......@@ -359,10 +362,10 @@ async function notifyUpdate(): Promise<void> {
if (res?.latest) {
const updateMessage =
packageManager === "yarn"
? "yarn global add create-llama"
? "yarn global add create-llama@latest"
: packageManager === "pnpm"
? "pnpm add -g create-llama"
: "npm i -g create-llama";
? "pnpm add -g create-llama@latest"
: "npm i -g create-llama@latest";
console.log(
yellow(bold("A new version of `create-llama` is available!")) +
......
......@@ -33,6 +33,7 @@ const createEnvLocalFile = async (
`OPENAI_API_KEY=${openAIKey}\n`,
);
console.log(`Created '${envFileName}' file containing OPENAI_API_KEY`);
process.env["OPENAI_API_KEY"] = openAIKey;
}
};
......@@ -53,11 +54,21 @@ const copyTestData = async (
}
if (packageManager && engine === "context") {
console.log(
`\nRunning ${cyan("npm run generate")} to generate the context data.\n`,
);
await callPackageManager(packageManager, true, ["run", "generate"]);
console.log();
if (process.env["OPENAI_API_KEY"]) {
console.log(
`\nRunning ${cyan(
`${packageManager} run generate`,
)} to generate the context data.\n`,
);
await callPackageManager(packageManager, true, ["run", "generate"]);
console.log();
} else {
console.log(
`\nAfter setting your OpenAI key, run ${cyan(
`${packageManager} run generate`,
)} to generate the context data.\n`,
);
}
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment