Skip to content

Commit cb56d1e

Browse files
authored
fix: ts (#3296)
1 parent f28b7e4 commit cb56d1e

File tree

6 files changed

+11
-1
lines changed

6 files changed

+11
-1
lines changed

projects/app/src/components/core/chat/ChatContainer/ChatBox/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ enum FeedbackTypeEnum {
8383

8484
type Props = OutLinkChatAuthProps &
8585
ChatProviderProps & {
86+
isReady: boolean;
8687
feedbackType?: `${FeedbackTypeEnum}`;
8788
showMarkIcon?: boolean; // admin mark dataset
8889
showVoiceIcon?: boolean;
@@ -97,6 +98,7 @@ type Props = OutLinkChatAuthProps &
9798
};
9899

99100
const ChatBox = ({
101+
isReady = true,
100102
feedbackType = FeedbackTypeEnum.hidden,
101103
showMarkIcon = false,
102104
showVoiceIcon = true,
@@ -829,11 +831,12 @@ const ChatBox = ({
829831
eventBus.off(EventNameEnum.sendQuestion);
830832
eventBus.off(EventNameEnum.editQuestion);
831833
};
832-
}, [chatBoxData, resetInputVal, sendPrompt]);
834+
}, [isReady, resetInputVal, sendPrompt]);
833835

834836
// Auto send prompt
835837
useEffect(() => {
836838
if (
839+
isReady &&
837840
chatBoxData?.app?.chatConfig?.autoExecute?.open &&
838841
chatStarted &&
839842
chatRecords.length === 0 &&
@@ -845,6 +848,7 @@ const ChatBox = ({
845848
});
846849
}
847850
}, [
851+
isReady,
848852
chatStarted,
849853
chatRecords.length,
850854
isChatRecordsLoaded,

projects/app/src/pages/app/detail/components/Logs/DetailLogsModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ const DetailLogsModal = ({ appId, chatId, onClose }: Props) => {
154154
</Box>
155155
) : (
156156
<ChatBox
157+
isReady
157158
appId={appId}
158159
chatId={chatId}
159160
feedbackType={'admin'}

projects/app/src/pages/app/detail/components/useChatTest.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const useChatTest = ({
8282
useEffect(() => {
8383
setChatBoxData({
8484
userAvatar: userInfo?.avatar,
85+
appId: appId,
8586
app: {
8687
chatConfig,
8788
name: appDetail.name,
@@ -94,6 +95,7 @@ export const useChatTest = ({
9495
appDetail.avatar,
9596
appDetail.name,
9697
appDetail.type,
98+
appId,
9799
chatConfig,
98100
pluginInputs,
99101
setChatBoxData,

projects/app/src/pages/chat/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
209209
chatType={'chat'}
210210
showRawSource
211211
showNodeStatus
212+
isReady={!loading}
212213
/>
213214
)}
214215
</Box>

projects/app/src/pages/chat/share.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ const OutLink = (props: Props) => {
278278
/>
279279
) : (
280280
<ChatBox
281+
isReady={!loading}
281282
appId={appId}
282283
chatId={chatId}
283284
outLinkAuthData={outLinkAuthData}

projects/app/src/pages/chat/team.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
218218
/>
219219
) : (
220220
<ChatBox
221+
isReady={!loading}
221222
appId={appId}
222223
chatId={chatId}
223224
outLinkAuthData={outLinkAuthData}

0 commit comments

Comments
 (0)