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
5631ec78
authored
Dec 19, 2025
by
Archer
Committed by
GitHub
Dec 19, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename log (#6124)
* rename log * mq del log
parent
d398c9cd
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
27 deletions
+31
-27
packages/global/support/user/audit/type.d.ts
+2
-2
packages/service/common/s3/mq.ts
+10
-1
packages/service/core/chat/chatSchema.ts
+4
-4
packages/service/support/user/audit/schema.ts
+8
-7
packages/service/support/user/audit/util.ts
+2
-2
packages/service/support/wallet/sub/schema.ts
+3
-9
projects/app/src/web/support/user/team/operantionLog/api.ts
+2
-2
No files found.
packages/global/support/user/audit/type.d.ts
View file @
5631ec78
import
type
{
SourceMemberType
}
from
'../user/type'
;
import
type
{
SourceMemberType
}
from
'../user/type'
;
import
type
{
AuditEventEnum
}
from
'./constants'
;
import
type
{
AuditEventEnum
}
from
'./constants'
;
export
type
OperationLogSchema
=
{
export
type
TeamAuditSchemaType
=
{
_id
:
string
;
_id
:
string
;
tmbId
:
string
;
tmbId
:
string
;
teamId
:
string
;
teamId
:
string
;
...
@@ -10,7 +10,7 @@ export type OperationLogSchema = {
...
@@ -10,7 +10,7 @@ export type OperationLogSchema = {
metadata
?:
Record
<
string
,
string
>
;
metadata
?:
Record
<
string
,
string
>
;
};
};
export
type
Operation
ListItemType
=
{
export
type
TeamAudit
ListItemType
=
{
_id
:
string
;
_id
:
string
;
sourceMember
:
SourceMemberType
;
sourceMember
:
SourceMemberType
;
event
:
`
${
AuditEventEnum
}
`
;
event
:
`
${
AuditEventEnum
}
`
;
...
...
packages/service/common/s3/mq.ts
View file @
5631ec78
import
{
getQueue
,
getWorker
,
QueueNames
}
from
'../bullmq'
;
import
{
getQueue
,
getWorker
,
QueueNames
}
from
'../bullmq'
;
import
pLimit
from
'p-limit'
;
import
pLimit
from
'p-limit'
;
import
{
retryFn
}
from
'@fastgpt/global/common/system/utils'
;
import
{
retryFn
}
from
'@fastgpt/global/common/system/utils'
;
import
{
addLog
}
from
'../system/log'
;
export
type
S3MQJobData
=
{
export
type
S3MQJobData
=
{
key
?:
string
;
key
?:
string
;
...
@@ -38,17 +39,22 @@ export const startS3DelWorker = async () => {
...
@@ -38,17 +39,22 @@ export const startS3DelWorker = async () => {
}
}
if
(
key
)
{
if
(
key
)
{
addLog
.
info
(
`[S3 delete] delete key:
${
key
}
`
);
await
bucket
.
delete
(
key
);
await
bucket
.
delete
(
key
);
addLog
.
info
(
`[S3 delete] delete key:
${
key
}
success`
);
}
}
if
(
keys
)
{
if
(
keys
)
{
addLog
.
info
(
`[S3 delete] delete keys:
${
keys
.
length
}
`
);
const
tasks
:
Promise
<
void
>
[]
=
[];
const
tasks
:
Promise
<
void
>
[]
=
[];
for
(
const
key
of
keys
)
{
for
(
const
key
of
keys
)
{
const
p
=
limit
(()
=>
retryFn
(()
=>
bucket
.
delete
(
key
)));
const
p
=
limit
(()
=>
retryFn
(()
=>
bucket
.
delete
(
key
)));
tasks
.
push
(
p
);
tasks
.
push
(
p
);
}
}
await
Promise
.
all
(
tasks
);
await
Promise
.
all
(
tasks
);
addLog
.
info
(
`[S3 delete] delete keys:
${
keys
.
length
}
success`
);
}
}
if
(
prefix
)
{
if
(
prefix
)
{
addLog
.
info
(
`[S3 delete] delete prefix:
${
prefix
}
`
);
const
tasks
:
Promise
<
void
>
[]
=
[];
const
tasks
:
Promise
<
void
>
[]
=
[];
return
new
Promise
<
void
>
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
<
void
>
(
async
(
resolve
,
reject
)
=>
{
const
stream
=
bucket
.
listObjectsV2
(
prefix
,
true
);
const
stream
=
bucket
.
listObjectsV2
(
prefix
,
true
);
...
@@ -67,16 +73,19 @@ export const startS3DelWorker = async () => {
...
@@ -67,16 +73,19 @@ export const startS3DelWorker = async () => {
const
results
=
await
Promise
.
allSettled
(
tasks
);
const
results
=
await
Promise
.
allSettled
(
tasks
);
const
failed
=
results
.
filter
((
r
)
=>
r
.
status
===
'rejected'
);
const
failed
=
results
.
filter
((
r
)
=>
r
.
status
===
'rejected'
);
if
(
failed
.
length
>
0
)
{
if
(
failed
.
length
>
0
)
{
addLog
.
error
(
`[S3 delete] delete prefix:
${
prefix
}
failed`
);
reject
(
'Some deletes failed'
);
reject
(
'Some deletes failed'
);
}
}
addLog
.
info
(
`[S3 delete] delete prefix:
${
prefix
}
success`
);
resolve
();
resolve
();
}
catch
(
err
)
{
}
catch
(
err
)
{
addLog
.
error
(
`[S3 delete] delete prefix:
${
prefix
}
error`
,
err
);
reject
(
err
);
reject
(
err
);
}
}
});
});
stream
.
on
(
'error'
,
(
err
)
=>
{
stream
.
on
(
'error'
,
(
err
)
=>
{
console
.
error
(
'listObjects stream error'
,
err
);
addLog
.
error
(
`[S3 delete] delete prefix:
${
prefix
}
error`
,
err
);
reject
(
err
);
reject
(
err
);
});
});
});
});
...
...
packages/service/core/chat/chatSchema.ts
View file @
5631ec78
...
@@ -110,6 +110,9 @@ try {
...
@@ -110,6 +110,9 @@ try {
ChatSchema
.
index
({
chatId
:
1
});
ChatSchema
.
index
({
chatId
:
1
});
// get user history
// get user history
ChatSchema
.
index
({
tmbId
:
1
,
appId
:
1
,
deleteTime
:
1
,
top
:
-
1
,
updateTime
:
-
1
});
ChatSchema
.
index
({
tmbId
:
1
,
appId
:
1
,
deleteTime
:
1
,
top
:
-
1
,
updateTime
:
-
1
});
// get share chat history
ChatSchema
.
index
({
shareId
:
1
,
outLinkUid
:
1
,
updateTime
:
-
1
});
// delete by appid; clear history; init chat; update chat; auth chat; get chat;
// delete by appid; clear history; init chat; update chat; auth chat; get chat;
ChatSchema
.
index
({
appId
:
1
,
chatId
:
1
});
ChatSchema
.
index
({
appId
:
1
,
chatId
:
1
});
...
@@ -191,11 +194,8 @@ try {
...
@@ -191,11 +194,8 @@ try {
}
}
);
);
// get share chat history
ChatSchema
.
index
({
shareId
:
1
,
outLinkUid
:
1
,
updateTime
:
-
1
});
// timer, clear history
// timer, clear history
ChatSchema
.
index
({
teamId
:
1
,
updateTime
:
-
1
});
ChatSchema
.
index
({
updateTime
:
-
1
,
teamId
:
1
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
}
}
...
...
packages/service/support/user/audit/schema.ts
View file @
5631ec78
import
{
Schema
,
getMongoLogModel
}
from
'../../../common/mongo'
;
import
{
Schema
,
getMongoLogModel
}
from
'../../../common/mongo'
;
import
{
type
OperationLogSchema
}
from
'@fastgpt/global/support/user/audit/type'
;
import
{
type
TeamAuditSchemaType
}
from
'@fastgpt/global/support/user/audit/type'
;
import
{
AdminAuditEventEnum
,
AuditEventEnum
}
from
'@fastgpt/global/support/user/audit/constants'
;
import
{
AdminAuditEventEnum
,
AuditEventEnum
}
from
'@fastgpt/global/support/user/audit/constants'
;
import
{
import
{
TeamCollectionName
,
TeamCollectionName
,
TeamMemberCollectionName
TeamMemberCollectionName
}
from
'@fastgpt/global/support/user/team/constant'
;
}
from
'@fastgpt/global/support/user/team/constant'
;
export
const
OperationLog
CollectionName
=
'operationLogs'
;
export
const
TeamAudit
CollectionName
=
'operationLogs'
;
const
OperationLog
Schema
=
new
Schema
({
const
TeamAudit
Schema
=
new
Schema
({
tmbId
:
{
tmbId
:
{
type
:
Schema
.
Types
.
ObjectId
,
type
:
Schema
.
Types
.
ObjectId
,
ref
:
TeamMemberCollectionName
,
ref
:
TeamMemberCollectionName
,
...
@@ -34,9 +34,10 @@ const OperationLogSchema = new Schema({
...
@@ -34,9 +34,10 @@ const OperationLogSchema = new Schema({
}
}
});
});
OperationLogSchema
.
index
({
teamId
:
1
,
tmbId
:
1
,
event
:
1
});
TeamAuditSchema
.
index
({
teamId
:
1
,
tmbId
:
1
,
event
:
1
});
TeamAuditSchema
.
index
({
timestamp
:
1
,
teamId
:
1
});
export
const
Mongo
OperationLog
=
getMongoLogModel
<
OperationLogSchema
>
(
export
const
Mongo
TeamAudit
=
getMongoLogModel
<
TeamAuditSchemaType
>
(
OperationLog
CollectionName
,
TeamAudit
CollectionName
,
OperationLog
Schema
TeamAudit
Schema
);
);
packages/service/support/user/audit/util.ts
View file @
5631ec78
import
{
AppTypeEnum
}
from
'@fastgpt/global/core/app/constants'
;
import
{
AppTypeEnum
}
from
'@fastgpt/global/core/app/constants'
;
import
{
DatasetTypeEnum
}
from
'@fastgpt/global/core/dataset/constants'
;
import
{
DatasetTypeEnum
}
from
'@fastgpt/global/core/dataset/constants'
;
import
{
i18nT
}
from
'../../../../web/i18n/utils'
;
import
{
i18nT
}
from
'../../../../web/i18n/utils'
;
import
{
Mongo
OperationLog
}
from
'./schema'
;
import
{
Mongo
TeamAudit
}
from
'./schema'
;
import
type
{
import
type
{
AdminAuditEventEnum
,
AdminAuditEventEnum
,
AuditEventEnum
,
AuditEventEnum
,
...
@@ -86,7 +86,7 @@ export function addAuditLog<T extends AuditEventEnum | AdminAuditEventEnum>({
...
@@ -86,7 +86,7 @@ export function addAuditLog<T extends AuditEventEnum | AdminAuditEventEnum>({
params
?:
any
;
params
?:
any
;
})
{
})
{
retryFn
(()
=>
retryFn
(()
=>
Mongo
OperationLog
.
create
({
Mongo
TeamAudit
.
create
({
tmbId
:
tmbId
,
tmbId
:
tmbId
,
teamId
:
teamId
,
teamId
:
teamId
,
event
,
event
,
...
...
packages/service/support/wallet/sub/schema.ts
View file @
5631ec78
...
@@ -67,18 +67,12 @@ const SubSchema = new Schema({
...
@@ -67,18 +67,12 @@ const SubSchema = new Schema({
customDomain
:
Number
,
customDomain
:
Number
,
// stand sub and extra points sub. Plan total points
// stand sub and extra points sub. Plan total points
totalPoints
:
{
totalPoints
:
Number
,
type
:
Number
},
surplusPoints
:
{
// plan surplus points
// plan surplus points
type
:
Number
surplusPoints
:
Number
,
},
// extra dataset size
// extra dataset size
currentExtraDatasetSize
:
{
currentExtraDatasetSize
:
Number
type
:
Number
}
});
});
try
{
try
{
...
...
projects/app/src/web/support/user/team/operantionLog/api.ts
View file @
5631ec78
import
{
GET
,
POST
,
PUT
}
from
'@/web/common/api/request'
;
import
{
GET
,
POST
,
PUT
}
from
'@/web/common/api/request'
;
import
type
{
PaginationProps
,
PaginationResponse
}
from
'@fastgpt/web/common/fetch/type'
;
import
type
{
PaginationProps
,
PaginationResponse
}
from
'@fastgpt/web/common/fetch/type'
;
import
type
{
Operation
ListItemType
}
from
'@fastgpt/global/support/user/audit/type'
;
import
type
{
TeamAudit
ListItemType
}
from
'@fastgpt/global/support/user/audit/type'
;
import
type
{
AuditEventEnum
}
from
'@fastgpt/global/support/user/audit/constants'
;
import
type
{
AuditEventEnum
}
from
'@fastgpt/global/support/user/audit/constants'
;
export
const
getOperationLogs
=
(
export
const
getOperationLogs
=
(
...
@@ -8,4 +8,4 @@ export const getOperationLogs = (
...
@@ -8,4 +8,4 @@ export const getOperationLogs = (
tmbIds
?:
string
[];
tmbIds
?:
string
[];
events
?:
AuditEventEnum
[];
events
?:
AuditEventEnum
[];
}
}
)
=>
POST
<
PaginationResponse
<
Operation
ListItemType
>>
(
`/proApi/support/user/audit/list`
,
props
);
)
=>
POST
<
PaginationResponse
<
TeamAudit
ListItemType
>>
(
`/proApi/support/user/audit/list`
,
props
);
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