Skip to content

Commit

Permalink
Use isRetrievalActionType typeguard in connector (#5106)
Browse files Browse the repository at this point in the history
  • Loading branch information
flvndvd authored May 16, 2024
1 parent d2e43e8 commit 53b5fce
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions connectors/src/connectors/slack/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import type {
AgentGenerationSuccessEvent,
PublicPostContentFragmentRequestBodySchema,
} from "@dust-tt/types";
import { Err, Ok, sectionFullText } from "@dust-tt/types";
import {
Err,
isRetrievalActionType,
Ok,
sectionFullText,
} from "@dust-tt/types";
import { DustAPI } from "@dust-tt/types";
import type { WebClient } from "@slack/web-api";
import type { MessageElement } from "@slack/web-api/dist/response/ConversationsHistoryResponse";
Expand Down Expand Up @@ -583,7 +588,7 @@ function _processCiteMention(
): string {
const references: { [key: string]: RetrievalDocumentType } = {};

if (action && action.type === "retrieval_action" && action.documents) {
if (action && isRetrievalActionType(action) && action.documents) {
action.documents.forEach((d) => {
references[d.reference] = d;
});
Expand Down

0 comments on commit 53b5fce

Please sign in to comment.