Add share link hook (#351)

This commit is contained in:
Archer
2023-09-25 23:12:42 +08:00
committed by GitHub
parent 9136c9306a
commit 63cd379682
29 changed files with 430 additions and 98 deletions

View File

@@ -5,12 +5,14 @@ import type { InitShareChatResponse } from '@/api/response/chat';
import { authApp } from '@/service/utils/auth';
import { HUMAN_ICON } from '@/constants/chat';
import { getChatModelNameList, getSpecialModule } from '@/components/ChatBox/utils';
import { authShareChatInit } from '@/service/support/outLink/auth';
/* init share chat window */
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
let { shareId } = req.query as {
let { shareId, authToken } = req.query as {
shareId: string;
authToken?: string;
};
if (!shareId) {
@@ -36,7 +38,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
userId: String(shareChat.userId),
authOwner: false
}),
User.findById(shareChat.userId, 'avatar')
User.findById(shareChat.userId, 'avatar'),
authShareChatInit(authToken, shareChat.limit?.hookUrl)
]);
jsonRes<InitShareChatResponse>(res, {