Skip to content

Commit

Permalink
fix feckbackMoal auth bug (labring#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-and-liu authored Mar 15, 2024
1 parent 534748a commit 8005929
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/global/core/chat/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export type UpdateChatFeedbackProps = {
chatId: string;
chatItemId: string;
shareId?: string;
teamId?: string;
teamToken?: string;
outLinkUid?: string;
userBadFeedback?: string;
userGoodFeedback?: string;
Expand Down
6 changes: 6 additions & 0 deletions projects/app/src/components/ChatBox/FeedbackModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const FeedbackModal = ({
appId,
chatId,
chatItemId,
teamId,
teamToken,
shareId,
outLinkUid,
onSuccess,
Expand All @@ -18,6 +20,8 @@ const FeedbackModal = ({
chatId: string;
chatItemId: string;
shareId?: string;
teamId?: string;
teamToken?: string;
outLinkUid?: string;
onSuccess: (e: string) => void;
onClose: () => void;
Expand All @@ -33,6 +37,8 @@ const FeedbackModal = ({
chatId,
chatItemId,
shareId,
teamId,
teamToken,
outLinkUid,
userBadFeedback: val
});
Expand Down
9 changes: 9 additions & 0 deletions projects/app/src/components/ChatBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { SseResponseEventEnum } from '@fastgpt/global/core/module/runtime/consta
import ChatItem from './components/ChatItem';

import dynamic from 'next/dynamic';
import team from '@fastgpt/global/common/error/code/team';
const ResponseTags = dynamic(() => import('./ResponseTags'));
const FeedbackModal = dynamic(() => import('./FeedbackModal'));
const ReadFeedbackModal = dynamic(() => import('./ReadFeedbackModal'));
Expand Down Expand Up @@ -630,6 +631,8 @@ const ChatBox = (
updateChatUserFeedback({
appId,
chatId,
teamId,
teamToken,
chatItemId: chat.dataId,
shareId,
outLinkUid,
Expand All @@ -654,6 +657,8 @@ const ChatBox = (
);
updateChatUserFeedback({
appId,
teamId,
teamToken,
chatId,
chatItemId: chat.dataId,
userGoodFeedback: undefined
Expand Down Expand Up @@ -687,6 +692,8 @@ const ChatBox = (
chatId,
chatItemId: chat.dataId,
shareId,
teamId,
teamToken,
outLinkUid
});
} catch (error) {}
Expand Down Expand Up @@ -955,6 +962,8 @@ const ChatBox = (
{!!feedbackId && chatId && appId && (
<FeedbackModal
appId={appId}
teamId={teamId}
teamToken={teamToken}
chatId={chatId}
chatItemId={feedbackId}
shareId={shareId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ import { autChatCrud } from '@/service/support/permission/auth/chat';

/* 初始化我的聊天框,需要身份验证 */
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { appId, chatId, chatItemId, shareId, outLinkUid, userBadFeedback, userGoodFeedback } =
req.body as UpdateChatFeedbackProps;
const {
appId,
chatId,
chatItemId,
shareId,
teamId,
teamToken,
outLinkUid,
userBadFeedback,
userGoodFeedback
} = req.body as UpdateChatFeedbackProps;

try {
await connectToDatabase();
Expand All @@ -17,6 +26,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
req,
authToken: true,
appId,
teamId,
teamToken,
chatId,
shareId,
outLinkUid,
Expand Down

0 comments on commit 8005929

Please sign in to comment.