Skip to content

Commit da30c25

Browse files
improvement(chat): increase max files to 15 and resolve workflow variables in webhook execution (#1764)
* improvement(chat): increase max files to 15 and resolve workflow variables in webhook execution * fix workflow vars * fix for schedules
1 parent b95ea91 commit da30c25

File tree

5 files changed

+10
-23
lines changed

5 files changed

+10
-23
lines changed

apps/sim/app/chat/components/input/input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export const ChatInput: React.FC<{
105105

106106
const newFiles: AttachedFile[] = []
107107
const maxSize = 10 * 1024 * 1024 // 10MB limit
108-
const maxFiles = 5
108+
const maxFiles = 15
109109

110110
for (let i = 0; i < selectedFiles.length; i++) {
111111
if (attachedFiles.length + newFiles.length >= maxFiles) break
@@ -340,7 +340,7 @@ export const ChatInput: React.FC<{
340340
<button
341341
type='button'
342342
onClick={() => fileInputRef.current?.click()}
343-
disabled={isStreaming || attachedFiles.length >= 5}
343+
disabled={isStreaming || attachedFiles.length >= 15}
344344
className='flex items-center justify-center rounded-full p-1.5 text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 md:p-2'
345345
>
346346
<Paperclip size={16} className='md:h-5 md:w-5' />

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/chat/chat.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ export function Chat({ chatMessage, setChatMessage }: ChatProps) {
622622
if (!(!activeWorkflowId || isExecuting || isUploadingFiles)) {
623623
const droppedFiles = Array.from(e.dataTransfer.files)
624624
if (droppedFiles.length > 0) {
625-
const remainingSlots = Math.max(0, 5 - chatFiles.length)
625+
const remainingSlots = Math.max(0, 15 - chatFiles.length)
626626
const candidateFiles = droppedFiles.slice(0, remainingSlots)
627627
const errors: string[] = []
628628
const validNewFiles: ChatFile[] = []
@@ -781,7 +781,7 @@ export function Chat({ chatMessage, setChatMessage }: ChatProps) {
781781
size='icon'
782782
onClick={() => document.getElementById('chat-file-input')?.click()}
783783
disabled={
784-
!activeWorkflowId || isExecuting || isUploadingFiles || chatFiles.length >= 5
784+
!activeWorkflowId || isExecuting || isUploadingFiles || chatFiles.length >= 15
785785
}
786786
className='h-6 w-6 shrink-0 text-muted-foreground hover:text-foreground'
787787
title='Attach files'
@@ -802,8 +802,8 @@ export function Chat({ chatMessage, setChatMessage }: ChatProps) {
802802
const newFiles: ChatFile[] = []
803803
const errors: string[] = []
804804
for (let i = 0; i < files.length; i++) {
805-
if (chatFiles.length + newFiles.length >= 5) {
806-
errors.push('Maximum 5 files allowed')
805+
if (chatFiles.length + newFiles.length >= 15) {
806+
errors.push('Maximum 15 files allowed')
807807
break
808808
}
809809
const file = files[i]

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/chat/components/chat-file-upload/chat-file-upload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface ChatFileUploadProps {
2727
export function ChatFileUpload({
2828
files,
2929
onFilesChange,
30-
maxFiles = 5,
30+
maxFiles = 15,
3131
maxSize = 10,
3232
acceptedTypes = ['*'],
3333
disabled = false,

apps/sim/background/schedule-execution.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -306,18 +306,7 @@ export async function executeScheduleJob(payload: ScheduleExecutionPayload) {
306306
{} as Record<string, Record<string, any>>
307307
)
308308

309-
let workflowVariables = {}
310-
if (workflowRecord.variables) {
311-
try {
312-
if (typeof workflowRecord.variables === 'string') {
313-
workflowVariables = JSON.parse(workflowRecord.variables)
314-
} else {
315-
workflowVariables = workflowRecord.variables
316-
}
317-
} catch (error) {
318-
logger.error(`Failed to parse workflow variables: ${payload.workflowId}`, error)
319-
}
320-
}
309+
const workflowVariables = (workflowRecord.variables as Record<string, any>) || {}
321310

322311
const serializedWorkflow = new Serializer().serializeWorkflow(
323312
mergedStates,

apps/sim/background/webhook-execution.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,12 @@ async function executeWebhookJobInternal(
160160
const { blocks, edges, loops, parallels } = workflowData
161161

162162
const wfRows = await db
163-
.select({ workspaceId: workflowTable.workspaceId })
163+
.select({ workspaceId: workflowTable.workspaceId, variables: workflowTable.variables })
164164
.from(workflowTable)
165165
.where(eq(workflowTable.id, payload.workflowId))
166166
.limit(1)
167167
const workspaceId = wfRows[0]?.workspaceId || undefined
168+
const workflowVariables = (wfRows[0]?.variables as Record<string, any>) || {}
168169

169170
const { personalEncrypted, workspaceEncrypted } = await getPersonalAndWorkspaceEnv(
170171
payload.userId,
@@ -208,9 +209,6 @@ async function executeWebhookJobInternal(
208209
{} as Record<string, Record<string, any>>
209210
)
210211

211-
// Handle workflow variables (for now, use empty object since we don't have workflow metadata)
212-
const workflowVariables = {}
213-
214212
// Create serialized workflow
215213
const serializer = new Serializer()
216214
const serializedWorkflow = serializer.serializeWorkflow(

0 commit comments

Comments
 (0)