v4.6.4-Outlink (#589)

This commit is contained in:
Archer
2023-12-12 14:42:20 +08:00
committed by GitHub
parent d2d7eac9e0
commit e18c79ca71
79 changed files with 1094 additions and 762 deletions

View File

@@ -6,11 +6,13 @@ import { useTranslation } from 'next-i18next';
import { updateChatUserFeedback } from '@/web/core/chat/api';
const FeedbackModal = ({
appId,
chatId,
chatItemId,
onSuccess,
onClose
}: {
appId: string;
chatId: string;
chatItemId: string;
onSuccess: (e: string) => void;
@@ -23,6 +25,7 @@ const FeedbackModal = ({
mutationFn: async () => {
const val = ref.current?.value || t('core.chat.feedback.No Content');
return updateChatUserFeedback({
appId,
chatId,
chatItemId,
userBadFeedback: val

View File

@@ -429,7 +429,7 @@ ${images.map((img) => JSON.stringify({ src: img.src })).join('\n')}
>
{isChatting ? (
<MyIcon
className={styles.stopIcon}
animation={'zoomStopIcon 0.4s infinite alternate'}
width={['22px', '25px']}
height={['22px', '25px']}
cursor={'pointer'}

View File

@@ -1,7 +1,3 @@
.stopIcon {
animation: zoomStopIcon 0.4s infinite alternate;
}
.statusAnimation {
animation: statusBox 0.8s linear infinite alternate;
}

View File

@@ -102,9 +102,13 @@ type Props = {
userGuideModule?: ModuleItemType;
showFileSelector?: boolean;
active?: boolean; // can use
// not chat test params
appId?: string;
chatId?: string;
shareId?: string;
outLinkUid?: string;
onUpdateVariable?: (e: Record<string, any>) => void;
onStartChat?: (e: StartChatFnProps) => Promise<{
responseText: string;
@@ -125,6 +129,7 @@ const ChatBox = (
userGuideModule,
showFileSelector,
active = true,
appId,
chatId,
shareId,
outLinkUid,
@@ -711,7 +716,7 @@ const ChatBox = (
return;
}
return () => {
if (!item.dataId || !chatId) return;
if (!item.dataId || !chatId || !appId) return;
const isGoodFeedback = !!item.userGoodFeedback;
setChatHistory((state) =>
@@ -726,6 +731,7 @@ const ChatBox = (
);
try {
updateChatUserFeedback({
appId,
chatId,
chatItemId: item.dataId,
shareId,
@@ -738,7 +744,7 @@ const ChatBox = (
onCloseUserLike={
feedbackType === FeedbackTypeEnum.admin
? () => {
if (!item.dataId || !chatId) return;
if (!item.dataId || !chatId || !appId) return;
setChatHistory((state) =>
state.map((chatItem) =>
chatItem.dataId === item.dataId
@@ -747,6 +753,7 @@ const ChatBox = (
)
);
updateChatUserFeedback({
appId,
chatId,
chatItemId: item.dataId,
userGoodFeedback: undefined
@@ -760,7 +767,7 @@ const ChatBox = (
}
if (item.userBadFeedback) {
return () => {
if (!item.dataId || !chatId) return;
if (!item.dataId || !chatId || !appId) return;
setChatHistory((state) =>
state.map((chatItem) =>
chatItem.dataId === item.dataId
@@ -770,6 +777,7 @@ const ChatBox = (
);
try {
updateChatUserFeedback({
appId,
chatId,
chatItemId: item.dataId,
shareId,
@@ -886,8 +894,9 @@ const ChatBox = (
/>
) : null}
{/* user feedback modal */}
{!!feedbackId && chatId && (
{!!feedbackId && chatId && appId && (
<FeedbackModal
appId={appId}
chatId={chatId}
chatItemId={feedbackId}
onClose={() => setFeedbackId(undefined)}
@@ -915,8 +924,9 @@ const ChatBox = (
)
);
try {
if (!chatId) return;
if (!chatId || !appId) return;
updateChatUserFeedback({
appId,
chatId,
chatItemId: readFeedbackData.chatItemId
});
@@ -948,8 +958,9 @@ const ChatBox = (
)
);
if (readFeedbackData && chatId) {
if (readFeedbackData && chatId && appId) {
updateChatUserFeedback({
appId,
chatId,
chatItemId: readFeedbackData.chatItemId,
userBadFeedback: undefined