mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 15:11:13 +00:00
perf: init shell (#5651)
* perf: init shell * fix: tool run select * border radius
This commit is contained in:
@@ -94,13 +94,19 @@ const ConfigToolModal = ({
|
||||
<Controller
|
||||
control={control}
|
||||
name={input.key}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
rules={{
|
||||
required: true
|
||||
}}
|
||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||
<Box>
|
||||
<FormLabel mb={1}>{t('common:secret_key')}</FormLabel>
|
||||
<FormLabel mb={1} required>
|
||||
{t('common:secret_key')}
|
||||
</FormLabel>
|
||||
<Button
|
||||
variant={'whiteBase'}
|
||||
border={'base'}
|
||||
borderRadius={'md'}
|
||||
borderColor={error ? 'red.500' : 'borderColor.low'}
|
||||
leftIcon={
|
||||
<Box w={'6px'} h={'6px'} bg={'primary.600'} borderRadius={'md'} />
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
import { batchRun } from '@fastgpt/global/common/system/utils';
|
||||
import { OwnerRoleVal, PerResourceTypeEnum } from '@fastgpt/global/support/permission/constant';
|
||||
import { MongoApp } from '@fastgpt/service/core/app/schema';
|
||||
import { MongoDataset } from '@fastgpt/service/core/dataset/schema';
|
||||
@@ -32,51 +33,60 @@ async function handler(
|
||||
MongoTeamMember.find({ role: 'owner' }, '_id teamId').lean()
|
||||
]);
|
||||
|
||||
await MongoResourcePermission.bulkWrite(
|
||||
apps.map((app) => ({
|
||||
updateOne: {
|
||||
filter: {
|
||||
resourceId: app._id,
|
||||
resourceType: PerResourceTypeEnum.app,
|
||||
teamId: app.teamId,
|
||||
tmbId: app.tmbId
|
||||
},
|
||||
update: {
|
||||
permission: OwnerRoleVal
|
||||
},
|
||||
upsert: true
|
||||
}
|
||||
}))
|
||||
);
|
||||
|
||||
await MongoResourcePermission.bulkWrite(
|
||||
datasets.map((dataset) => ({
|
||||
updateOne: {
|
||||
filter: {
|
||||
resourceId: dataset._id,
|
||||
resourceType: PerResourceTypeEnum.dataset,
|
||||
teamId: dataset.teamId,
|
||||
tmbId: dataset.tmbId
|
||||
},
|
||||
update: {
|
||||
permission: OwnerRoleVal
|
||||
},
|
||||
upsert: true
|
||||
}
|
||||
}))
|
||||
);
|
||||
|
||||
await MongoResourcePermission.bulkWrite(
|
||||
tmbs.map((team) => ({
|
||||
deleteOne: {
|
||||
filter: {
|
||||
resourceType: PerResourceTypeEnum.team,
|
||||
teamId: team.teamId,
|
||||
tmbId: team._id
|
||||
for (let i = 0; i < apps.length; i += 10000) {
|
||||
const appList = apps.slice(i, i + 10000);
|
||||
await MongoResourcePermission.bulkWrite(
|
||||
appList.map((app) => ({
|
||||
updateOne: {
|
||||
filter: {
|
||||
resourceId: app._id,
|
||||
resourceType: PerResourceTypeEnum.app,
|
||||
teamId: app.teamId,
|
||||
tmbId: app.tmbId
|
||||
},
|
||||
update: {
|
||||
permission: OwnerRoleVal
|
||||
},
|
||||
upsert: true
|
||||
}
|
||||
}
|
||||
}))
|
||||
);
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
for (let i = 0; i < datasets.length; i += 10000) {
|
||||
const datasetList = datasets.slice(i, i + 10000);
|
||||
await MongoResourcePermission.bulkWrite(
|
||||
datasetList.map((dataset) => ({
|
||||
updateOne: {
|
||||
filter: {
|
||||
resourceId: dataset._id,
|
||||
resourceType: PerResourceTypeEnum.dataset,
|
||||
teamId: dataset.teamId,
|
||||
tmbId: dataset.tmbId
|
||||
},
|
||||
update: {
|
||||
permission: OwnerRoleVal
|
||||
},
|
||||
upsert: true
|
||||
}
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
for (let i = 0; i < tmbs.length; i += 10000) {
|
||||
const tmbList = tmbs.slice(i, i + 10000);
|
||||
await MongoResourcePermission.bulkWrite(
|
||||
tmbList.map((team) => ({
|
||||
deleteOne: {
|
||||
filter: {
|
||||
resourceType: PerResourceTypeEnum.team,
|
||||
teamId: team.teamId,
|
||||
tmbId: team._id
|
||||
}
|
||||
}
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
message: 'Success'
|
||||
|
Reference in New Issue
Block a user