mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-07 21:25:38 -05:00
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
This commit is contained in:
committed by
GitHub
parent
b95ea9148f
commit
da30c25efa
@@ -105,7 +105,7 @@ export const ChatInput: React.FC<{
|
||||
|
||||
const newFiles: AttachedFile[] = []
|
||||
const maxSize = 10 * 1024 * 1024 // 10MB limit
|
||||
const maxFiles = 5
|
||||
const maxFiles = 15
|
||||
|
||||
for (let i = 0; i < selectedFiles.length; i++) {
|
||||
if (attachedFiles.length + newFiles.length >= maxFiles) break
|
||||
@@ -340,7 +340,7 @@ export const ChatInput: React.FC<{
|
||||
<button
|
||||
type='button'
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
disabled={isStreaming || attachedFiles.length >= 5}
|
||||
disabled={isStreaming || attachedFiles.length >= 15}
|
||||
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'
|
||||
>
|
||||
<Paperclip size={16} className='md:h-5 md:w-5' />
|
||||
|
||||
@@ -622,7 +622,7 @@ export function Chat({ chatMessage, setChatMessage }: ChatProps) {
|
||||
if (!(!activeWorkflowId || isExecuting || isUploadingFiles)) {
|
||||
const droppedFiles = Array.from(e.dataTransfer.files)
|
||||
if (droppedFiles.length > 0) {
|
||||
const remainingSlots = Math.max(0, 5 - chatFiles.length)
|
||||
const remainingSlots = Math.max(0, 15 - chatFiles.length)
|
||||
const candidateFiles = droppedFiles.slice(0, remainingSlots)
|
||||
const errors: string[] = []
|
||||
const validNewFiles: ChatFile[] = []
|
||||
@@ -781,7 +781,7 @@ export function Chat({ chatMessage, setChatMessage }: ChatProps) {
|
||||
size='icon'
|
||||
onClick={() => document.getElementById('chat-file-input')?.click()}
|
||||
disabled={
|
||||
!activeWorkflowId || isExecuting || isUploadingFiles || chatFiles.length >= 5
|
||||
!activeWorkflowId || isExecuting || isUploadingFiles || chatFiles.length >= 15
|
||||
}
|
||||
className='h-6 w-6 shrink-0 text-muted-foreground hover:text-foreground'
|
||||
title='Attach files'
|
||||
@@ -802,8 +802,8 @@ export function Chat({ chatMessage, setChatMessage }: ChatProps) {
|
||||
const newFiles: ChatFile[] = []
|
||||
const errors: string[] = []
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
if (chatFiles.length + newFiles.length >= 5) {
|
||||
errors.push('Maximum 5 files allowed')
|
||||
if (chatFiles.length + newFiles.length >= 15) {
|
||||
errors.push('Maximum 15 files allowed')
|
||||
break
|
||||
}
|
||||
const file = files[i]
|
||||
|
||||
@@ -27,7 +27,7 @@ interface ChatFileUploadProps {
|
||||
export function ChatFileUpload({
|
||||
files,
|
||||
onFilesChange,
|
||||
maxFiles = 5,
|
||||
maxFiles = 15,
|
||||
maxSize = 10,
|
||||
acceptedTypes = ['*'],
|
||||
disabled = false,
|
||||
|
||||
@@ -306,18 +306,7 @@ export async function executeScheduleJob(payload: ScheduleExecutionPayload) {
|
||||
{} as Record<string, Record<string, any>>
|
||||
)
|
||||
|
||||
let workflowVariables = {}
|
||||
if (workflowRecord.variables) {
|
||||
try {
|
||||
if (typeof workflowRecord.variables === 'string') {
|
||||
workflowVariables = JSON.parse(workflowRecord.variables)
|
||||
} else {
|
||||
workflowVariables = workflowRecord.variables
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`Failed to parse workflow variables: ${payload.workflowId}`, error)
|
||||
}
|
||||
}
|
||||
const workflowVariables = (workflowRecord.variables as Record<string, any>) || {}
|
||||
|
||||
const serializedWorkflow = new Serializer().serializeWorkflow(
|
||||
mergedStates,
|
||||
|
||||
@@ -160,11 +160,12 @@ async function executeWebhookJobInternal(
|
||||
const { blocks, edges, loops, parallels } = workflowData
|
||||
|
||||
const wfRows = await db
|
||||
.select({ workspaceId: workflowTable.workspaceId })
|
||||
.select({ workspaceId: workflowTable.workspaceId, variables: workflowTable.variables })
|
||||
.from(workflowTable)
|
||||
.where(eq(workflowTable.id, payload.workflowId))
|
||||
.limit(1)
|
||||
const workspaceId = wfRows[0]?.workspaceId || undefined
|
||||
const workflowVariables = (wfRows[0]?.variables as Record<string, any>) || {}
|
||||
|
||||
const { personalEncrypted, workspaceEncrypted } = await getPersonalAndWorkspaceEnv(
|
||||
payload.userId,
|
||||
@@ -208,9 +209,6 @@ async function executeWebhookJobInternal(
|
||||
{} as Record<string, Record<string, any>>
|
||||
)
|
||||
|
||||
// Handle workflow variables (for now, use empty object since we don't have workflow metadata)
|
||||
const workflowVariables = {}
|
||||
|
||||
// Create serialized workflow
|
||||
const serializer = new Serializer()
|
||||
const serializedWorkflow = serializer.serializeWorkflow(
|
||||
|
||||
Reference in New Issue
Block a user