Skip to content

Commit

Permalink
fix: plugin update
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Mar 24, 2024
1 parent eab3fae commit a9c2bc2
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 12 deletions.
1 change: 0 additions & 1 deletion packages/service/core/workflow/dispatch/plugin/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
mode,
teamId,
tmbId,
module,
params: { pluginId, ...data }
} = props;

Expand Down
5 changes: 3 additions & 2 deletions packages/service/core/workflow/dispatch/tools/http468.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async function fetchData({
body: Record<string, any>;
params: Record<string, any>;
}): Promise<Record<string, any>> {
const { data: response } = await axios<Record<string, any>>({
const { data: response } = await axios({
method,
baseURL: `http://${SERVICE_LOCAL_HOST}`,
url,
Expand Down Expand Up @@ -241,7 +241,8 @@ async function fetchData({
};

return {
formatResponse: parseJson(response),
formatResponse:
typeof response === 'object' && !Array.isArray(response) ? parseJson(response) : {},
rawResponse: response
};
}
Expand Down
1 change: 0 additions & 1 deletion packages/service/support/user/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export async function getUserDetail({
_id: user._id,
username: user.username,
avatar: user.avatar,
balance: user.balance,
timezone: user.timezone,
promotionRate: user.promotionRate,
openaiAccount: user.openaiAccount,
Expand Down
5 changes: 2 additions & 3 deletions projects/app/public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,7 @@
"success": "开始同步"
}
},
"training": {
}
"training": {}
},
"data": {
"Auxiliary Data": "辅助数据",
Expand Down Expand Up @@ -1421,7 +1420,7 @@
"experience": "体验版",
"experience desc": "",
"free": "免费版",
"free desc": "每月均可免费使用基础功能,15天无使用记录时,将会清除知识库",
"free desc": "每月均可免费使用基础功能,30天无使用记录时,将会清除知识库",
"team": "团队版"
},
"type": {
Expand Down
3 changes: 2 additions & 1 deletion projects/app/src/components/ChatBox/components/ChatItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ ${JSON.stringify(questionGuides)}`;
return tool.response;
}
})();

return (
<Box key={tool.id}>
<Accordion allowToggle>
Expand Down Expand Up @@ -169,7 +170,7 @@ ${JSON.stringify(questionGuides)}`;
maxH={'500px'}
overflowY={'auto'}
>
{toolParams && (
{toolParams && toolParams !== '{}' && (
<Markdown
source={`~~~json#Input
${toolParams}`}
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/account/components/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ const PlanUsage = () => {
</Flex>
{isFreeTeam && (
<Box mt="2" color={'#485264'} fontSize="sm">
免费版用户15天无任何使用记录时,系统会自动清理账号知识库。
免费版用户30天无任何使用记录时,系统会自动清理账号知识库。
</Box>
)}
</Box>
Expand Down
16 changes: 14 additions & 2 deletions projects/app/src/pages/api/core/plugin/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<

const { teamId, tmbId } = await authPluginCrud({ req, authToken: true, id, per: 'owner' });

const updateData = {
name: props.name,
intro: props.intro,
avatar: props.avatar,
parentId: props.parentId,
...(props.modules &&
props.modules.length > 0 && {
modules: props.modules
}),
metadata: props.metadata
};

if (props.metadata?.apiSchemaStr) {
await mongoSessionRun(async (session) => {
// update children
Expand All @@ -26,13 +38,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
parent: body,
session
});
await MongoPlugin.findByIdAndUpdate(id, props, { session });
await MongoPlugin.findByIdAndUpdate(id, updateData, { session });
});

jsonRes(res, {});
} else {
jsonRes(res, {
data: await MongoPlugin.findByIdAndUpdate(id, props)
data: await MongoPlugin.findByIdAndUpdate(id, updateData)
});
}
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/price/components/FAQ.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const FAQ = () => {
},
{
title: '免费版数据会清除么?',
desc: '免费版用户(免费版且未购买额外套餐)15天无使用记录后,系统会自动清除账号下所有知识库内容。'
desc: '免费版用户(免费版且未购买额外套餐)30天无使用记录后,系统会自动清除账号下所有知识库内容。'
}
];

Expand Down

0 comments on commit a9c2bc2

Please sign in to comment.