mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 00:17:31 +00:00
Add share link hook (#351)
This commit is contained in:
@@ -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, {
|
||||
|
Reference in New Issue
Block a user