add chatType (#3060)
This commit is contained in:
parent
727bd7144c
commit
49cd2d7a3c
@ -30,7 +30,7 @@ export const formatTimeToChatTime = (time: Date) => {
|
|||||||
// 如果时间是今天,展示几时:几分
|
// 如果时间是今天,展示几时:几分
|
||||||
//用#占位,i18n生效后replace成:
|
//用#占位,i18n生效后replace成:
|
||||||
if (now.isSame(target, 'day')) {
|
if (now.isSame(target, 'day')) {
|
||||||
return 'common:' + target.format('HH#mm');
|
return target.format('HH#mm');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果是昨天,展示昨天
|
// 如果是昨天,展示昨天
|
||||||
@ -54,7 +54,7 @@ export const formatTimeToChatItemTime = (time: Date) => {
|
|||||||
|
|
||||||
// 如果时间是今天,展示几时:几分
|
// 如果时间是今天,展示几时:几分
|
||||||
if (now.isSame(target, 'day')) {
|
if (now.isSame(target, 'day')) {
|
||||||
return 'common:' + detailTime;
|
return detailTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果是昨天,展示昨天+几时:几分
|
// 如果是昨天,展示昨天+几时:几分
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export type ChatProviderProps = OutLinkChatAuthProps & {
|
|||||||
|
|
||||||
// not chat test params
|
// not chat test params
|
||||||
chatId?: string;
|
chatId?: string;
|
||||||
isLog?: boolean;
|
chatType?: 'log' | 'chat';
|
||||||
};
|
};
|
||||||
|
|
||||||
type useChatStoreType = OutLinkChatAuthProps &
|
type useChatStoreType = OutLinkChatAuthProps &
|
||||||
@ -138,7 +138,7 @@ const Provider = ({
|
|||||||
chatHistories,
|
chatHistories,
|
||||||
setChatHistories,
|
setChatHistories,
|
||||||
variablesForm,
|
variablesForm,
|
||||||
|
chatType = 'chat',
|
||||||
chatConfig = {},
|
chatConfig = {},
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
@ -240,7 +240,8 @@ const Provider = ({
|
|||||||
chatInputGuide,
|
chatInputGuide,
|
||||||
outLinkAuthData,
|
outLinkAuthData,
|
||||||
variablesForm,
|
variablesForm,
|
||||||
getHistoryResponseData
|
getHistoryResponseData,
|
||||||
|
chatType
|
||||||
};
|
};
|
||||||
|
|
||||||
return <ChatBoxContext.Provider value={value}>{children}</ChatBoxContext.Provider>;
|
return <ChatBoxContext.Provider value={value}>{children}</ChatBoxContext.Provider>;
|
||||||
|
|||||||
@ -137,8 +137,8 @@ const ChatItem = (props: Props) => {
|
|||||||
};
|
};
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { isChatting, isLog } = useContextSelector(ChatBoxContext, (v) => {
|
const { isChatting, chatType } = useContextSelector(ChatBoxContext, (v) => {
|
||||||
return { isChatting: v.isChatting, isLog: v.isLog };
|
return { isChatting: v.isChatting, chatType: v.chatType };
|
||||||
});
|
});
|
||||||
|
|
||||||
const { copyData } = useCopyData();
|
const { copyData } = useCopyData();
|
||||||
@ -218,13 +218,14 @@ const ChatItem = (props: Props) => {
|
|||||||
<Flex w={'100%'} alignItems={'flex-end'} gap={2} justifyContent={styleMap.justifyContent}>
|
<Flex w={'100%'} alignItems={'flex-end'} gap={2} justifyContent={styleMap.justifyContent}>
|
||||||
{isChatting && type === ChatRoleEnum.AI && isLastChild ? null : (
|
{isChatting && type === ChatRoleEnum.AI && isLastChild ? null : (
|
||||||
<Flex order={styleMap.order} ml={styleMap.ml} align={'center'} gap={'0.62rem'}>
|
<Flex order={styleMap.order} ml={styleMap.ml} align={'center'} gap={'0.62rem'}>
|
||||||
{chat.time && type === ChatRoleEnum.Human && (isPc || isLog) && (
|
{chat.time && (isPc || chatType === 'log') && (
|
||||||
<Box
|
<Box
|
||||||
|
order={type === ChatRoleEnum.AI ? 2 : 0}
|
||||||
className={'time-label'}
|
className={'time-label'}
|
||||||
fontSize={styleMap.fontSize}
|
fontSize={styleMap.fontSize}
|
||||||
color={styleMap.color}
|
color={styleMap.color}
|
||||||
fontWeight={styleMap.fontWeight}
|
fontWeight={styleMap.fontWeight}
|
||||||
display={isLog ? 'block' : 'none'}
|
display={chatType === 'log' ? 'block' : 'none'}
|
||||||
>
|
>
|
||||||
{t(formatTimeToChatItemTime(chat.time) as any, {
|
{t(formatTimeToChatItemTime(chat.time) as any, {
|
||||||
time: dayjs(chat.time).format('HH:mm')
|
time: dayjs(chat.time).format('HH:mm')
|
||||||
|
|||||||
@ -180,7 +180,7 @@ const DetailLogsModal = ({
|
|||||||
chatConfig={chat?.app?.chatConfig}
|
chatConfig={chat?.app?.chatConfig}
|
||||||
appId={appId}
|
appId={appId}
|
||||||
chatId={chatId}
|
chatId={chatId}
|
||||||
isLog={true}
|
chatType="log"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user