Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LlamaIndexTS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
run-llama
LlamaIndexTS
Commits
8527875f
Commit
8527875f
authored
1 year ago
by
Marcus Schiesser
Browse files
Options
Downloads
Patches
Plain Diff
added support for generating streaming template
parent
2244da07
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/create-llama/create-app.ts
+2
-2
2 additions, 2 deletions
packages/create-llama/create-app.ts
packages/create-llama/index.ts
+29
-0
29 additions, 0 deletions
packages/create-llama/index.ts
packages/create-llama/templates/types.ts
+1
-1
1 addition, 1 deletion
packages/create-llama/templates/types.ts
with
32 additions
and
3 deletions
packages/create-llama/create-app.ts
+
2
−
2
View file @
8527875f
...
...
@@ -12,18 +12,18 @@ import type { TemplateFramework, TemplateType } from "./templates";
import
{
installTemplate
}
from
"
./templates
"
;
export
async
function
createApp
({
template
,
framework
,
appPath
,
packageManager
,
eslint
,
}:
{
template
:
TemplateType
;
framework
:
TemplateFramework
;
appPath
:
string
;
packageManager
:
PackageManager
;
eslint
:
boolean
;
}):
Promise
<
void
>
{
const
template
:
TemplateType
=
"
simple
"
;
const
root
=
path
.
resolve
(
appPath
);
if
(
!
(
await
isWriteable
(
path
.
dirname
(
root
))))
{
...
...
This diff is collapsed.
Click to expand it.
packages/create-llama/index.ts
+
29
−
0
View file @
8527875f
...
...
@@ -177,12 +177,40 @@ async function run(): Promise<void> {
>
;
const
defaults
:
typeof
preferences
=
{
template
:
"
simple
"
,
framework
:
"
nextjs
"
,
eslint
:
true
,
};
const
getPrefOrDefault
=
(
field
:
string
)
=>
preferences
[
field
]
??
defaults
[
field
];
if
(
!
program
.
template
)
{
if
(
ciInfo
.
isCI
)
{
program
.
template
=
getPrefOrDefault
(
"
template
"
);
}
else
{
const
{
template
}
=
await
prompts
(
{
type
:
"
select
"
,
name
:
"
template
"
,
message
:
"
Which template would you like to use?
"
,
choices
:
[
{
title
:
"
Simple chat without streaming
"
,
value
:
"
simple
"
},
{
title
:
"
Simple chat with streaming
"
,
value
:
"
streaming
"
},
],
initial
:
0
,
},
{
onCancel
:
()
=>
{
console
.
error
(
"
Exiting.
"
);
process
.
exit
(
1
);
},
},
);
program
.
template
=
template
;
preferences
.
template
=
template
;
}
}
if
(
!
program
.
framework
)
{
if
(
ciInfo
.
isCI
)
{
program
.
framework
=
getPrefOrDefault
(
"
framework
"
);
...
...
@@ -233,6 +261,7 @@ async function run(): Promise<void> {
}
await
createApp
({
template
:
program
.
template
,
framework
:
program
.
framework
,
appPath
:
resolvedProjectPath
,
packageManager
,
...
...
This diff is collapsed.
Click to expand it.
packages/create-llama/templates/types.ts
+
1
−
1
View file @
8527875f
import
{
PackageManager
}
from
"
../helpers/get-pkg-manager
"
;
export
type
TemplateType
=
"
simple
"
;
export
type
TemplateType
=
"
simple
"
|
"
streaming
"
;
export
type
TemplateFramework
=
"
nextjs
"
|
"
express
"
;
export
interface
InstallTemplateArgs
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment