diff --git a/client/src/components/Markdown/img/MermaidCodeBlock.tsx b/client/src/components/Markdown/img/MermaidCodeBlock.tsx index 70374fe83..4ade4670d 100644 --- a/client/src/components/Markdown/img/MermaidCodeBlock.tsx +++ b/client/src/components/Markdown/img/MermaidCodeBlock.tsx @@ -57,7 +57,7 @@ const MermaidBlock = ({ code }: { code: string }) => { const { svg } = await mermaid.render(`mermaid-${Date.now()}`, formatCode); setSvg(svg); } catch (e: any) { - console.log('[Mermaid] ', e?.message); + // console.log('[Mermaid] ', e?.message); } })(); }, [code]); diff --git a/client/src/pages/api/admin/initv4.ts b/client/src/pages/api/admin/initv4.ts index 2069fb1f4..41b1da6f3 100644 --- a/client/src/pages/api/admin/initv4.ts +++ b/client/src/pages/api/admin/initv4.ts @@ -615,6 +615,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) await authUser({ req, authRoot: true }); await connectToDatabase(); + const { limit = 1000 } = req.body as { limit: number }; + // 遍历所有的 app const apps = await App.find( { @@ -623,7 +625,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) // userId: '63f9a14228d2a688d8dc9e1b' }, '_id chat' - ); + ).limit(limit); await Promise.all( apps.map(async (app) => { diff --git a/client/src/pages/app/detail/components/edit/index.tsx b/client/src/pages/app/detail/components/edit/index.tsx index 6fbedef1a..bcbb76312 100644 --- a/client/src/pages/app/detail/components/edit/index.tsx +++ b/client/src/pages/app/detail/components/edit/index.tsx @@ -264,7 +264,7 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => { setLoaded(true); onFixView(); }, - [onDelConnect, setEdges, setNodes, onChangeNode, onDelNode] + [onDelConnect, setEdges, setNodes, onFixView, onChangeNode, onDelNode] ); useEffect(() => { diff --git a/client/src/service/events/pushBill.ts b/client/src/service/events/pushBill.ts index 81ff070f8..611f2e385 100644 --- a/client/src/service/events/pushBill.ts +++ b/client/src/service/events/pushBill.ts @@ -2,6 +2,7 @@ import { connectToDatabase, Bill, User, ShareChat } from '../mongo'; import { BillSourceEnum } from '@/constants/user'; import { getModel } from '../utils/data'; import type { BillListItemType } from '@/types/mongoSchema'; +import { formatPrice } from '@/utils/user'; export const createTaskBill = async ({ appName, @@ -62,7 +63,7 @@ export const finishTaskBill = async ({ billId }: { billId: string }) => { if (!res) return; 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, { diff --git a/client/src/utils/adapt.ts b/client/src/utils/adapt.ts index b57e5e989..52e23e3ee 100644 --- a/client/src/utils/adapt.ts +++ b/client/src/utils/adapt.ts @@ -104,15 +104,26 @@ export const appModule2FlowNode = ({ intro: template.intro, type: template.type, url: template.url, - inputs: template.inputs.map((templateInput) => ({ - ...templateInput, - value: - item.inputs.find((item) => item.key === templateInput.key)?.value || templateInput.value - })), - outputs: template.outputs.map((templateOutput) => ({ - ...templateOutput, - targets: item.outputs.find((item) => item.key === templateOutput.key)?.targets || [] - })) + inputs: template.inputs.map((templateInput) => { + // use latest inputs + const itemInput = item.inputs.find((item) => item.key === templateInput.key) || templateInput; + return { + ...templateInput, + key: itemInput.key, + value: itemInput.value + }; + }), + 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 {