Improve Train of Thought icons spacing and loading circle

This commit is contained in:
Debanjum Singh Solanky 2024-07-14 09:35:15 +05:30
parent e9567741eb
commit a0f38e079f
3 changed files with 12 additions and 11 deletions

View file

@ -24,7 +24,7 @@ div.agentIndicator {
div.trainOfThought { div.trainOfThought {
border: 1px var(--border-color) solid; border: 1px var(--border-color) solid;
border-radius: 16px; border-radius: 16px;
padding: 16px; padding: 0 16px;
margin: 12px; margin: 12px;
box-shadow: 0 4px 10px var(--box-shadow-color); box-shadow: 0 4px 10px var(--box-shadow-color);
} }

View file

@ -155,35 +155,36 @@ interface TrainOfThoughtProps {
function chooseIconFromHeader(header: string, iconColor: string) { function chooseIconFromHeader(header: string, iconColor: string) {
const compareHeader = header.toLowerCase(); const compareHeader = header.toLowerCase();
const classNames = `inline mt-1 mr-2 ${iconColor}`;
if (compareHeader.includes("understanding")) { if (compareHeader.includes("understanding")) {
return <Brain className={`inline mr-2 ${iconColor}`} /> return <Brain className={`${classNames}`} />
} }
if (compareHeader.includes("generating")) { if (compareHeader.includes("generating")) {
return <Cloud className={`inline mr-2 ${iconColor}`} />; return <Cloud className={`${classNames}`} />;
} }
if (compareHeader.includes("data sources")) { if (compareHeader.includes("data sources")) {
return <Folder className={`inline mr-2 ${iconColor}`} />; return <Folder className={`${classNames}`} />;
} }
if (compareHeader.includes("notes")) { if (compareHeader.includes("notes")) {
return <Folder className={`inline mr-2 ${iconColor}`} />; return <Folder className={`${classNames}`} />;
} }
if (compareHeader.includes("read")) { if (compareHeader.includes("read")) {
return <Book className={`inline mr-2 ${iconColor}`} />; return <Book className={`${classNames}`} />;
} }
if (compareHeader.includes("search")) { if (compareHeader.includes("search")) {
return <MagnifyingGlass className={`inline mr-2 ${iconColor}`} />; return <MagnifyingGlass className={`${classNames}`} />;
} }
if (compareHeader.includes("summary") || compareHeader.includes("summarize")) { if (compareHeader.includes("summary") || compareHeader.includes("summarize")) {
return <Aperture className={`inline mr-2 ${iconColor}`} />; return <Aperture className={`${classNames}`} />;
} }
return <Brain className={`inline mr-2 ${iconColor}`} />; return <Brain className={`${classNames}`} />;
} }
@ -195,7 +196,7 @@ export function TrainOfThought(props: TrainOfThoughtProps) {
const icon = chooseIconFromHeader(header, iconColor); const icon = chooseIconFromHeader(header, iconColor);
let markdownRendered = DomPurify.sanitize(md.render(props.message)); let markdownRendered = DomPurify.sanitize(md.render(props.message));
return ( return (
<div className={`flex items-center ${props.primary ? 'text-gray-400' : 'text-gray-300'} ${styles.trainOfThought} ${props.primary ? styles.primary : ''}`} > <div className={`flex mt-1 ${props.primary ? 'text-gray-400' : 'text-gray-300'} ${styles.trainOfThought} ${props.primary ? styles.primary : ''}`} >
{icon} {icon}
<div dangerouslySetInnerHTML={{ __html: markdownRendered }} /> <div dangerouslySetInnerHTML={{ __html: markdownRendered }} />
</div> </div>

View file

@ -16,7 +16,7 @@ interface InlineLoadingProps {
export function InlineLoading(props: InlineLoadingProps) { export function InlineLoading(props: InlineLoadingProps) {
return ( return (
<button className={`${props.className}`}> <button className={`${props.className}`}>
<CircleNotch className={`animate-spin h-5 w-5 mr-3`} /> <CircleNotch className={`animate-spin h-5 w-5 mt-3 mr-3`} />
</button> </button>
) )
} }