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
dec98185
Commit
dec98185
authored
1 week ago
by
thucpn
Browse files
Options
Downloads
Patches
Plain Diff
refactor: getEnv -> getConfig
parent
5873267a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/server/next/app/env.ts
+1
-6
1 addition, 6 deletions
packages/server/next/app/env.ts
packages/server/next/app/page.tsx
+2
-2
2 additions, 2 deletions
packages/server/next/app/page.tsx
with
3 additions
and
8 deletions
packages/server/next/app/env.ts
+
1
−
6
View file @
dec98185
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-explicit-any */
"
use client
"
;
"
use client
"
;
/**
export
const
getConfig
=
(
name
:
string
)
=>
{
* A helper function to get environment variables from the window object
* @param name - The name of the environment variable to get
* @returns The value of the environment variable
*/
export
const
getEnv
=
(
name
:
string
)
=>
{
if
(
typeof
window
===
"
undefined
"
)
return
undefined
;
if
(
typeof
window
===
"
undefined
"
)
return
undefined
;
return
(
window
as
any
).
LLAMAINDEX
?.[
name
];
return
(
window
as
any
).
LLAMAINDEX
?.[
name
];
};
};
This diff is collapsed.
Click to expand it.
packages/server/next/app/page.tsx
+
2
−
2
View file @
dec98185
"
use client
"
;
"
use client
"
;
import
{
ChatSection
}
from
"
@llamaindex/chat-ui
"
;
import
{
ChatSection
}
from
"
@llamaindex/chat-ui
"
;
import
{
useChat
}
from
"
ai/react
"
;
import
{
useChat
}
from
"
ai/react
"
;
import
{
get
Env
}
from
"
./env
"
;
import
{
get
Config
}
from
"
./env
"
;
export
default
function
Page
()
{
export
default
function
Page
()
{
const
handler
=
useChat
({
api
:
get
Env
(
"
CHAT_API
"
)
});
const
handler
=
useChat
({
api
:
get
Config
(
"
CHAT_API
"
)
});
return
(
return
(
<
div
className
=
"flex h-screen items-center justify-center"
>
<
div
className
=
"flex h-screen items-center justify-center"
>
<
ChatSection
<
ChatSection
...
...
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