Skip to content

Commit a68c47b

Browse files
author
aadamgough
committed
fixed slack output
1 parent 25f7ed2 commit a68c47b

File tree

4 files changed

+47
-23
lines changed

4 files changed

+47
-23
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,31 +1214,25 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
12141214

12151215
let processedTag = tag
12161216

1217-
// Check if this is a file property and add [0] automatically
1218-
// Only include user-accessible fields (matches UserFile interface)
1219-
const fileProperties = ['id', 'name', 'url', 'size', 'type']
12201217
const parts = tag.split('.')
1221-
if (parts.length >= 2 && fileProperties.includes(parts[parts.length - 1])) {
1222-
const fieldName = parts[parts.length - 2]
1223-
1224-
if (blockGroup) {
1225-
const block = useWorkflowStore.getState().blocks[blockGroup.blockId]
1226-
const blockConfig = block ? (getBlock(block.type) ?? null) : null
1227-
const mergedSubBlocks = getMergedSubBlocks(blockGroup.blockId)
1228-
1229-
const fieldType = getOutputTypeForPath(
1230-
block,
1231-
blockConfig,
1232-
blockGroup.blockId,
1233-
fieldName,
1234-
mergedSubBlocks
1235-
)
1218+
if (parts.length >= 3 && blockGroup) {
1219+
const arrayFieldName = parts[1] // e.g., "channels", "files", "users"
1220+
const block = useWorkflowStore.getState().blocks[blockGroup.blockId]
1221+
const blockConfig = block ? (getBlock(block.type) ?? null) : null
1222+
const mergedSubBlocks = getMergedSubBlocks(blockGroup.blockId)
1223+
1224+
const fieldType = getOutputTypeForPath(
1225+
block,
1226+
blockConfig,
1227+
blockGroup.blockId,
1228+
arrayFieldName,
1229+
mergedSubBlocks
1230+
)
12361231

1237-
if (fieldType === 'files') {
1238-
const blockAndField = parts.slice(0, -1).join('.')
1239-
const property = parts[parts.length - 1]
1240-
processedTag = `${blockAndField}[0].${property}`
1241-
}
1232+
if (fieldType === 'files' || fieldType === 'array') {
1233+
const blockName = parts[0]
1234+
const remainingPath = parts.slice(2).join('.')
1235+
processedTag = `${blockName}.${arrayFieldName}[0].${remainingPath}`
12421236
}
12431237
}
12441238

apps/sim/tools/slack/list_channels.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,15 @@ export const slackListChannelsTool: ToolConfig<SlackListChannelsParams, SlackLis
110110
creator: channel.creator,
111111
}))
112112

113+
const ids = channels.map((channel: { id: string }) => channel.id)
114+
const names = channels.map((channel: { name: string }) => channel.name)
115+
113116
return {
114117
success: true,
115118
output: {
116119
channels,
120+
ids,
121+
names,
117122
count: channels.length,
118123
},
119124
}
@@ -142,6 +147,14 @@ export const slackListChannelsTool: ToolConfig<SlackListChannelsParams, SlackLis
142147
},
143148
},
144149
},
150+
ids: {
151+
type: 'array',
152+
description: 'Array of channel IDs for easy access',
153+
},
154+
names: {
155+
type: 'array',
156+
description: 'Array of channel names for easy access',
157+
},
145158
count: {
146159
type: 'number',
147160
description: 'Total number of channels returned',

apps/sim/tools/slack/list_users.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,15 @@ export const slackListUsersTool: ToolConfig<SlackListUsersParams, SlackListUsers
102102
status_emoji: user.profile?.status_emoji || '',
103103
}))
104104

105+
const ids = users.map((user: { id: string }) => user.id)
106+
const names = users.map((user: { name: string }) => user.name)
107+
105108
return {
106109
success: true,
107110
output: {
108111
users,
112+
ids,
113+
names,
109114
count: users.length,
110115
},
111116
}
@@ -133,6 +138,14 @@ export const slackListUsersTool: ToolConfig<SlackListUsersParams, SlackListUsers
133138
},
134139
},
135140
},
141+
ids: {
142+
type: 'array',
143+
description: 'Array of user IDs for easy access',
144+
},
145+
names: {
146+
type: 'array',
147+
description: 'Array of usernames for easy access',
148+
},
136149
count: {
137150
type: 'number',
138151
description: 'Total number of users returned',

apps/sim/tools/slack/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ export interface SlackChannel {
245245
export interface SlackListChannelsResponse extends ToolResponse {
246246
output: {
247247
channels: SlackChannel[]
248+
ids: string[]
249+
names: string[]
248250
count: number
249251
}
250252
}
@@ -291,6 +293,8 @@ export interface SlackUser {
291293
export interface SlackListUsersResponse extends ToolResponse {
292294
output: {
293295
users: SlackUser[]
296+
ids: string[]
297+
names: string[]
294298
count: number
295299
}
296300
}

0 commit comments

Comments
 (0)