-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
18 additions
and
32 deletions.
There are no files selected for viewing
36 changes: 8 additions & 28 deletions
36
front/components/assistant/conversation/ContentFragment.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,17 @@ | ||
import { | ||
DocumentTextIcon, | ||
ExternalLinkIcon, | ||
IconButton, | ||
SlackLogo, | ||
} from "@dust-tt/sparkle"; | ||
import Link from "next/link"; | ||
import { Citation } from "@dust-tt/sparkle"; | ||
|
||
import { classNames } from "@app/lib/utils"; | ||
import { assertNever } from "@app/lib/utils"; | ||
import { ContentFragmentType } from "@app/types/assistant/conversation"; | ||
|
||
export function ContentFragment({ message }: { message: ContentFragmentType }) { | ||
let logo = <DocumentTextIcon className="h-5 w-5 text-slate-500" />; | ||
let logoType: "document" | "slack" = "document"; | ||
switch (message.contentType) { | ||
case "slack_thread_content": | ||
logo = <SlackLogo className="h-5 w-5 text-slate-500" />; | ||
logoType = "slack"; | ||
break; | ||
|
||
default: | ||
assertNever(message.contentType); | ||
} | ||
return ( | ||
<div | ||
className={classNames( | ||
"flex w-48 flex-none flex-col gap-2 rounded-xl border border-structure-100 bg-white p-3 sm:w-64" | ||
)} | ||
> | ||
<div className="flex items-center gap-1.5"> | ||
<div className="h-5 w-5">{logo}</div> | ||
<div className="flex-grow text-xs" /> | ||
{message.url && ( | ||
<Link href={message.url} target="_blank"> | ||
<IconButton icon={ExternalLinkIcon} size="xs" variant="primary" /> | ||
</Link> | ||
)} | ||
</div> | ||
<div className="text-xs font-bold text-element-900">{message.title}</div> | ||
</div> | ||
); | ||
return <Citation title={message.title} type={logoType} href={message.url} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters