mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
Merge branch 'feat/collaboration2' into feat/support-agent-sandbox
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import type { BlockEnum } from '@/app/components/workflow/types'
|
||||
import type { BlockEnum, ConversationVariable, EnvironmentVariable } from '@/app/components/workflow/types'
|
||||
import type { WorkflowDraftFeaturesPayload } from '@/contract/console/workflow'
|
||||
import type { CommonResponse } from '@/models/common'
|
||||
import type { FlowType } from '@/types/common'
|
||||
import type {
|
||||
@ -10,9 +11,12 @@ import type {
|
||||
VarInInspect,
|
||||
} from '@/types/workflow'
|
||||
import { get, post } from './base'
|
||||
import { consoleClient } from './client'
|
||||
import { getFlowPrefix } from './utils'
|
||||
import { sanitizeWorkflowDraftPayload } from './workflow-payload'
|
||||
|
||||
export type { WorkflowDraftFeaturesPayload } from '@/contract/console/workflow'
|
||||
|
||||
export const fetchWorkflowDraft = (url: string) => {
|
||||
return get(url, {}, { silent: true }) as Promise<FetchWorkflowDraftResponse>
|
||||
}
|
||||
@ -107,3 +111,41 @@ export const fetchNodeInspectVars = async (flowType: FlowType, flowId: string, n
|
||||
const { items } = (await get(`${getFlowPrefix(flowType)}/${flowId}/workflows/draft/nodes/${nodeId}/variables`)) as { items: VarInInspect[] }
|
||||
return items
|
||||
}
|
||||
|
||||
// Environment Variables API
|
||||
export const fetchEnvironmentVariables = async (appId: string): Promise<EnvironmentVariable[]> => {
|
||||
const response = await consoleClient.workflowDraft.environmentVariables({
|
||||
params: { appId },
|
||||
})
|
||||
return response.items
|
||||
}
|
||||
|
||||
export const updateEnvironmentVariables = ({ appId, environmentVariables }: {
|
||||
appId: string
|
||||
environmentVariables: EnvironmentVariable[]
|
||||
}) => {
|
||||
return consoleClient.workflowDraft.updateEnvironmentVariables({
|
||||
params: { appId },
|
||||
body: { environment_variables: environmentVariables },
|
||||
})
|
||||
}
|
||||
|
||||
export const updateConversationVariables = ({ appId, conversationVariables }: {
|
||||
appId: string
|
||||
conversationVariables: ConversationVariable[]
|
||||
}) => {
|
||||
return consoleClient.workflowDraft.updateConversationVariables({
|
||||
params: { appId },
|
||||
body: { conversation_variables: conversationVariables },
|
||||
})
|
||||
}
|
||||
|
||||
export const updateFeatures = ({ appId, features }: {
|
||||
appId: string
|
||||
features: WorkflowDraftFeaturesPayload
|
||||
}) => {
|
||||
return consoleClient.workflowDraft.updateFeatures({
|
||||
params: { appId },
|
||||
body: { features },
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user