Skip to content

Commit 7752bea

Browse files
authored
fix(import): fix array errors on import/export (#2211)
* Fix import/export * Remove copilot gdrive tools * Null * Fix lint * Add copilot validation * Fix validation
1 parent 7101dc5 commit 7752bea

File tree

21 files changed

+1374
-1549
lines changed

21 files changed

+1374
-1549
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/mermaid-diagram/mermaid-diagram.tsx

Lines changed: 0 additions & 158 deletions
This file was deleted.

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx

Lines changed: 0 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22

33
import { useEffect, useRef, useState } from 'react'
44
import { Loader2 } from 'lucide-react'
5-
import useDrivePicker from 'react-google-drive-picker'
65
import { Button, Code } from '@/components/emcn'
7-
import { GoogleDriveIcon } from '@/components/icons'
86
import { ClientToolCallState } from '@/lib/copilot/tools/client/base-tool'
97
import { getClientTool } from '@/lib/copilot/tools/client/manager'
108
import { getRegisteredTools } from '@/lib/copilot/tools/client/registry'
11-
import { getEnv } from '@/lib/core/config/env'
129
import { CLASS_TOOL_METADATA, useCopilotStore } from '@/stores/panel/copilot/store'
1310
import type { CopilotToolCall } from '@/stores/panel/copilot/types'
14-
import { MermaidDiagram } from '../mermaid-diagram/mermaid-diagram'
1511

1612
interface ToolCallProps {
1713
toolCall?: CopilotToolCall
@@ -351,7 +347,6 @@ function RunSkipButtons({
351347
const [isProcessing, setIsProcessing] = useState(false)
352348
const [buttonsHidden, setButtonsHidden] = useState(false)
353349
const { setToolCallState } = useCopilotStore()
354-
const [openPicker] = useDrivePicker()
355350

356351
const instance = getClientTool(toolCall.id)
357352
const interruptDisplays = instance?.getInterruptDisplays?.()
@@ -368,107 +363,8 @@ function RunSkipButtons({
368363
}
369364
}
370365

371-
// const handleOpenDriveAccess = async () => {
372-
// try {
373-
// const providerId = 'google-drive'
374-
// const credsRes = await fetch(`/api/auth/oauth/credentials?provider=${providerId}`)
375-
// if (!credsRes.ok) return
376-
// const credsData = await credsRes.json()
377-
// const creds = Array.isArray(credsData.credentials) ? credsData.credentials : []
378-
// if (creds.length === 0) return
379-
// const defaultCred = creds.find((c: any) => c.isDefault) || creds[0]
380-
381-
// const tokenRes = await fetch('/api/auth/oauth/token', {
382-
// method: 'POST',
383-
// headers: { 'Content-Type': 'application/json' },
384-
// body: JSON.stringify({ credentialId: defaultCred.id }),
385-
// })
386-
// if (!tokenRes.ok) return
387-
// const { accessToken } = await tokenRes.json()
388-
// if (!accessToken) return
389-
390-
// const clientId = getEnv('NEXT_PUBLIC_GOOGLE_CLIENT_ID') || ''
391-
// const apiKey = getEnv('NEXT_PUBLIC_GOOGLE_API_KEY') || ''
392-
// const projectNumber = getEnv('NEXT_PUBLIC_GOOGLE_PROJECT_NUMBER') || ''
393-
394-
// openPicker({
395-
// clientId,
396-
// developerKey: apiKey,
397-
// viewId: 'DOCS',
398-
// token: accessToken,
399-
// showUploadView: true,
400-
// showUploadFolders: true,
401-
// supportDrives: true,
402-
// multiselect: false,
403-
// appId: projectNumber,
404-
// setSelectFolderEnabled: false,
405-
// callbackFunction: async (data) => {
406-
// if (data.action === 'picked') {
407-
// await onRun()
408-
// }
409-
// },
410-
// })
411-
// } catch {}
412-
// }
413-
414366
if (buttonsHidden) return null
415367

416-
if (toolCall.name === 'gdrive_request_access' && toolCall.state === 'pending') {
417-
return (
418-
<div className='mt-[10px] flex gap-[6px]'>
419-
<Button
420-
onClick={async () => {
421-
const instance = getClientTool(toolCall.id)
422-
if (!instance) return
423-
await instance.handleAccept?.({
424-
openDrivePicker: async (accessToken: string) => {
425-
try {
426-
const clientId = getEnv('NEXT_PUBLIC_GOOGLE_CLIENT_ID') || ''
427-
const apiKey = getEnv('NEXT_PUBLIC_GOOGLE_API_KEY') || ''
428-
const projectNumber = getEnv('NEXT_PUBLIC_GOOGLE_PROJECT_NUMBER') || ''
429-
return await new Promise<boolean>((resolve) => {
430-
openPicker({
431-
clientId,
432-
developerKey: apiKey,
433-
viewId: 'DOCS',
434-
token: accessToken,
435-
showUploadView: true,
436-
showUploadFolders: true,
437-
supportDrives: true,
438-
multiselect: false,
439-
appId: projectNumber,
440-
setSelectFolderEnabled: false,
441-
callbackFunction: async (data) => {
442-
if (data.action === 'picked') resolve(true)
443-
else if (data.action === 'cancel') resolve(false)
444-
},
445-
})
446-
})
447-
} catch {
448-
return false
449-
}
450-
},
451-
})
452-
}}
453-
variant='primary'
454-
title='Grant Google Drive access'
455-
>
456-
<GoogleDriveIcon className='mr-0.5 h-4 w-4' />
457-
Select
458-
</Button>
459-
<Button
460-
onClick={async () => {
461-
setButtonsHidden(true)
462-
await handleSkip(toolCall, setToolCallState, onStateChange)
463-
}}
464-
variant='default'
465-
>
466-
Skip
467-
</Button>
468-
</div>
469-
)
470-
}
471-
472368
return (
473369
<div className='mt-[12px] flex gap-[6px]'>
474370
<Button onClick={onRun} disabled={isProcessing} variant='primary'>
@@ -950,35 +846,6 @@ export function ToolCall({ toolCall: toolCallProp, toolCallId, onStateChange }:
950846
)
951847
}
952848

953-
// Special rendering for generate_diagram - show mermaid diagram
954-
if (toolCall.name === 'generate_diagram') {
955-
const diagramText = params.diagramText || ''
956-
const language = params.language || 'mermaid'
957-
958-
return (
959-
<div className='w-full'>
960-
<ShimmerOverlayText
961-
text={displayName}
962-
active={isLoadingState}
963-
isSpecial={false}
964-
className='font-[470] font-season text-[#939393] text-sm dark:text-[#939393]'
965-
/>
966-
{diagramText && language === 'mermaid' && (
967-
<div className='mt-2'>
968-
<MermaidDiagram diagramText={diagramText} />
969-
</div>
970-
)}
971-
{showButtons && (
972-
<RunSkipButtons
973-
toolCall={toolCall}
974-
onStateChange={handleStateChange}
975-
editedParams={editedParams}
976-
/>
977-
)}
978-
</div>
979-
)
980-
}
981-
982849
return (
983850
<div className='w-full'>
984851
<div

0 commit comments

Comments
 (0)