Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
spolu committed Nov 15, 2024
1 parent cf97767 commit 952f8f1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
21 changes: 10 additions & 11 deletions front/components/actions/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
ConfigurableAgentActionType,
LightWorkspaceType,
} from "@dust-tt/types";
import type { AgentActionType, LightWorkspaceType } from "@dust-tt/types";
import { ACTION_RUNNING_LABELS } from "@dust-tt/types";

import { BrowseActionDetails } from "@app/components/actions/browse/BrowseActionDetails";
Expand All @@ -12,24 +9,22 @@ import { TablesQueryActionDetails } from "@app/components/actions/tables_query/T
import { WebsearchActionDetails } from "@app/components/actions/websearch/WebsearchActionDetails";

export interface ActionDetailsComponentBaseProps<
T extends ConfigurableAgentActionType = ConfigurableAgentActionType,
T extends AgentActionType = AgentActionType,
> {
action: T;
owner: LightWorkspaceType;
defaultOpen: boolean;
}

interface ActionSpecification<T extends ConfigurableAgentActionType> {
interface ActionSpecification<T extends AgentActionType> {
runningLabel: string;
detailsComponent: React.ComponentType<ActionDetailsComponentBaseProps<T>>;
}

type ActionType = ConfigurableAgentActionType["type"];
type ActionType = AgentActionType["type"];

type ActionSpecifications = {
[K in ActionType]: ActionSpecification<
Extract<ConfigurableAgentActionType, { type: K }>
>;
[K in ActionType]: ActionSpecification<Extract<AgentActionType, { type: K }>>;
};

const actionsSpecification: ActionSpecifications = {
Expand Down Expand Up @@ -57,10 +52,14 @@ const actionsSpecification: ActionSpecifications = {
detailsComponent: BrowseActionDetails,
runningLabel: ACTION_RUNNING_LABELS.browse_action,
},
jit_list_files_action: {
detailsComponent: () => null,
runningLabel: ACTION_RUNNING_LABELS.jit_list_files_action,
},
};

export function getActionSpecification<T extends ActionType>(
actionType: T
): ActionSpecification<Extract<ConfigurableAgentActionType, { type: T }>> {
): ActionSpecification<Extract<AgentActionType, { type: T }>> {
return actionsSpecification[actionType];
}
12 changes: 6 additions & 6 deletions sdks/js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,20 +613,20 @@ type TablesQueryActionPublicType = z.infer<typeof TablesQueryActionTypeSchema>;
const JITFileTypeSchema = z.object({
fileId: z.string(),
title: z.string(),
contentType: SupportedContentFragmentTypeSchema,
contentType: z.string(),
});

const JITListFilesActionTypeSchema = BaseActionSchema.extend({
files: z.array(JITFileTypeSchema).nullable(),
files: z.array(JITFileTypeSchema),
functionCallId: z.string().nullable(),
functionCallName: z.string().nullable(),
agentMessageId: ModelIdSchema,
step: z.number(),
type: z.literal("tables_query_action"),
type: z.literal("jit_list_files_action"),
});
type JITListFIlesActionPublicType = z.infer<
typeof JITListFilesActionTypeSchema
>;
// type JITListFIlesActionPublicType = z.infer<
// typeof JITListFilesActionTypeSchema
// >;

const WhitelistableFeaturesSchema = FlexibleEnumSchema([
"usage_data_api",
Expand Down
2 changes: 1 addition & 1 deletion types/src/front/assistant/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const ACTION_RUNNING_LABELS: Record<AgentActionType["type"], string> = {
tables_query_action: "Querying tables",
websearch_action: "Searching the web",
browse_action: "Browsing page",
jit_list_files_action: "Listing files",
jit_list_files_action: "Listing conversation files",
};

/**
Expand Down

0 comments on commit 952f8f1

Please sign in to comment.