diff --git a/client/public/imgs/errImg.png b/client/public/imgs/errImg.png
new file mode 100644
index 000000000..ee39efa4d
Binary files /dev/null and b/client/public/imgs/errImg.png differ
diff --git a/client/src/components/Markdown/Image.tsx b/client/src/components/Markdown/Image.tsx
new file mode 100644
index 000000000..f8187a20c
--- /dev/null
+++ b/client/src/components/Markdown/Image.tsx
@@ -0,0 +1,19 @@
+import React, { useState } from 'react';
+import { Image, Skeleton } from '@chakra-ui/react';
+
+const MdImage = ({ src }: { src: string }) => {
+ const [isLoading, setIsLoading] = useState(true);
+ return (
+
+ setIsLoading(false)}
+ onError={() => setIsLoading(false)}
+ />
+
+ );
+};
+
+export default MdImage;
diff --git a/client/src/components/Markdown/index.tsx b/client/src/components/Markdown/index.tsx
index 9926ec45d..65dba606e 100644
--- a/client/src/components/Markdown/index.tsx
+++ b/client/src/components/Markdown/index.tsx
@@ -10,6 +10,7 @@ import styles from './index.module.scss';
import CodeLight from './codeLight';
import Loading from './Loading';
import MermaidCodeBlock from './MermaidCodeBlock';
+import MdImage from './Image';
const Markdown = ({
source,
@@ -33,6 +34,9 @@ const Markdown = ({
rehypePlugins={[rehypeKatex]}
components={{
pre: 'div',
+ img({ src = '' }) {
+ return ;
+ },
code({ node, inline, className, children, ...props }) {
const match = /language-(\w+)/.exec(className || '');
diff --git a/client/src/pages/api/openapi/kb/pushData.ts b/client/src/pages/api/openapi/kb/pushData.ts
index 7ca3b8e4f..799824ff4 100644
--- a/client/src/pages/api/openapi/kb/pushData.ts
+++ b/client/src/pages/api/openapi/kb/pushData.ts
@@ -73,6 +73,9 @@ export async function pushDataToKb({
const set = new Set();
const filterData: DateItemType[] = [];
+ const time = Date.now();
+ console.log('push data', data.length);
+
data.forEach((item) => {
const text = item.q + item.a;
@@ -153,6 +156,8 @@ export async function pushDataToKb({
insertData.length > 0 && startQueue();
+ console.log('push data finish', Date.now() - time);
+
return {
insertLen: insertData.length
};
diff --git a/client/src/pages/api/user/checkPayResult.ts b/client/src/pages/api/user/checkPayResult.ts
index 3b25d02d2..a6ea573e0 100644
--- a/client/src/pages/api/user/checkPayResult.ts
+++ b/client/src/pages/api/user/checkPayResult.ts
@@ -12,7 +12,7 @@ import { startQueue } from '@/service/utils/tools';
/* 校验支付结果 */
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
- let { payId } = req.query as { payId: string };
+ const { payId } = req.query as { payId: string };
const { userId } = await authUser({ req, authToken: true });
@@ -34,10 +34,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
throw new Error('找不到用户');
}
// 获取邀请者
- let inviter: UserModelSchema | null = null;
- if (user.inviterId) {
- inviter = await User.findById(user.inviterId);
- }
+ const inviter = await (async () => {
+ if (user.inviterId) {
+ return User.findById(user.inviterId, '_id promotion');
+ }
+ return null;
+ })();
const payRes = await getPayResult(payOrder.orderId);
@@ -79,22 +81,28 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
unlockTask(userId);
}
} catch (error) {
- await Pay.findByIdAndUpdate(payId, {
- status: 'NOTPAY'
- });
console.log(error);
+ try {
+ await Pay.findByIdAndUpdate(payId, {
+ status: 'NOTPAY'
+ });
+ } catch (error) {}
}
- } else if (payRes.trade_state === 'CLOSED' || diffInHours > 24) {
+ return jsonRes(res, {
+ code: 500,
+ data: '更新订单失败,请重试'
+ });
+ }
+ if (payRes.trade_state === 'CLOSED' || diffInHours > 24) {
// 订单已关闭
await Pay.findByIdAndUpdate(payId, {
status: 'CLOSED'
});
- jsonRes(res, {
+ return jsonRes(res, {
data: '订单已过期'
});
- } else {
- throw new Error(payRes?.trade_state_desc || '订单无效');
}
+ throw new Error(payRes?.trade_state_desc || '订单无效');
} catch (err) {
// console.log(err);
jsonRes(res, {
diff --git a/client/src/pages/model/components/detail/components/ModelEditForm.tsx b/client/src/pages/model/components/detail/components/ModelEditForm.tsx
index 965db2630..aa1c24904 100644
--- a/client/src/pages/model/components/detail/components/ModelEditForm.tsx
+++ b/client/src/pages/model/components/detail/components/ModelEditForm.tsx
@@ -182,7 +182,7 @@ ${e.password ? `密码为: ${e.password}` : ''}`;
基本信息
- modelId
+ AppId
{getValues('_id')}
diff --git a/client/src/pages/number/components/PayModal.tsx b/client/src/pages/number/components/PayModal.tsx
index 6b7ba0b33..583e9dc70 100644
--- a/client/src/pages/number/components/PayModal.tsx
+++ b/client/src/pages/number/components/PayModal.tsx
@@ -58,7 +58,7 @@ const PayModal = ({ onClose }: { onClose: () => void }) => {
},
{
enabled: !!payId,
- refetchInterval: 2000,
+ refetchInterval: 3000,
onSuccess(res) {
if (!res) return;
toast({
diff --git a/client/src/service/mongo.ts b/client/src/service/mongo.ts
index a1b6cbbc4..df32a068b 100644
--- a/client/src/service/mongo.ts
+++ b/client/src/service/mongo.ts
@@ -39,9 +39,9 @@ export async function connectToDatabase(): Promise {
global.mongodb = await mongoose.connect(process.env.MONGODB_URI as string, {
bufferCommands: true,
dbName: process.env.MONGODB_NAME,
- maxPoolSize: 5,
- minPoolSize: 1,
- maxConnecting: 5
+ maxConnecting: 30,
+ maxPoolSize: 30,
+ minPoolSize: 10
});
console.log('mongo connected');
} catch (error) {