mirror of https://github.com/buster-so/buster.git
last message should have line
This commit is contained in:
parent
84f1c80bb7
commit
def7d2a341
|
@ -42,13 +42,14 @@ export const ReasoningController: React.FC<ReasoningControllerProps> = ({ chatId
|
||||||
<>
|
<>
|
||||||
<ScrollArea viewportRef={viewportRef}>
|
<ScrollArea viewportRef={viewportRef}>
|
||||||
<div className="h-full flex-col space-y-2 overflow-y-auto p-5">
|
<div className="h-full flex-col space-y-2 overflow-y-auto p-5">
|
||||||
{reasoningMessageIds?.map((reasoningMessageId) => (
|
{reasoningMessageIds?.map((reasoningMessageId, messageIndex) => (
|
||||||
<ReasoningMessageSelector
|
<ReasoningMessageSelector
|
||||||
key={reasoningMessageId}
|
key={reasoningMessageId}
|
||||||
reasoningMessageId={reasoningMessageId}
|
reasoningMessageId={reasoningMessageId}
|
||||||
isCompletedStream={isCompletedStream ?? true}
|
isCompletedStream={isCompletedStream ?? true}
|
||||||
chatId={chatId}
|
chatId={chatId}
|
||||||
messageId={messageId}
|
messageId={messageId}
|
||||||
|
isLastMessage={messageIndex === reasoningMessageIds.length - 1}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ export const TextEmptyReasoning: Story = {
|
||||||
reasoningMessageId: 'reasoning-1',
|
reasoningMessageId: 'reasoning-1',
|
||||||
messageId: 'empty-message',
|
messageId: 'empty-message',
|
||||||
isCompletedStream: false,
|
isCompletedStream: false,
|
||||||
chatId: 'chat-1'
|
chatId: 'chat-1',
|
||||||
|
isLastMessage: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,6 @@ import { useGetChatMessage } from '@/api/buster_rest/chats';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import { BarContainer } from './BarContainer';
|
import { BarContainer } from './BarContainer';
|
||||||
|
|
||||||
export interface ReasoningMessageProps {
|
|
||||||
reasoningMessageId: string;
|
|
||||||
messageId: string;
|
|
||||||
isCompletedStream: boolean;
|
|
||||||
chatId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const itemAnimationConfig = {
|
const itemAnimationConfig = {
|
||||||
initial: { opacity: 0, height: 0 },
|
initial: { opacity: 0, height: 0 },
|
||||||
animate: {
|
animate: {
|
||||||
|
@ -45,6 +38,13 @@ const itemAnimationConfig = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface ReasoningMessageProps {
|
||||||
|
reasoningMessageId: string;
|
||||||
|
messageId: string;
|
||||||
|
isCompletedStream: boolean;
|
||||||
|
chatId: string;
|
||||||
|
}
|
||||||
|
|
||||||
const ReasoningMessageRecord: Record<
|
const ReasoningMessageRecord: Record<
|
||||||
BusterChatMessageReasoning['type'],
|
BusterChatMessageReasoning['type'],
|
||||||
React.FC<ReasoningMessageProps>
|
React.FC<ReasoningMessageProps>
|
||||||
|
@ -59,13 +59,15 @@ export interface ReasoningMessageSelectorProps {
|
||||||
messageId: string;
|
messageId: string;
|
||||||
isCompletedStream: boolean;
|
isCompletedStream: boolean;
|
||||||
chatId: string;
|
chatId: string;
|
||||||
|
isLastMessage: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> = ({
|
export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> = ({
|
||||||
reasoningMessageId,
|
reasoningMessageId,
|
||||||
isCompletedStream,
|
isCompletedStream,
|
||||||
chatId,
|
chatId,
|
||||||
messageId
|
messageId,
|
||||||
|
isLastMessage
|
||||||
}) => {
|
}) => {
|
||||||
const { data: messageStuff } = useGetChatMessage(messageId, {
|
const { data: messageStuff } = useGetChatMessage(messageId, {
|
||||||
select: (x) => ({
|
select: (x) => ({
|
||||||
|
@ -80,9 +82,9 @@ export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> =
|
||||||
const { title, secondary_title, type, status, hasMessage } = messageStuff || {};
|
const { title, secondary_title, type, status, hasMessage } = messageStuff || {};
|
||||||
|
|
||||||
const showBar = useMemo(() => {
|
const showBar = useMemo(() => {
|
||||||
if (type === 'text') return !!hasMessage;
|
if (type === 'text') return !!hasMessage || !isLastMessage;
|
||||||
return true;
|
return true;
|
||||||
}, [type, hasMessage]);
|
}, [type, hasMessage, isLastMessage]);
|
||||||
|
|
||||||
if (!type || !status) return null;
|
if (!type || !status) return null;
|
||||||
|
|
||||||
|
@ -115,12 +117,3 @@ export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> =
|
||||||
</BarContainer>
|
</BarContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const showBarHelper = (
|
|
||||||
type: BusterChatMessageReasoning['type'],
|
|
||||||
status: BusterChatMessageReasoning['status']
|
|
||||||
) => {
|
|
||||||
if (type === 'pills') return false;
|
|
||||||
if (status === 'loading') return false;
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in New Issue