mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-16 16:04:34 +00:00
fix: modules
This commit is contained in:
@@ -57,7 +57,7 @@ const MermaidBlock = ({ code }: { code: string }) => {
|
|||||||
const { svg } = await mermaid.render(`mermaid-${Date.now()}`, formatCode);
|
const { svg } = await mermaid.render(`mermaid-${Date.now()}`, formatCode);
|
||||||
setSvg(svg);
|
setSvg(svg);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.log('[Mermaid] ', e?.message);
|
// console.log('[Mermaid] ', e?.message);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}, [code]);
|
}, [code]);
|
||||||
|
@@ -615,6 +615,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
await authUser({ req, authRoot: true });
|
await authUser({ req, authRoot: true });
|
||||||
await connectToDatabase();
|
await connectToDatabase();
|
||||||
|
|
||||||
|
const { limit = 1000 } = req.body as { limit: number };
|
||||||
|
|
||||||
// 遍历所有的 app
|
// 遍历所有的 app
|
||||||
const apps = await App.find(
|
const apps = await App.find(
|
||||||
{
|
{
|
||||||
@@ -623,7 +625,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
// userId: '63f9a14228d2a688d8dc9e1b'
|
// userId: '63f9a14228d2a688d8dc9e1b'
|
||||||
},
|
},
|
||||||
'_id chat'
|
'_id chat'
|
||||||
);
|
).limit(limit);
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
apps.map(async (app) => {
|
apps.map(async (app) => {
|
||||||
|
@@ -264,7 +264,7 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
|
|||||||
setLoaded(true);
|
setLoaded(true);
|
||||||
onFixView();
|
onFixView();
|
||||||
},
|
},
|
||||||
[onDelConnect, setEdges, setNodes, onChangeNode, onDelNode]
|
[onDelConnect, setEdges, setNodes, onFixView, onChangeNode, onDelNode]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@@ -2,6 +2,7 @@ import { connectToDatabase, Bill, User, ShareChat } from '../mongo';
|
|||||||
import { BillSourceEnum } from '@/constants/user';
|
import { BillSourceEnum } from '@/constants/user';
|
||||||
import { getModel } from '../utils/data';
|
import { getModel } from '../utils/data';
|
||||||
import type { BillListItemType } from '@/types/mongoSchema';
|
import type { BillListItemType } from '@/types/mongoSchema';
|
||||||
|
import { formatPrice } from '@/utils/user';
|
||||||
|
|
||||||
export const createTaskBill = async ({
|
export const createTaskBill = async ({
|
||||||
appName,
|
appName,
|
||||||
@@ -62,7 +63,7 @@ export const finishTaskBill = async ({ billId }: { billId: string }) => {
|
|||||||
if (!res) return;
|
if (!res) return;
|
||||||
const total = res.list.reduce((sum, item) => sum + item.amount, 0) || 0;
|
const total = res.list.reduce((sum, item) => sum + item.amount, 0) || 0;
|
||||||
|
|
||||||
console.log('finish bill:', total);
|
console.log('finish bill:', formatPrice(total));
|
||||||
|
|
||||||
// 账号扣费
|
// 账号扣费
|
||||||
await User.findByIdAndUpdate(res.userId, {
|
await User.findByIdAndUpdate(res.userId, {
|
||||||
|
@@ -104,15 +104,26 @@ export const appModule2FlowNode = ({
|
|||||||
intro: template.intro,
|
intro: template.intro,
|
||||||
type: template.type,
|
type: template.type,
|
||||||
url: template.url,
|
url: template.url,
|
||||||
inputs: template.inputs.map((templateInput) => ({
|
inputs: template.inputs.map((templateInput) => {
|
||||||
...templateInput,
|
// use latest inputs
|
||||||
value:
|
const itemInput = item.inputs.find((item) => item.key === templateInput.key) || templateInput;
|
||||||
item.inputs.find((item) => item.key === templateInput.key)?.value || templateInput.value
|
return {
|
||||||
})),
|
...templateInput,
|
||||||
outputs: template.outputs.map((templateOutput) => ({
|
key: itemInput.key,
|
||||||
...templateOutput,
|
value: itemInput.value
|
||||||
targets: item.outputs.find((item) => item.key === templateOutput.key)?.targets || []
|
};
|
||||||
}))
|
}),
|
||||||
|
outputs: item.outputs.map((itemOutput) => {
|
||||||
|
// unChange outputs
|
||||||
|
const templateOutput =
|
||||||
|
template.outputs.find((item) => item.key === itemOutput.key) || itemOutput;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...templateOutput,
|
||||||
|
key: itemOutput.key,
|
||||||
|
targets: itemOutput.targets || []
|
||||||
|
};
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user