mirror of https://github.com/buster-so/buster.git
updates
This commit is contained in:
parent
9ecf04f65b
commit
e6e4ecf359
|
@ -63,4 +63,5 @@ node_modules/
|
||||||
|
|
||||||
.secrets
|
.secrets
|
||||||
|
|
||||||
/prds
|
/prds
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||||
function Microsoft() {
|
function Microsoft() {
|
||||||
return (
|
return (
|
||||||
<svg height="1em" width="1em" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
<svg height="1em" width="1em" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
||||||
<g fill="#212121">
|
<g fill="currentColor">
|
||||||
<path d="M3,3H15.381V15.381H3V3Z" />
|
<path d="M3,3H15.381V15.381H3V3Z" />
|
||||||
<path d="M16.619,3h12.381V15.381h-12.381V3Z" />
|
<path d="M16.619,3h12.381V15.381h-12.381V3Z" />
|
||||||
<path d="M3,16.619H15.381v12.381H3v-12.381Z" />
|
<path d="M3,16.619H15.381v12.381H3v-12.381Z" />
|
||||||
|
|
|
@ -15,13 +15,24 @@ export const BarContainer: React.FC<{
|
||||||
title: string;
|
title: string;
|
||||||
secondaryTitle?: string;
|
secondaryTitle?: string;
|
||||||
contentClassName?: string;
|
contentClassName?: string;
|
||||||
|
animationKey?: string;
|
||||||
}> = React.memo(
|
}> = React.memo(
|
||||||
({ showBar, status, isCompletedStream, children, title, secondaryTitle, contentClassName }) => {
|
({
|
||||||
|
showBar,
|
||||||
|
status,
|
||||||
|
isCompletedStream,
|
||||||
|
children,
|
||||||
|
title,
|
||||||
|
secondaryTitle,
|
||||||
|
contentClassName,
|
||||||
|
animationKey
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<AnimatePresence initial={!isCompletedStream}>
|
<AnimatePresence initial={!isCompletedStream} mode="wait">
|
||||||
<motion.div
|
<motion.div
|
||||||
className={'relative flex space-x-1.5 overflow-hidden'}
|
className={'relative flex space-x-1.5 overflow-hidden'}
|
||||||
{...itemAnimationConfig}>
|
{...itemAnimationConfig}
|
||||||
|
key={animationKey}>
|
||||||
<VerticalBarContainer showBar={showBar} status={status} />
|
<VerticalBarContainer showBar={showBar} status={status} />
|
||||||
|
|
||||||
<div className={`flex w-full flex-col space-y-2 overflow-hidden ${contentClassName}`}>
|
<div className={`flex w-full flex-col space-y-2 overflow-hidden ${contentClassName}`}>
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { useQuery } from '@tanstack/react-query';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { queryKeys } from '@/api/query_keys';
|
import { queryKeys } from '@/api/query_keys';
|
||||||
import { BarContainer } from './BarContainer';
|
import { BarContainer } from './BarContainer';
|
||||||
import { Text } from '@/components/ui/typography';
|
|
||||||
|
|
||||||
export const BlackBoxMessage: React.FC<{ messageId: string }> = React.memo(({ messageId }) => {
|
export const BlackBoxMessage: React.FC<{ messageId: string }> = React.memo(({ messageId }) => {
|
||||||
const blackBoxMessage = useQuery({
|
const blackBoxMessage = useQuery({
|
||||||
|
@ -24,7 +23,7 @@ export const BlackBoxMessage: React.FC<{ messageId: string }> = React.memo(({ me
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <span className="text-red-500">no black box {messageId}</span>;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
BlackBoxMessage.displayName = 'BlackBoxMessage';
|
BlackBoxMessage.displayName = 'BlackBoxMessage';
|
||||||
|
|
|
@ -10,6 +10,7 @@ export interface ReasoningMessageProps {
|
||||||
messageId: string;
|
messageId: string;
|
||||||
isCompletedStream: boolean;
|
isCompletedStream: boolean;
|
||||||
chatId: string;
|
chatId: string;
|
||||||
|
animationKey?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReasoningMessageRecord: Record<
|
const ReasoningMessageRecord: Record<
|
||||||
|
@ -45,7 +46,8 @@ export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> =
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReasoningMessage
|
<ReasoningMessage
|
||||||
key={reasoningMessageId + reasoningMessageType} //force in case the type changes
|
key={reasoningMessageId} //force in case the type changes
|
||||||
|
animationKey={reasoningMessageId + reasoningMessageType}
|
||||||
reasoningMessageId={reasoningMessageId}
|
reasoningMessageId={reasoningMessageId}
|
||||||
isCompletedStream={isCompletedStream}
|
isCompletedStream={isCompletedStream}
|
||||||
messageId={messageId}
|
messageId={messageId}
|
||||||
|
|
|
@ -12,22 +12,19 @@ const getReasoningMessage = (x: BusterChatMessage | undefined, reasoningMessageI
|
||||||
x?.reasoning_messages[reasoningMessageId] as BusterChatMessageReasoning_files;
|
x?.reasoning_messages[reasoningMessageId] as BusterChatMessageReasoning_files;
|
||||||
|
|
||||||
export const ReasoningMessage_Files: React.FC<ReasoningMessageProps> = React.memo(
|
export const ReasoningMessage_Files: React.FC<ReasoningMessageProps> = React.memo(
|
||||||
({ isCompletedStream, chatId, reasoningMessageId, messageId }) => {
|
({ isCompletedStream, chatId, reasoningMessageId, messageId, animationKey }) => {
|
||||||
const status = useMessageIndividual(
|
const status = useMessageIndividual(
|
||||||
messageId,
|
messageId,
|
||||||
(x) => getReasoningMessage(x, reasoningMessageId)?.status
|
(x) => getReasoningMessage(x, reasoningMessageId)?.status
|
||||||
);
|
);
|
||||||
|
|
||||||
const file_ids = useMessageIndividual(
|
const file_ids = useMessageIndividual(
|
||||||
messageId,
|
messageId,
|
||||||
(x) => getReasoningMessage(x, reasoningMessageId)?.file_ids
|
(x) => getReasoningMessage(x, reasoningMessageId)?.file_ids
|
||||||
);
|
);
|
||||||
|
|
||||||
const title = useMessageIndividual(
|
const title = useMessageIndividual(
|
||||||
messageId,
|
messageId,
|
||||||
(x) => getReasoningMessage(x, reasoningMessageId)?.title
|
(x) => getReasoningMessage(x, reasoningMessageId)?.title
|
||||||
);
|
);
|
||||||
|
|
||||||
const secondary_title = useMessageIndividual(
|
const secondary_title = useMessageIndividual(
|
||||||
messageId,
|
messageId,
|
||||||
(x) => getReasoningMessage(x, reasoningMessageId)?.secondary_title
|
(x) => getReasoningMessage(x, reasoningMessageId)?.secondary_title
|
||||||
|
@ -35,14 +32,13 @@ export const ReasoningMessage_Files: React.FC<ReasoningMessageProps> = React.mem
|
||||||
|
|
||||||
if (!title) return null;
|
if (!title) return null;
|
||||||
|
|
||||||
console.log(reasoningMessageId, isCompletedStream);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BarContainer
|
<BarContainer
|
||||||
showBar={true}
|
showBar={true}
|
||||||
status={status}
|
status={status}
|
||||||
isCompletedStream={isCompletedStream}
|
isCompletedStream={isCompletedStream}
|
||||||
title={title}
|
title={title}
|
||||||
|
animationKey={animationKey}
|
||||||
secondaryTitle={secondary_title}
|
secondaryTitle={secondary_title}
|
||||||
contentClassName="mb-2">
|
contentClassName="mb-2">
|
||||||
<div className="flex flex-col gap-3">
|
<div className="flex flex-col gap-3">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
import { ReasoningMessagePillsContainer } from './ReasoningMessagePillsContainer';
|
import { ReasoningMessagePillsContainer } from './ReasoningMessagePillsContainer';
|
||||||
|
import { ReasoningMessage_Text } from '../ReasoningMessage_Text';
|
||||||
import type { BusterChatMessageReasoning_pills, ThoughtFileType } from '@/api/asset_interfaces';
|
import type { BusterChatMessageReasoning_pills, ThoughtFileType } from '@/api/asset_interfaces';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Button } from '@/components/ui/buttons';
|
import { Button } from '@/components/ui/buttons';
|
||||||
|
@ -98,6 +99,10 @@ export const Loading: Story = {
|
||||||
render: () => <InteractiveLoadingWrapper />
|
render: () => <InteractiveLoadingWrapper />
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const LoadingTextThenPills: Story = {
|
||||||
|
render: () => <InteractiveLoadingWrapper />
|
||||||
|
};
|
||||||
|
|
||||||
export const Failed: Story = {
|
export const Failed: Story = {
|
||||||
args: {
|
args: {
|
||||||
...mockReasoningMessage,
|
...mockReasoningMessage,
|
||||||
|
|
|
@ -39,8 +39,9 @@ export const ReasoningMessagePillsContainer: React.FC<
|
||||||
BusterChatMessageReasoning_pills & {
|
BusterChatMessageReasoning_pills & {
|
||||||
status: NonNullable<BusterChatMessageReasoning_pills['status']>;
|
status: NonNullable<BusterChatMessageReasoning_pills['status']>;
|
||||||
isCompletedStream: boolean;
|
isCompletedStream: boolean;
|
||||||
|
animationKey?: string;
|
||||||
}
|
}
|
||||||
> = ({ title, secondary_title, pill_containers, status, isCompletedStream }) => {
|
> = ({ title, secondary_title, pill_containers, status, isCompletedStream, animationKey }) => {
|
||||||
const hasPills = !!pill_containers && pill_containers.length > 0;
|
const hasPills = !!pill_containers && pill_containers.length > 0;
|
||||||
const loadingStatus: NonNullable<BusterChatMessageReasoning_pills['status']> = status;
|
const loadingStatus: NonNullable<BusterChatMessageReasoning_pills['status']> = status;
|
||||||
|
|
||||||
|
@ -48,6 +49,7 @@ export const ReasoningMessagePillsContainer: React.FC<
|
||||||
<BarContainer
|
<BarContainer
|
||||||
showBar={hasPills}
|
showBar={hasPills}
|
||||||
status={loadingStatus}
|
status={loadingStatus}
|
||||||
|
animationKey={animationKey}
|
||||||
isCompletedStream={isCompletedStream}
|
isCompletedStream={isCompletedStream}
|
||||||
title={title}
|
title={title}
|
||||||
secondaryTitle={secondary_title}
|
secondaryTitle={secondary_title}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { useMessageIndividual } from '@/context/Chats';
|
||||||
import { ReasoningMessagePillsContainer } from './ReasoningMessagePillsContainer';
|
import { ReasoningMessagePillsContainer } from './ReasoningMessagePillsContainer';
|
||||||
|
|
||||||
export const ReasoningMessage_PillsContainer: React.FC<ReasoningMessageProps> = React.memo(
|
export const ReasoningMessage_PillsContainer: React.FC<ReasoningMessageProps> = React.memo(
|
||||||
({ reasoningMessageId, messageId, isCompletedStream }) => {
|
({ reasoningMessageId, messageId, isCompletedStream, animationKey }) => {
|
||||||
const reasoningMessage = useMessageIndividual(
|
const reasoningMessage = useMessageIndividual(
|
||||||
messageId,
|
messageId,
|
||||||
(x) => x?.reasoning_messages[reasoningMessageId]
|
(x) => x?.reasoning_messages[reasoningMessageId]
|
||||||
|
@ -19,6 +19,7 @@ export const ReasoningMessage_PillsContainer: React.FC<ReasoningMessageProps> =
|
||||||
{...reasoningMessagePills}
|
{...reasoningMessagePills}
|
||||||
status={status}
|
status={status}
|
||||||
isCompletedStream={isCompletedStream}
|
isCompletedStream={isCompletedStream}
|
||||||
|
animationKey={animationKey}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { BarContainer } from '../BarContainer';
|
||||||
import { useMessageIndividual } from '@/context/Chats';
|
import { useMessageIndividual } from '@/context/Chats';
|
||||||
|
|
||||||
export const ReasoningMessage_Text: React.FC<ReasoningMessageProps> = React.memo(
|
export const ReasoningMessage_Text: React.FC<ReasoningMessageProps> = React.memo(
|
||||||
({ reasoningMessageId, messageId, isCompletedStream }) => {
|
({ reasoningMessageId, messageId, isCompletedStream, animationKey }) => {
|
||||||
const reasoningMessage = useMessageIndividual(
|
const reasoningMessage = useMessageIndividual(
|
||||||
messageId,
|
messageId,
|
||||||
(x) => x?.reasoning_messages[reasoningMessageId]
|
(x) => x?.reasoning_messages[reasoningMessageId]
|
||||||
|
@ -19,6 +19,7 @@ export const ReasoningMessage_Text: React.FC<ReasoningMessageProps> = React.memo
|
||||||
<BarContainer
|
<BarContainer
|
||||||
showBar={!!message?.length}
|
showBar={!!message?.length}
|
||||||
status={status}
|
status={status}
|
||||||
|
animationKey={animationKey}
|
||||||
isCompletedStream={isCompletedStream}
|
isCompletedStream={isCompletedStream}
|
||||||
title={title}
|
title={title}
|
||||||
secondaryTitle={secondary_title}>
|
secondaryTitle={secondary_title}>
|
||||||
|
|
Loading…
Reference in New Issue