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