This commit is contained in:
Archer
2024-12-03 00:11:38 +08:00
committed by shilin66
parent 388694aef4
commit 7808265d04
6 changed files with 11 additions and 1 deletions

View File

@@ -83,6 +83,7 @@ enum FeedbackTypeEnum {
type Props = OutLinkChatAuthProps & type Props = OutLinkChatAuthProps &
ChatProviderProps & { ChatProviderProps & {
isReady: boolean;
feedbackType?: `${FeedbackTypeEnum}`; feedbackType?: `${FeedbackTypeEnum}`;
showMarkIcon?: boolean; // admin mark dataset showMarkIcon?: boolean; // admin mark dataset
showVoiceIcon?: boolean; showVoiceIcon?: boolean;
@@ -97,6 +98,7 @@ type Props = OutLinkChatAuthProps &
}; };
const ChatBox = ({ const ChatBox = ({
isReady = true,
feedbackType = FeedbackTypeEnum.hidden, feedbackType = FeedbackTypeEnum.hidden,
showMarkIcon = false, showMarkIcon = false,
showVoiceIcon = true, showVoiceIcon = true,
@@ -829,11 +831,12 @@ const ChatBox = ({
eventBus.off(EventNameEnum.sendQuestion); eventBus.off(EventNameEnum.sendQuestion);
eventBus.off(EventNameEnum.editQuestion); eventBus.off(EventNameEnum.editQuestion);
}; };
}, [chatBoxData, resetInputVal, sendPrompt]); }, [isReady, resetInputVal, sendPrompt]);
// Auto send prompt // Auto send prompt
useEffect(() => { useEffect(() => {
if ( if (
isReady &&
chatBoxData?.app?.chatConfig?.autoExecute?.open && chatBoxData?.app?.chatConfig?.autoExecute?.open &&
chatStarted && chatStarted &&
chatRecords.length === 0 && chatRecords.length === 0 &&
@@ -845,6 +848,7 @@ const ChatBox = ({
}); });
} }
}, [ }, [
isReady,
chatStarted, chatStarted,
chatRecords.length, chatRecords.length,
isChatRecordsLoaded, isChatRecordsLoaded,

View File

@@ -154,6 +154,7 @@ const DetailLogsModal = ({ appId, chatId, onClose }: Props) => {
</Box> </Box>
) : ( ) : (
<ChatBox <ChatBox
isReady
appId={appId} appId={appId}
chatId={chatId} chatId={chatId}
feedbackType={'admin'} feedbackType={'admin'}

View File

@@ -82,6 +82,7 @@ export const useChatTest = ({
useEffect(() => { useEffect(() => {
setChatBoxData({ setChatBoxData({
userAvatar: userInfo?.avatar, userAvatar: userInfo?.avatar,
appId: appId,
app: { app: {
chatConfig, chatConfig,
name: appDetail.name, name: appDetail.name,
@@ -94,6 +95,7 @@ export const useChatTest = ({
appDetail.avatar, appDetail.avatar,
appDetail.name, appDetail.name,
appDetail.type, appDetail.type,
appId,
chatConfig, chatConfig,
pluginInputs, pluginInputs,
setChatBoxData, setChatBoxData,

View File

@@ -209,6 +209,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
chatType={'chat'} chatType={'chat'}
showRawSource showRawSource
showNodeStatus showNodeStatus
isReady={!loading}
/> />
)} )}
</Box> </Box>

View File

@@ -278,6 +278,7 @@ const OutLink = (props: Props) => {
/> />
) : ( ) : (
<ChatBox <ChatBox
isReady={!loading}
appId={appId} appId={appId}
chatId={chatId} chatId={chatId}
outLinkAuthData={outLinkAuthData} outLinkAuthData={outLinkAuthData}

View File

@@ -218,6 +218,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
/> />
) : ( ) : (
<ChatBox <ChatBox
isReady={!loading}
appId={appId} appId={appId}
chatId={chatId} chatId={chatId}
outLinkAuthData={outLinkAuthData} outLinkAuthData={outLinkAuthData}