mirror of https://github.com/buster-so/buster.git
Merge branch 'big-nate/bus-939-create-new-structure-for-chats' into nate/create-component-library
This commit is contained in:
commit
493698f42c
|
@ -48,15 +48,15 @@ export type BusterChatMessageReasoning =
|
|||
| BusterChatMessageReasoning_text
|
||||
| BusterChatMessageReasoning_file;
|
||||
|
||||
export type BusterChatMessageReasoning_pillsPill = {
|
||||
export type BusterChatMessageReasoning_Pill = {
|
||||
text: string;
|
||||
type: ThoughtFileType | null; //if null then the pill will not link anywhere
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type BusterChatMessageReasoning_pillsPillContainer = {
|
||||
export type BusterChatMessageReasoning_PillsContainer = {
|
||||
title: string;
|
||||
thought_pills: BusterChatMessageReasoning_pillsPill[];
|
||||
pills: BusterChatMessageReasoning_Pill[];
|
||||
};
|
||||
|
||||
export type BusterChatMessageReasoning_status = 'loading' | 'completed' | 'failed';
|
||||
|
@ -65,8 +65,8 @@ export type BusterChatMessageReasoning_pills = {
|
|||
id: string;
|
||||
type: 'pills';
|
||||
title: string;
|
||||
secondary_title: string;
|
||||
pill_containers?: BusterChatMessageReasoning_pillsPillContainer[];
|
||||
secondary_title?: string;
|
||||
pill_containers?: BusterChatMessageReasoning_PillsContainer[];
|
||||
status?: BusterChatMessageReasoning_status; //if left undefined, will automatically be set to 'loading' if the chat stream is in progress AND there is no message after it
|
||||
};
|
||||
|
||||
|
@ -74,6 +74,7 @@ export type BusterChatMessageReasoning_text = {
|
|||
id: string;
|
||||
type: 'text';
|
||||
title: string;
|
||||
secondary_title?: string;
|
||||
message?: string;
|
||||
message_chunk?: string;
|
||||
status?: BusterChatMessageReasoning_status;
|
||||
|
|
|
@ -5,8 +5,8 @@ import {
|
|||
type BusterChatMessageRequest,
|
||||
BusterChatMessage_fileMetadata,
|
||||
BusterChatMessageReasoning_pills,
|
||||
BusterChatMessageReasoning_file,
|
||||
BusterChatMessageReasoning_pillsPill
|
||||
BusterChatMessageReasoning_Pill,
|
||||
BusterChatMessageReasoning_file
|
||||
} from '@/api/asset_interfaces';
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
|
@ -31,7 +31,7 @@ export const createMockResponseMessageText = (): BusterChatMessage_text => ({
|
|||
|
||||
export const createMockResponseMessageThought = (): BusterChatMessageReasoning_pills => {
|
||||
const randomPillCount = faker.number.int({ min: 0, max: 10 });
|
||||
const fourRandomPills: BusterChatMessageReasoning_pillsPill[] = Array.from(
|
||||
const fourRandomPills: BusterChatMessageReasoning_Pill[] = Array.from(
|
||||
{ length: randomPillCount },
|
||||
() => {
|
||||
return {
|
||||
|
@ -49,11 +49,11 @@ export const createMockResponseMessageThought = (): BusterChatMessageReasoning_p
|
|||
pill_containers: [
|
||||
{
|
||||
title: `Found ${faker.number.int(100)} terms`,
|
||||
thought_pills: fourRandomPills
|
||||
pills: fourRandomPills
|
||||
},
|
||||
{
|
||||
title: `Found ${faker.number.int(100)} terms 2`,
|
||||
thought_pills: fourRandomPills
|
||||
pills: fourRandomPills
|
||||
}
|
||||
],
|
||||
status: undefined
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterChatMessageReasoning_pillsPillContainer } from '@/api/asset_interfaces';
|
||||
import { BusterChatMessageReasoning_PillsContainer } from '@/api/asset_interfaces';
|
||||
import React from 'react';
|
||||
import { Text } from '@/components/ui';
|
||||
import { PillContainer } from './ReasoningMessage_ThoughtPills';
|
||||
|
@ -6,7 +6,7 @@ import { itemAnimationConfig } from '../animationConfig';
|
|||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
|
||||
export const ReasoningMessage_ThoughtContainer: React.FC<{
|
||||
pillContainer: BusterChatMessageReasoning_pillsPillContainer;
|
||||
pillContainer: BusterChatMessageReasoning_PillsContainer;
|
||||
isCompletedStream: boolean;
|
||||
}> = React.memo(({ pillContainer, isCompletedStream }) => {
|
||||
return (
|
||||
|
@ -16,10 +16,7 @@ export const ReasoningMessage_ThoughtContainer: React.FC<{
|
|||
<Text size="xs" type="tertiary">
|
||||
{pillContainer.title}
|
||||
</Text>
|
||||
<PillContainer
|
||||
pills={pillContainer.thought_pills}
|
||||
isCompletedStream={isCompletedStream}
|
||||
/>
|
||||
<PillContainer pills={pillContainer.pills} isCompletedStream={isCompletedStream} />
|
||||
</div>
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { BusterChatMessageReasoning_pillsPill } from '@/api/asset_interfaces';
|
||||
import type { BusterChatMessageReasoning_Pill } from '@/api/asset_interfaces';
|
||||
import { createStyles } from 'antd-style';
|
||||
import React, { useMemo } from 'react';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
|
@ -36,7 +36,7 @@ const pillVariants = {
|
|||
};
|
||||
|
||||
export const PillContainer: React.FC<{
|
||||
pills: BusterChatMessageReasoning_pillsPill[];
|
||||
pills: BusterChatMessageReasoning_Pill[];
|
||||
isCompletedStream: boolean;
|
||||
}> = React.memo(({ pills = [], isCompletedStream }) => {
|
||||
const { cx } = useStyles();
|
||||
|
@ -45,7 +45,7 @@ export const PillContainer: React.FC<{
|
|||
const useAnimation = !isCompletedStream;
|
||||
|
||||
const handlePillClick = useMemoizedFn(
|
||||
(pill: Pick<BusterChatMessageReasoning_pillsPill, 'id' | 'type'>) => {
|
||||
(pill: Pick<BusterChatMessageReasoning_Pill, 'id' | 'type'>) => {
|
||||
if (isOpenableFile(pill.type)) {
|
||||
onSetSelectedFile(pill as SelectedFile);
|
||||
}
|
||||
|
@ -78,10 +78,10 @@ PillContainer.displayName = 'PillContainer';
|
|||
const Pill: React.FC<{
|
||||
text: string;
|
||||
id?: string;
|
||||
type?: BusterChatMessageReasoning_pillsPill['type'];
|
||||
type?: BusterChatMessageReasoning_Pill['type'];
|
||||
useAnimation: boolean;
|
||||
className?: string;
|
||||
onClick?: (pill: Pick<BusterChatMessageReasoning_pillsPill, 'id' | 'type'>) => void;
|
||||
onClick?: (pill: Pick<BusterChatMessageReasoning_Pill, 'id' | 'type'>) => void;
|
||||
}> = React.memo(({ text, type, id, useAnimation, className = '', onClick }) => {
|
||||
const { styles, cx } = useStyles();
|
||||
return (
|
||||
|
@ -110,9 +110,9 @@ const OverflowPill = React.memo(
|
|||
useAnimation,
|
||||
onClickPill
|
||||
}: {
|
||||
hiddenPills: BusterChatMessageReasoning_pillsPill[];
|
||||
hiddenPills: BusterChatMessageReasoning_Pill[];
|
||||
useAnimation: boolean;
|
||||
onClickPill: (pill: Pick<BusterChatMessageReasoning_pillsPill, 'id' | 'type'>) => void;
|
||||
onClickPill: (pill: Pick<BusterChatMessageReasoning_Pill, 'id' | 'type'>) => void;
|
||||
}) => {
|
||||
const count = hiddenPills.length;
|
||||
|
||||
|
|
Loading…
Reference in New Issue