chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
60158935f4
commit
6519682885
15831 files changed
+3063428
No files matched your search
@@ -0,0 +1,78 @@
|
||||
import type { SyncDraftWorkflowPayload } from '@dify/contracts/api/console/apps/types.gen'
|
||||
import type { ConsoleClient } from './console-client.ts'
|
||||
|
||||
export async function syncMinimalWorkflowDraft(
|
||||
client: ConsoleClient,
|
||||
appId: string,
|
||||
): Promise<void> {
|
||||
const body = {
|
||||
graph: {
|
||||
nodes: [
|
||||
{
|
||||
id: '1',
|
||||
type: 'custom',
|
||||
position: { x: 80, y: 282 },
|
||||
data: { id: '1', type: 'start', title: 'Start', variables: [] },
|
||||
},
|
||||
],
|
||||
edges: [],
|
||||
viewport: { x: 0, y: 0, zoom: 1 },
|
||||
},
|
||||
features: {},
|
||||
conversation_variables: [],
|
||||
} satisfies SyncDraftWorkflowPayload
|
||||
await client.apps.byAppId.workflows.draft.post({ body, params: { app_id: appId } })
|
||||
}
|
||||
|
||||
export async function syncRunnableWorkflowDraft(
|
||||
client: ConsoleClient,
|
||||
appId: string,
|
||||
{
|
||||
mode = 'workflow',
|
||||
variables = [],
|
||||
}: {
|
||||
mode?: 'workflow' | 'advanced-chat'
|
||||
variables?: Record<string, unknown>[]
|
||||
} = {},
|
||||
): Promise<void> {
|
||||
const body = {
|
||||
graph: {
|
||||
nodes: [
|
||||
{
|
||||
id: 'start',
|
||||
type: 'custom',
|
||||
position: { x: 80, y: 282 },
|
||||
data: { id: 'start', type: 'start', title: 'Start', variables },
|
||||
},
|
||||
{
|
||||
id: 'end',
|
||||
type: 'custom',
|
||||
position: { x: 480, y: 282 },
|
||||
data:
|
||||
mode === 'advanced-chat'
|
||||
? { id: 'end', type: 'answer', title: 'Answer', answer: 'E2E response' }
|
||||
: {
|
||||
id: 'end',
|
||||
type: 'end',
|
||||
title: 'End',
|
||||
outputs: [{ variable: 'result', value_selector: ['sys', 'workflow_run_id'] }],
|
||||
},
|
||||
},
|
||||
],
|
||||
edges: [
|
||||
{
|
||||
id: 'start-end',
|
||||
type: 'custom',
|
||||
source: 'start',
|
||||
target: 'end',
|
||||
sourceHandle: 'source',
|
||||
targetHandle: 'target',
|
||||
},
|
||||
],
|
||||
viewport: { x: 0, y: 0, zoom: 1 },
|
||||
},
|
||||
features: {},
|
||||
conversation_variables: [],
|
||||
} satisfies SyncDraftWorkflowPayload
|
||||
await client.apps.byAppId.workflows.draft.post({ body, params: { app_id: appId } })
|
||||
}
|
||||
Reference in new issue
Block a user