Skip to content

Commit

Permalink
File attachment (#2556)
Browse files Browse the repository at this point in the history
* WIP: file attachment. Working, but dirty for now.

Making progress on UI

Better UI

Working end to end but a lot of things to review / clean up.

First clean up phase

Adding avatars to Sparkle/citation

UI Tweak

Support for API/v1

Fix types

addressing @Henry's comments

Fixing errors reported by @philipperolet

Clean up console.log

Dry file upload logic + remove timezone from content fragment

No content fragment context from the Slack bot

Clean up sparkle changes

Adjusting Sparkle dependencies

No context from Slack bot

Added tooltip

Adding the Tooltip

* Remove timezone, relative import and s-
  • Loading branch information
lasryaric authored Nov 16, 2023
1 parent 064c8b0 commit 3fe2359
Show file tree
Hide file tree
Showing 15 changed files with 869 additions and 359 deletions.
7 changes: 5 additions & 2 deletions connectors/src/connectors/slack/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ async function botAnswerMessage(
slackChannel,
lastSlackChatBotMessage?.threadTs || slackThreadTs || slackMessageTs,
lastSlackChatBotMessage?.messageTs || slackThreadTs || slackMessageTs,
slackChatBotMessage,
connector
);

Expand Down Expand Up @@ -618,8 +619,9 @@ async function makeContentFragment(
channelId: string,
threadTs: string,
startingAtTs: string | null,
slackChatBotMessage: SlackChatBotMessage,
connector: Connector
) {
): Promise<Result<PostContentFragmentRequestBody | null, Error>> {
let allMessages: MessageElement[] = [];

let next_cursor = undefined;
Expand Down Expand Up @@ -710,5 +712,6 @@ async function makeContentFragment(
content: text,
url: url,
contentType: "slack_thread_content",
} as PostContentFragmentRequestBody);
context: null,
});
}
9 changes: 9 additions & 0 deletions connectors/src/lib/dust_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ export const PostContentFragmentRequestBodySchemaIoTs = t.type({
content: t.string,
url: t.union([t.string, t.null]),
contentType: t.literal("slack_thread_content"),
context: t.union([
t.type({
username: t.string,
fullName: t.union([t.string, t.null]),
email: t.union([t.string, t.null]),
profilePictureUrl: t.union([t.string, t.null]),
}),
t.null,
]),
});

const PostConversationsRequestBodySchemaIoTs = t.type({
Expand Down
4 changes: 4 additions & 0 deletions front/components/assistant/conversation/ContentFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export function ContentFragment({ message }: { message: ContentFragmentType }) {
case "slack_thread_content":
logoType = "slack";
break;
case "file_attachment":
logoType = "document";
break;

default:
assertNever(message.contentType);
Expand All @@ -18,6 +21,7 @@ export function ContentFragment({ message }: { message: ContentFragmentType }) {
title={message.title}
type={logoType}
href={message.url || undefined}
avatarUrl={message.context.profilePictureUrl ?? undefined}
/>
);
}
Loading

0 comments on commit 3fe2359

Please sign in to comment.