Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
348 changes: 348 additions & 0 deletions .cursor/debug-f357a1.log

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useExecutionStream } from '@/hooks/use-execution-stream'
import { useExecutionStore } from '@/stores/execution/store'
import { useFolderStore } from '@/stores/folders/store'
import type { ChatContext } from '@/stores/panel'
import { useTerminalConsoleStore } from '@/stores/terminal'
import { consolePersistence, useTerminalConsoleStore } from '@/stores/terminal'
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
import type {
ChatMessage,
Expand Down Expand Up @@ -1512,6 +1512,7 @@ export function useChat(
})

executionStream.cancel(workflowId)
consolePersistence.executionEnded()
execState.setIsExecuting(workflowId, false)
execState.setIsDebugging(workflowId, false)
execState.setActiveBlocks(workflowId, new Set())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import { useChatStore } from '@/stores/chat/store'
import { getChatPosition } from '@/stores/chat/utils'
import { useCurrentWorkflowExecution } from '@/stores/execution'
import { useOperationQueue } from '@/stores/operation-queue/store'
import { useTerminalConsoleStore } from '@/stores/terminal'
import { useTerminalConsoleStore, useWorkflowConsoleEntries } from '@/stores/terminal'
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
import { useSubBlockStore } from '@/stores/workflows/subblock/store'
import { useWorkflowStore } from '@/stores/workflows/workflow/store'
Expand Down Expand Up @@ -265,8 +265,7 @@ export function Chat() {
)

const hasConsoleHydrated = useTerminalConsoleStore((state) => state._hasHydrated)
const entriesFromStore = useTerminalConsoleStore((state) => state.entries)
const entries = hasConsoleHydrated ? entriesFromStore : []
const entries = useWorkflowConsoleEntries(hasConsoleHydrated ? activeWorkflowId : undefined)
const { isExecuting } = useCurrentWorkflowExecution()
const { handleRunWorkflow, handleCancelExecution } = useWorkflowExecution()
const { data: session } = useSession()
Expand Down Expand Up @@ -427,9 +426,8 @@ export function Chat() {
})

const outputEntries = useMemo(() => {
if (!activeWorkflowId) return []
return entries.filter((entry) => entry.workflowId === activeWorkflowId && entry.output)
}, [entries, activeWorkflowId])
return entries.filter((entry) => entry.output)
}, [entries])

const workflowMessages = useMemo(() => {
if (!activeWorkflowId) return []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { ToggleButton } from '@/app/workspace/[workspaceId]/w/[workflowId]/compo
import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks'
import { useCodeViewerFeatures } from '@/hooks/use-code-viewer'
import type { ConsoleEntry } from '@/stores/terminal'
import { useTerminalStore } from '@/stores/terminal'
import { safeConsoleStringify, useTerminalStore } from '@/stores/terminal'

interface OutputCodeContentProps {
code: string
Expand Down Expand Up @@ -93,11 +93,10 @@ export interface OutputPanelProps {
handleTrainingClick: (e: React.MouseEvent) => void
showCopySuccess: boolean
handleCopy: () => void
filteredEntries: ConsoleEntry[]
hasEntries: boolean
handleExportConsole: (e: React.MouseEvent) => void
handleClearConsole: (e: React.MouseEvent) => void
shouldShowCodeDisplay: boolean
outputDataStringified: string
outputData: unknown
handleClearConsoleFromMenu: () => void
}
Expand All @@ -121,11 +120,10 @@ export const OutputPanel = React.memo(function OutputPanel({
handleTrainingClick,
showCopySuccess,
handleCopy,
filteredEntries,
hasEntries,
handleExportConsole,
handleClearConsole,
shouldShowCodeDisplay,
outputDataStringified,
outputData,
handleClearConsoleFromMenu,
}: OutputPanelProps) {
Expand Down Expand Up @@ -276,6 +274,19 @@ export const OutputPanel = React.memo(function OutputPanel({
[isOutputSearchActive, outputSearchQuery]
)

const outputDataStringified = useMemo(() => {
if (
structuredView ||
shouldShowCodeDisplay ||
outputData === null ||
outputData === undefined
) {
return ''
}

return safeConsoleStringify(outputData)
}, [outputData, shouldShowCodeDisplay, structuredView])

return (
<>
<div
Expand Down Expand Up @@ -420,7 +431,7 @@ export const OutputPanel = React.memo(function OutputPanel({
<span>{showCopySuccess ? 'Copied' : 'Copy output'}</span>
</Tooltip.Content>
</Tooltip.Root>
{filteredEntries.length > 0 && (
{hasEntries && (
<>
<Tooltip.Root>
<Tooltip.Trigger asChild>
Expand Down
Loading
Loading