Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
f2d37c30
authored
Jun 19, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: baidu statistic
parent
1d236f87
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
24 deletions
+47
-24
client/public/js/baidutongji.js
+8
-0
client/src/pages/_app.tsx
+1
-0
client/src/pages/api/chat/saveChat.ts
+38
-24
No files found.
client/public/js/baidutongji.js
0 → 100644
View file @
f2d37c30
var
_hmt
=
_hmt
||
[];
(
function
()
{
const
hm
=
document
.
createElement
(
'script'
);
hm
.
src
=
'https://hm.baidu.com/hm.js?a5357e9dab086658bac0b6faf148882e'
;
const
s
=
document
.
getElementsByTagName
(
'script'
)[
0
];
s
.
parentNode
.
insertBefore
(
hm
,
s
);
})();
client/src/pages/_app.tsx
View file @
f2d37c30
...
@@ -52,6 +52,7 @@ function App({ Component, pageProps }: AppProps) {
...
@@ -52,6 +52,7 @@ function App({ Component, pageProps }: AppProps) {
<
Script
src=
"/js/qrcode.min.js"
strategy=
"afterInteractive"
></
Script
>
<
Script
src=
"/js/qrcode.min.js"
strategy=
"afterInteractive"
></
Script
>
<
Script
src=
"/js/pdf.js"
strategy=
"afterInteractive"
></
Script
>
<
Script
src=
"/js/pdf.js"
strategy=
"afterInteractive"
></
Script
>
<
Script
src=
"/js/html2pdf.bundle.min.js"
strategy=
"afterInteractive"
></
Script
>
<
Script
src=
"/js/html2pdf.bundle.min.js"
strategy=
"afterInteractive"
></
Script
>
<
Script
src=
"/js/baidutongji.js"
strategy=
"afterInteractive"
></
Script
>
{
googleVerKey
&&
(
{
googleVerKey
&&
(
<>
<>
<
Script
<
Script
...
...
client/src/pages/api/chat/saveChat.ts
View file @
f2d37c30
...
@@ -60,34 +60,48 @@ export async function saveChat({
...
@@ -60,34 +60,48 @@ export async function saveChat({
}));
}));
if
(
String
(
model
.
userId
)
===
userId
)
{
if
(
String
(
model
.
userId
)
===
userId
)
{
Model
.
findByIdAndUpdate
(
modelId
,
{
await
Model
.
findByIdAndUpdate
(
modelId
,
{
updateTime
:
new
Date
()
updateTime
:
new
Date
()
});
});
}
}
const
response
=
await
(
chatId
const
[
response
]
=
await
Promise
.
all
([
?
Chat
.
findByIdAndUpdate
(
chatId
,
{
...(
chatId
$push
:
{
?
[
content
:
{
Chat
.
findByIdAndUpdate
(
chatId
,
{
$each
:
content
$push
:
{
}
content
:
{
},
$each
:
content
title
:
content
[
0
].
value
.
slice
(
0
,
20
),
}
latestChat
:
content
[
1
].
value
,
},
updateTime
:
new
Date
()
title
:
content
[
0
].
value
.
slice
(
0
,
20
),
}).
then
(()
=>
({
latestChat
:
content
[
1
].
value
,
newChatId
:
''
updateTime
:
new
Date
()
}))
}).
then
(()
=>
({
:
Chat
.
create
({
newChatId
:
''
_id
:
newChatId
,
}))
userId
,
]
modelId
,
:
[
content
,
Chat
.
create
({
title
:
content
[
0
].
value
.
slice
(
0
,
20
),
_id
:
newChatId
,
latestChat
:
content
[
1
].
value
userId
,
}).
then
((
res
)
=>
({
modelId
,
newChatId
:
String
(
res
.
_id
)
content
,
})));
title
:
content
[
0
].
value
.
slice
(
0
,
20
),
latestChat
:
content
[
1
].
value
}).
then
((
res
)
=>
({
newChatId
:
String
(
res
.
_id
)
}))
]),
// update model
...(
String
(
model
.
userId
)
===
userId
?
[
Model
.
findByIdAndUpdate
(
modelId
,
{
updateTime
:
new
Date
()
})
]
:
[])
]);
return
{
return
{
...
response
...
response
...
...
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