Skip to content

Commit

Permalink
Flav/fix sdks actions type (#8468)
Browse files Browse the repository at this point in the history
* Fix conversation actions type

* Use public types in connectors

* Use new assistant picker in the extension (#8462)

* Use new assistant picker in the extension

* Use nex tooltip props in button to get rid of js error

* Fix

* Fix unused import extension (#8463)

* Editing modal styles (#8455)

* [connectors] Implement upsertion for the articles (Help Center) (#8450)

* turn the IDs from integers to bigints (example value: 24132475402897)

* implement upsertion for articles

* run a full sync on sync workflows without signals

* pass the description when creating a category

* correctly pass the categoryId when creating an article

* add logs on empty articles

* put the correct URL in the datasource

* add a method getParentInternalIds to the ZendeskArticleResource

* add the migration file

* remove an unnecessary fetch

* remove redundant mentions of the model and resource in use

* fix a confusion between category.id and category.categoryId

* make category content nodes expandable in read mode

* implement batch content retrieval for articles and tickets

* prevent articles from being upserted when already up to date

* lint

* add getParentInternalIds for categories and tickets

* [sparkle] Supports ref in LinkWrapper and forward to <a> (#8466)

---------

Co-authored-by: Daphné Popin <[email protected]>
Co-authored-by: Edouard Wautier <[email protected]>
Co-authored-by: Aubin <[email protected]>
Co-authored-by: Thomas Draier <[email protected]>
  • Loading branch information
5 people authored Nov 6, 2024
1 parent b7be308 commit 23fe34c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
8 changes: 5 additions & 3 deletions connectors/src/connectors/slack/bot.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { PublicPostContentFragmentRequestBody } from "@dust-tt/client";
import type {
ConversationPublicType,
PublicPostContentFragmentRequestBody,
} from "@dust-tt/client";
import { DustAPI } from "@dust-tt/client";
import type {
AgentMessageSuccessEvent,
APIError,
ConversationType,
LightAgentConfigurationType,
ModelId,
Result,
Expand Down Expand Up @@ -588,7 +590,7 @@ async function answerMessage(
return buildSlackMessageError(buildContentFragmentRes);
}

let conversation: ConversationType | undefined = undefined;
let conversation: ConversationPublicType | undefined = undefined;
let userMessage: UserMessageType | undefined = undefined;

if (lastSlackChatBotMessage?.conversationId) {
Expand Down
4 changes: 2 additions & 2 deletions connectors/src/connectors/slack/chat/citations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AgentActionType } from "@dust-tt/types";
import type { AgentActionPublicType } from "@dust-tt/client";
import {
getTitleFromRetrievedDocument,
isRetrievalActionType,
Expand All @@ -15,7 +15,7 @@ export type SlackMessageFootnotes = SlackMessageFootnote[];

export function annotateCitations(
content: string,
actions: AgentActionType[]
actions: AgentActionPublicType[]
): { formattedContent: string; footnotes: SlackMessageFootnotes } {
const references: {
[key: string]: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { DustAPI } from "@dust-tt/client";
import type {
AgentActionType,
AgentMessageType,
ConversationType,
AgentActionPublicType,
AgentMessagePublicType,
ConversationPublicType,
DustAPI,
} from "@dust-tt/client";
import type {
LightAgentConfigurationType,
Result,
UserMessageType,
Expand All @@ -27,7 +29,7 @@ import type { ConnectorResource } from "@connectors/resources/connector_resource
interface StreamConversationToSlackParams {
assistantName: string;
connector: ConnectorResource;
conversation: ConversationType;
conversation: ConversationPublicType;
mainMessage: ChatPostMessageResponse;
slack: {
slackChannelId: string;
Expand Down Expand Up @@ -137,7 +139,7 @@ export async function streamConversationToSlack(
if (agentMessages.length === 0) {
return new Err(new Error("Failed to retrieve agent message"));
}
const agentMessage = agentMessages[0] as AgentMessageType;
const agentMessage = agentMessages[0] as AgentMessagePublicType;

const streamRes = await dustAPI.streamAgentMessageEvents({
conversation,
Expand All @@ -149,7 +151,7 @@ export async function streamConversationToSlack(
}

let answer = "";
const actions: AgentActionType[] = [];
const actions: AgentActionPublicType[] = [];
for await (const event of streamRes.value.eventStream) {
switch (event.type) {
case "retrieval_params":
Expand Down
4 changes: 2 additions & 2 deletions sdks/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {
AgentActionSpecificEvent,
AgentActionSuccessEvent,
AgentErrorEvent,
AgentMessagePublicType,
AgentMessageSuccessEvent,
AgentMessageType,
APIError,
ConversationPublicType,
DataSourceViewType,
Expand Down Expand Up @@ -530,7 +530,7 @@ export class DustAPI {
message,
}: {
conversation: ConversationPublicType;
message: AgentMessageType;
message: AgentMessagePublicType;
}) {
const res = await this.request({
method: "GET",
Expand Down
5 changes: 3 additions & 2 deletions sdks/js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ const AgentActionTypeSchema = z.union([
WebsearchActionTypeSchema,
BrowseActionTypeSchema,
]);
export type AgentActionPublicType = z.infer<typeof AgentActionTypeSchema>;

const AgentMessageStatusSchema = FlexibleEnumSchema([
"created",
Expand Down Expand Up @@ -772,7 +773,7 @@ const AgentMessageTypeSchema = z.object({
})
.nullable(),
});
export type AgentMessageType = z.infer<typeof AgentMessageTypeSchema>;
export type AgentMessagePublicType = z.infer<typeof AgentMessageTypeSchema>;

const ConversationVisibilitySchema = FlexibleEnumSchema([
"unlisted",
Expand Down Expand Up @@ -1390,7 +1391,7 @@ export type PublicPostMessagesRequestBody = z.infer<

export type PostMessagesResponseBody = {
message: UserMessageType;
agentMessages?: AgentMessageType[];
agentMessages?: AgentMessagePublicType[];
};

export const PublicPostContentFragmentRequestBodySchema = z.object({
Expand Down

0 comments on commit 23fe34c

Please sign in to comment.