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
f5d045ee
authored
Feb 11, 2025
by
heheer
Committed by
GitHub
Feb 11, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export csv format & log title debounce (#3754)
parent
8ac6494e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
projects/app/src/pageComponents/app/detail/Logs/index.tsx
+13
-3
projects/app/src/pageComponents/app/detail/SimpleApp/index.tsx
+1
-1
projects/app/src/pages/api/core/app/exportChatLogs.ts
+2
-2
No files found.
projects/app/src/pageComponents/app/detail/Logs/index.tsx
View file @
f5d045ee
import
React
,
{
useMemo
,
useState
}
from
'react'
;
import
React
,
{
use
Effect
,
use
Memo
,
useState
}
from
'react'
;
import
{
import
{
Flex
,
Flex
,
Box
,
Box
,
...
@@ -35,6 +35,7 @@ import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
...
@@ -35,6 +35,7 @@ import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
import
PopoverConfirm
from
'@fastgpt/web/components/common/MyPopover/PopoverConfirm'
;
import
PopoverConfirm
from
'@fastgpt/web/components/common/MyPopover/PopoverConfirm'
;
import
{
useRequest2
}
from
'@fastgpt/web/hooks/useRequest'
;
import
{
useRequest2
}
from
'@fastgpt/web/hooks/useRequest'
;
import
{
downloadFetch
}
from
'@/web/common/system/utils'
;
import
{
downloadFetch
}
from
'@/web/common/system/utils'
;
import
{
debounce
}
from
'lodash'
;
const
DetailLogsModal
=
dynamic
(()
=>
import
(
'./DetailLogsModal'
));
const
DetailLogsModal
=
dynamic
(()
=>
import
(
'./DetailLogsModal'
));
...
@@ -50,6 +51,15 @@ const Logs = () => {
...
@@ -50,6 +51,15 @@ const Logs = () => {
const
[
detailLogsId
,
setDetailLogsId
]
=
useState
<
string
>
();
const
[
detailLogsId
,
setDetailLogsId
]
=
useState
<
string
>
();
const
[
logTitle
,
setLogTitle
]
=
useState
<
string
>
();
const
[
logTitle
,
setLogTitle
]
=
useState
<
string
>
();
const
[
inputValue
,
setInputValue
]
=
useState
(
''
);
useEffect
(()
=>
{
const
timer
=
setTimeout
(()
=>
{
setLogTitle
(
inputValue
);
},
500
);
return
()
=>
clearTimeout
(
timer
);
},
[
inputValue
]);
const
{
const
{
value
:
chatSources
,
value
:
chatSources
,
...
@@ -162,8 +172,8 @@ const Logs = () => {
...
@@ -162,8 +172,8 @@ const Logs = () => {
<
SearchInput
<
SearchInput
placeholder=
{
t
(
'app:logs_title'
)
}
placeholder=
{
t
(
'app:logs_title'
)
}
w=
{
'240px'
}
w=
{
'240px'
}
value=
{
logTitl
e
}
value=
{
inputValu
e
}
onChange=
{
(
e
)
=>
set
LogTitl
e
(
e
.
target
.
value
)
}
onChange=
{
(
e
)
=>
set
InputValu
e
(
e
.
target
.
value
)
}
/>
/>
</
Flex
>
</
Flex
>
<
Box
flex=
{
'1'
}
/>
<
Box
flex=
{
'1'
}
/>
...
...
projects/app/src/pageComponents/app/detail/SimpleApp/index.tsx
View file @
f5d045ee
...
@@ -121,7 +121,7 @@ const SimpleEdit = () => {
...
@@ -121,7 +121,7 @@ const SimpleEdit = () => {
{
currentTab
===
TabEnum
.
appEdit
?
(
{
currentTab
===
TabEnum
.
appEdit
?
(
<
Edit
appForm=
{
appForm
}
setAppForm=
{
setAppForm
}
setPast=
{
setPast
}
/>
<
Edit
appForm=
{
appForm
}
setAppForm=
{
setAppForm
}
setPast=
{
setPast
}
/>
)
:
(
)
:
(
<
Box
flex=
{
'1 0 0'
}
h=
{
0
}
mt=
{
[
4
,
0
]
}
>
<
Box
flex=
{
'1 0 0'
}
h=
{
0
}
mt=
{
[
4
,
0
]
}
mb=
{
[
2
,
4
]
}
>
{
currentTab
===
TabEnum
.
publish
&&
<
PublishChannel
/>
}
{
currentTab
===
TabEnum
.
publish
&&
<
PublishChannel
/>
}
{
currentTab
===
TabEnum
.
logs
&&
<
Logs
/>
}
{
currentTab
===
TabEnum
.
logs
&&
<
Logs
/>
}
</
Box
>
</
Box
>
...
...
projects/app/src/pages/api/core/app/exportChatLogs.ts
View file @
f5d045ee
...
@@ -229,7 +229,7 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
...
@@ -229,7 +229,7 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
);
);
let
chatDetailsStr
=
''
;
let
chatDetailsStr
=
''
;
try
{
try
{
chatDetailsStr
=
JSON
.
stringify
(
chatDetails
);
chatDetailsStr
=
JSON
.
stringify
(
chatDetails
)
.
replace
(
/"/g
,
'""'
).
replace
(
/
\n
/g
,
'\\n'
)
;
}
catch
(
e
)
{
}
catch
(
e
)
{
addLog
.
error
(
`export chat logs error`
,
e
);
addLog
.
error
(
`export chat logs error`
,
e
);
}
}
...
@@ -252,6 +252,6 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
...
@@ -252,6 +252,6 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
}
}
export
default
NextAPI
(
export
default
NextAPI
(
useIPFrequencyLimit
({
id
:
'export-chat-logs'
,
seconds
:
2
,
limit
:
1
,
force
:
true
}),
useIPFrequencyLimit
({
id
:
'export-chat-logs'
,
seconds
:
60
,
limit
:
1
,
force
:
true
}),
handler
handler
);
);
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