mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-18 11:28:05 -05:00
Compare commits
3 Commits
staging
...
improvemen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05efe79afd | ||
|
|
8cc0d0601e | ||
|
|
98ac046935 |
@@ -557,7 +557,7 @@ function FileUploadSyncWrapper({
|
||||
)
|
||||
}
|
||||
|
||||
function ChannelSelectorSyncWrapper({
|
||||
function SlackSelectorSyncWrapper({
|
||||
blockId,
|
||||
paramId,
|
||||
value,
|
||||
@@ -565,6 +565,7 @@ function ChannelSelectorSyncWrapper({
|
||||
uiComponent,
|
||||
disabled,
|
||||
previewContextValues,
|
||||
selectorType,
|
||||
}: {
|
||||
blockId: string
|
||||
paramId: string
|
||||
@@ -573,6 +574,7 @@ function ChannelSelectorSyncWrapper({
|
||||
uiComponent: any
|
||||
disabled: boolean
|
||||
previewContextValues?: Record<string, any>
|
||||
selectorType: 'channel-selector' | 'user-selector'
|
||||
}) {
|
||||
return (
|
||||
<GenericSyncWrapper blockId={blockId} paramId={paramId} value={value} onChange={onChange}>
|
||||
@@ -580,7 +582,7 @@ function ChannelSelectorSyncWrapper({
|
||||
blockId={blockId}
|
||||
subBlock={{
|
||||
id: paramId,
|
||||
type: 'channel-selector' as const,
|
||||
type: selectorType,
|
||||
title: paramId,
|
||||
serviceId: uiComponent.serviceId,
|
||||
placeholder: uiComponent.placeholder,
|
||||
@@ -1952,7 +1954,7 @@ export function ToolInput({
|
||||
|
||||
case 'channel-selector':
|
||||
return (
|
||||
<ChannelSelectorSyncWrapper
|
||||
<SlackSelectorSyncWrapper
|
||||
blockId={blockId}
|
||||
paramId={param.id}
|
||||
value={value}
|
||||
@@ -1960,6 +1962,21 @@ export function ToolInput({
|
||||
uiComponent={uiComponent}
|
||||
disabled={disabled}
|
||||
previewContextValues={currentToolParams as any}
|
||||
selectorType='channel-selector'
|
||||
/>
|
||||
)
|
||||
|
||||
case 'user-selector':
|
||||
return (
|
||||
<SlackSelectorSyncWrapper
|
||||
blockId={blockId}
|
||||
paramId={param.id}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
uiComponent={uiComponent}
|
||||
disabled={disabled}
|
||||
previewContextValues={currentToolParams as any}
|
||||
selectorType='user-selector'
|
||||
/>
|
||||
)
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@ export async function ensureBlockEnvVarsResolvable(
|
||||
options: { requestId?: string } = {}
|
||||
): Promise<void> {
|
||||
const requestId = options.requestId
|
||||
const envVarPattern = createEnvVarPattern()
|
||||
await Promise.all(
|
||||
Object.values(blocks).map(async (block) => {
|
||||
const subBlocks = block.subBlocks ?? {}
|
||||
@@ -157,7 +158,6 @@ export async function ensureBlockEnvVarsResolvable(
|
||||
return
|
||||
}
|
||||
|
||||
const envVarPattern = createEnvVarPattern()
|
||||
const matches = value.match(envVarPattern)
|
||||
if (!matches) {
|
||||
return
|
||||
|
||||
@@ -20,6 +20,12 @@ export const slackMessageTool: ToolConfig<SlackMessageParams, SlackMessageRespon
|
||||
visibility: 'user-only',
|
||||
description: 'Authentication method: oauth or bot_token',
|
||||
},
|
||||
destinationType: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description: 'Destination type: channel or dm',
|
||||
},
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
@@ -38,11 +44,11 @@ export const slackMessageTool: ToolConfig<SlackMessageParams, SlackMessageRespon
|
||||
visibility: 'user-only',
|
||||
description: 'Target Slack channel (e.g., #general)',
|
||||
},
|
||||
userId: {
|
||||
dmUserId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description: 'Target Slack user ID for direct messages (e.g., U1234567890)',
|
||||
description: 'Target Slack user for direct messages',
|
||||
},
|
||||
text: {
|
||||
type: 'string',
|
||||
@@ -71,10 +77,11 @@ export const slackMessageTool: ToolConfig<SlackMessageParams, SlackMessageRespon
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params: SlackMessageParams) => {
|
||||
const isDM = params.destinationType === 'dm'
|
||||
return {
|
||||
accessToken: params.accessToken || params.botToken,
|
||||
channel: params.channel,
|
||||
userId: params.userId,
|
||||
channel: isDM ? undefined : params.channel,
|
||||
userId: isDM ? params.dmUserId : params.userId,
|
||||
text: params.text,
|
||||
thread_ts: params.thread_ts || undefined,
|
||||
files: params.files || null,
|
||||
|
||||
@@ -23,6 +23,12 @@ export const slackMessageReaderTool: ToolConfig<
|
||||
visibility: 'user-only',
|
||||
description: 'Authentication method: oauth or bot_token',
|
||||
},
|
||||
destinationType: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description: 'Destination type: channel or dm',
|
||||
},
|
||||
botToken: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
@@ -41,11 +47,11 @@ export const slackMessageReaderTool: ToolConfig<
|
||||
visibility: 'user-only',
|
||||
description: 'Slack channel to read messages from (e.g., #general)',
|
||||
},
|
||||
userId: {
|
||||
dmUserId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description: 'User ID for DM conversation (e.g., U1234567890)',
|
||||
description: 'Target Slack user for DM conversation',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
@@ -73,14 +79,17 @@ export const slackMessageReaderTool: ToolConfig<
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params: SlackMessageReaderParams) => ({
|
||||
accessToken: params.accessToken || params.botToken,
|
||||
channel: params.channel,
|
||||
userId: params.userId,
|
||||
limit: params.limit,
|
||||
oldest: params.oldest,
|
||||
latest: params.latest,
|
||||
}),
|
||||
body: (params: SlackMessageReaderParams) => {
|
||||
const isDM = params.destinationType === 'dm'
|
||||
return {
|
||||
accessToken: params.accessToken || params.botToken,
|
||||
channel: isDM ? undefined : params.channel,
|
||||
userId: isDM ? params.dmUserId : params.userId,
|
||||
limit: params.limit,
|
||||
oldest: params.oldest,
|
||||
latest: params.latest,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
|
||||
@@ -7,7 +7,9 @@ export interface SlackBaseParams {
|
||||
}
|
||||
|
||||
export interface SlackMessageParams extends SlackBaseParams {
|
||||
destinationType?: 'channel' | 'dm'
|
||||
channel?: string
|
||||
dmUserId?: string
|
||||
userId?: string
|
||||
text: string
|
||||
thread_ts?: string
|
||||
@@ -22,7 +24,9 @@ export interface SlackCanvasParams extends SlackBaseParams {
|
||||
}
|
||||
|
||||
export interface SlackMessageReaderParams extends SlackBaseParams {
|
||||
destinationType?: 'channel' | 'dm'
|
||||
channel?: string
|
||||
dmUserId?: string
|
||||
userId?: string
|
||||
limit?: number
|
||||
oldest?: string
|
||||
|
||||
Reference in New Issue
Block a user