Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webapp-conversation
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
webapp-conversation
Commits
d728cbb2
Commit
d728cbb2
authored
May 05, 2023
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: v4 undefined problem
parent
7265f980
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
settings.json
.vscode/settings.json
+6
-1
common.ts
app/api/utils/common.ts
+2
-2
No files found.
.vscode/settings.json
View file @
d728cbb2
...
...
@@ -23,5 +23,10 @@
},
"[jsonc]"
:
{
"editor.defaultFormatter"
:
"vscode.json-language-features"
}
},
"i18n-ally.localesPaths"
:
[
"i18n"
,
"i18n/lang"
,
"app/api/messages"
]
}
\ No newline at end of file
app/api/utils/common.ts
View file @
d728cbb2
import
{
type
NextRequest
}
from
'next/server'
import
{
APP_ID
,
API_KEY
}
from
'@/config'
import
{
ChatClient
}
from
'langgenius-client'
import
uuid
from
'uuid'
import
{
v4
}
from
'uuid'
const
userPrefix
=
`user_
${
APP_ID
}
:`
;
export
const
getInfo
=
(
request
:
NextRequest
)
=>
{
const
sessionId
=
request
.
cookies
.
get
(
'session_id'
)?.
value
||
uuid
.
v4
();
const
sessionId
=
request
.
cookies
.
get
(
'session_id'
)?.
value
||
v4
();
const
user
=
userPrefix
+
sessionId
;
return
{
sessionId
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment