mirror of
https://github.com/langgenius/dify.git
synced 2026-11-13 06:41:07 +08:00
Recognize initial templates, generate graphs in the app mode, and replace default nodes atomically after approval. Normalize node ordering in execution revisions to prevent false 409 conflicts, with frontend and backend regression coverage.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import type { DifyBuilderRuntime } from '@/app/components/workflow-app/components/dify-builder/store'
|
|
import { vi } from 'vite-plus/test'
|
|
|
|
type RuntimeOverrides = Omit<Partial<DifyBuilderRuntime>, 'session'> & {
|
|
session?: Partial<DifyBuilderRuntime['session']>
|
|
}
|
|
|
|
export const createDifyBuilderRuntime = (overrides: RuntimeOverrides = {}): DifyBuilderRuntime => ({
|
|
appId: 'app-1',
|
|
canEdit: true,
|
|
enabled: true,
|
|
getCanvasSnapshot: () => ({ nodes: [], edges: [], isChatflow: false }),
|
|
setShowPanel: vi.fn(),
|
|
...overrides,
|
|
session: {
|
|
onCanvasRefreshed: vi.fn(),
|
|
getTrace: vi.fn(() => ({ entries: [], truncated: false })),
|
|
loadOlderConversation: vi.fn(async () => true),
|
|
refresh: vi.fn(async () => true),
|
|
restore: vi.fn(async () => true),
|
|
reset: vi.fn(),
|
|
runAction: vi.fn(async () => true),
|
|
sendMessage: vi.fn(async () => true),
|
|
startBuild: vi.fn(async () => true),
|
|
startChecklistFix: vi.fn(async () => true),
|
|
startEdit: vi.fn(async () => true),
|
|
startFix: vi.fn(async () => true),
|
|
updateModel: vi.fn(async () => true),
|
|
...overrides.session,
|
|
},
|
|
})
|