Skip to content

Commit

Permalink
fix: ts (#3296)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu authored Dec 2, 2024
1 parent f28b7e4 commit cb56d1e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ enum FeedbackTypeEnum {

type Props = OutLinkChatAuthProps &
ChatProviderProps & {
isReady: boolean;
feedbackType?: `${FeedbackTypeEnum}`;
showMarkIcon?: boolean; // admin mark dataset
showVoiceIcon?: boolean;
Expand All @@ -97,6 +98,7 @@ type Props = OutLinkChatAuthProps &
};

const ChatBox = ({
isReady = true,
feedbackType = FeedbackTypeEnum.hidden,
showMarkIcon = false,
showVoiceIcon = true,
Expand Down Expand Up @@ -829,11 +831,12 @@ const ChatBox = ({
eventBus.off(EventNameEnum.sendQuestion);
eventBus.off(EventNameEnum.editQuestion);
};
}, [chatBoxData, resetInputVal, sendPrompt]);
}, [isReady, resetInputVal, sendPrompt]);

// Auto send prompt
useEffect(() => {
if (
isReady &&
chatBoxData?.app?.chatConfig?.autoExecute?.open &&
chatStarted &&
chatRecords.length === 0 &&
Expand All @@ -845,6 +848,7 @@ const ChatBox = ({
});
}
}, [
isReady,
chatStarted,
chatRecords.length,
isChatRecordsLoaded,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const DetailLogsModal = ({ appId, chatId, onClose }: Props) => {
</Box>
) : (
<ChatBox
isReady
appId={appId}
chatId={chatId}
feedbackType={'admin'}
Expand Down
2 changes: 2 additions & 0 deletions projects/app/src/pages/app/detail/components/useChatTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const useChatTest = ({
useEffect(() => {
setChatBoxData({
userAvatar: userInfo?.avatar,
appId: appId,
app: {
chatConfig,
name: appDetail.name,
Expand All @@ -94,6 +95,7 @@ export const useChatTest = ({
appDetail.avatar,
appDetail.name,
appDetail.type,
appId,
chatConfig,
pluginInputs,
setChatBoxData,
Expand Down
1 change: 1 addition & 0 deletions projects/app/src/pages/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
chatType={'chat'}
showRawSource
showNodeStatus
isReady={!loading}
/>
)}
</Box>
Expand Down
1 change: 1 addition & 0 deletions projects/app/src/pages/chat/share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ const OutLink = (props: Props) => {
/>
) : (
<ChatBox
isReady={!loading}
appId={appId}
chatId={chatId}
outLinkAuthData={outLinkAuthData}
Expand Down
1 change: 1 addition & 0 deletions projects/app/src/pages/chat/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
/>
) : (
<ChatBox
isReady={!loading}
appId={appId}
chatId={chatId}
outLinkAuthData={outLinkAuthData}
Expand Down

0 comments on commit cb56d1e

Please sign in to comment.