Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(api): keep Swagger docs through RBAC and web edition guards (#44000)

Stephen Zhou6c537c4a62ea
diff --git a/api/controllers/common/wraps.py b/api/controllers/common/wraps.py
index 688e36959a7..ae7315fb1b5 100644
--- a/api/controllers/common/wraps.py
+++ b/api/controllers/common/wraps.py
@@ -1,5 +1,5 @@
from collections.abc import Callable
-from functools import wraps
+from functools import WRAPPER_ASSIGNMENTS, wraps
from configs import dify_config
from controllers.common.rbac import RBAC_CHECKS_ATTR, RBACCheck, enforce_rbac_checks
@@ -13,7 +13,8 @@ def rbac_permission_required[**P, R](*checks: RBACCheck) -> Callable[[Callable[P
raise ValueError("rbac_permission_required requires at least one RBACCheck")
def decorator(view: Callable[P, R]) -> Callable[P, R]:
- @wraps(view, updated=())
+ # updated=() keeps rbac_checks on the layer that declares it; Swagger docs still pass through.
+ @wraps(view, assigned=(*WRAPPER_ASSIGNMENTS, "__apidoc__"), updated=())
def decorated(*args: P.args, **kwargs: P.kwargs) -> R:
if not dify_config.RBAC_ENABLED:
return view(*args, **kwargs)
diff --git a/api/controllers/web/flask_admission.py b/api/controllers/web/flask_admission.py
index e31b9c195fc..01211a9b34b 100644
--- a/api/controllers/web/flask_admission.py
+++ b/api/controllers/web/flask_admission.py
@@ -53,7 +53,7 @@ def web_anonymous_admission[T, **P, R](
if editions is None:
return admitted
- @wraps(view)
+ @wraps(admitted)
def enforce_edition(self: T, /, *args: P.args, **kwargs: P.kwargs) -> R | Response:
if dify_config.DEPLOYMENT_EDITION not in editions:
abort(404)
diff --git a/api/openapi/markdown/console-openapi.md b/api/openapi/markdown/console-openapi.md
index be1a3ffb051..2c9fd6c4604 100644
--- a/api/openapi/markdown/console-openapi.md
+++ b/api/openapi/markdown/console-openapi.md
@@ -2212,7 +2212,7 @@ Update annotation settings for an app
| Code | Description |
| ---- | ----------- |
-| 200 | Success |
+| 204 | Annotations deleted successfully |
### [GET] /apps/{app_id}/annotations
Get annotations for an app with pagination
@@ -2334,7 +2334,7 @@ Export all annotations for an app with CSV injection protection
| Code | Description |
| ---- | ----------- |
-| 200 | Success |
+| 204 | Annotation deleted successfully |
### [POST] /apps/{app_id}/annotations/{annotation_id}
Update or delete an annotation
@@ -3340,9 +3340,9 @@ Create a new tracing configuration for an application
#### Responses
-| Code | Description |
-| ---- | ----------- |
-| 200 | Success |
+| Code | Description | Schema |
+| ---- | ----------- | ------ |
+| 200 | Success | **application/json**: [WorkflowTriggerResponse](#workflowtriggerresponse)<br> |
### [GET] /apps/{app_id}/triggers
**Get app triggers list**
@@ -4729,7 +4729,7 @@ Full value for one declared output of a published run.
| Code | Description |
| ---- | ----------- |
-| 200 | Success |
+| 204 | Workflow deleted successfully |
### [PATCH] /apps/{app_id}/workflows/{workflow_id}
**Update workflow attributes**
@@ -4877,9 +4877,9 @@ Delete an API key for an app
#### Responses
-| Code | Description |
-| ---- | ----------- |
-| 200 | Success |
+| Code | Description | Schema |
+| ---- | ----------- | ------ |
+| 200 | Success | **application/json**: [SimpleResultResponse](#simpleresultresponse)<br> |
### [POST] /auth/plugin/datasource/{provider_id}/custom-client
#### Parameters
@@ -7785,11 +7785,17 @@ Update account-level Step-by-step Tour state
| ---- | ---------- | ----------- | -------- | ------ |
| pipeline_id | path | | Yes | string (uuid) |
+#### Request Body
+
+| Required | Schema |
+| -------- | ------ |
+| Yes | **application/json**: [DraftWorkflowSyncPayload](#draftworkflowsyncpayload)<br> |
+
#### Responses
-| Code | Description |
-| ---- | ----------- |
-| 200 | Success |
+| Code | Description | Schema |
+| ---- | ----------- | ------ |
+| 200 | Success | **application/json**: [RagPipelineWorkflowSyncResponse](#ragpipelineworkflowsyncresponse)<br> |
### [POST] /rag/pipelines/{pipeline_id}/workflows/draft/datasource/nodes/{node_id}/run
**Run rag pipeline datasource**
@@ -8089,6 +8095,12 @@ Update account-level Step-by-step Tour state
| pipeline_id | path | | Yes | string (uuid) |
| variable_id | path | | Yes | string (uuid) |
+#### Request Body
+
+| Required | Schema |
+| -------- | ------ |
+| Yes | **application/json**: [WorkflowDraftVariablePatchPayload](#workflowdraftvariablepatchpayload)<br> |
+
#### Responses
| Code | Description | Schema |
@@ -8263,6 +8275,12 @@ Update account-level Step-by-step Tour state
| pipeline_id | path | | Yes | string (uuid) |
| workflow_id | path | | Yes | string |
+#### Request Body
+
+| Required | Schema |
+| -------- | ------ |
+| Yes | **application/json**: [WorkflowUpdatePayload](#workflowupdatepayload)<br> |
+
#### Responses
| Code | Description | Schema |
diff --git a/api/tests/unit_tests/controllers/console/test_wraps.py b/api/tests/unit_tests/controllers/console/test_wraps.py
index 19d131268dd..b04f21e2518 100644
--- a/api/tests/unit_tests/controllers/console/test_wraps.py
+++ b/api/tests/unit_tests/controllers/console/test_wraps.py
@@ -12,7 +12,7 @@ from sqlalchemy import select
from sqlalchemy.orm import Session
from werkzeug.exceptions import HTTPException
-from controllers.common.rbac import DatasetId, PlainApp, RBACCheck, Workspace
+from controllers.common.rbac import RBAC_CHECKS_ATTR, DatasetId, PlainApp, RBACCheck, Workspace
from controllers.console import api as console_api
from controllers.console import flask_admission
from controllers.console import wraps as wraps_module
@@ -480,6 +480,19 @@ class TestCurrentContextInjection:
class TestRbacPermissionRequired:
"""Test enterprise RBAC decorator."""
+ def test_keeps_swagger_docs_but_not_rbac_checks_of_the_wrapped_view(self):
+ def view(**kwargs):
+ return "ok"
+
+ inner_checks = (RBACCheck(RBACPermission.APP_VIEW_LAYOUT, PlainApp()),)
+ view.__apidoc__ = {"responses": {"404": ("Missing", None, {})}} # type: ignore[attr-defined]
+ setattr(view, RBAC_CHECKS_ATTR, inner_checks)
+
+ guarded = rbac_permission_required(RBACCheck(RBACPermission.APP_DELETE, PlainApp()))(view)
+
+ assert guarded.__apidoc__ == view.__apidoc__ # type: ignore[attr-defined]
+ assert guarded.__dict__[RBAC_CHECKS_ATTR] != inner_checks
+
def test_resource_scoped_check_uses_resource_id(self):
current_user = make_account("account-1")
diff --git a/api/tests/unit_tests/controllers/web/test_flask_admission.py b/api/tests/unit_tests/controllers/web/test_flask_admission.py
new file mode 100644
index 00000000000..4e482921f31
--- /dev/null
+++ b/api/tests/unit_tests/controllers/web/test_flask_admission.py
@@ -0,0 +1,25 @@
+from types import FunctionType
+
+from controllers.web.flask_admission import web_anonymous_admission
+from enums import DeploymentEdition
+
+
+def _wrapper_chain(view: object) -> list[str]:
+ """The defining function of each layer; ``functools.wraps`` copies ``__qualname__`` but not the code."""
+ chain: list[str] = []
+ current: object = view
+ while isinstance(current, FunctionType):
+ chain.append(current.__code__.co_qualname)
+ current = current.__dict__.get("__wrapped__")
+ return chain
+
+
+def test_edition_gate_wraps_the_admitted_view_so_guard_metadata_survives() -> None:
+ def view(_self: object, _context: object) -> str:
+ return "ok"
+
+ admitted = web_anonymous_admission(editions=frozenset({DeploymentEdition.CLOUD}))(view)
+
+ # The edition gate must wrap the setup-guarded view, not the bare one, or the
+ # guard layers (and the Swagger docs they carry) drop out of the chain.
+ assert any(name.startswith("setup_required") for name in _wrapper_chain(admitted))
diff --git a/packages/contracts/generated/api/console/apps/orpc.gen.ts b/packages/contracts/generated/api/console/apps/orpc.gen.ts
index 2415c780024..a499bf16cf3 100644
--- a/packages/contracts/generated/api/console/apps/orpc.gen.ts
+++ b/packages/contracts/generated/api/console/apps/orpc.gen.ts
@@ -1352,6 +1352,7 @@ export const delete3 = oc
method: 'DELETE',
operationId: 'deleteAppsByAppIdAnnotationsByAnnotationId',
path: '/apps/{app_id}/annotations/{annotation_id}',
+ successStatus: 204,
tags: ['console'],
})
.input(z.object({ params: zDeleteAppsByAppIdAnnotationsByAnnotationIdPath }))
@@ -1389,6 +1390,7 @@ export const delete4 = oc
method: 'DELETE',
operationId: 'deleteAppsByAppIdAnnotations',
path: '/apps/{app_id}/annotations',
+ successStatus: 204,
tags: ['console'],
})
.input(z.object({ params: zDeleteAppsByAppIdAnnotationsPath }))
@@ -4288,6 +4290,7 @@ export const delete14 = oc
method: 'DELETE',
operationId: 'deleteAppsByAppIdWorkflowsByWorkflowId',
path: '/apps/{app_id}/workflows/{workflow_id}',
+ successStatus: 204,
summary: 'Delete workflow',
tags: ['console'],
})
diff --git a/packages/contracts/generated/api/console/apps/types.gen.ts b/packages/contracts/generated/api/console/apps/types.gen.ts
index 699e360be19..f880783a5d6 100644
--- a/packages/contracts/generated/api/console/apps/types.gen.ts
+++ b/packages/contracts/generated/api/console/apps/types.gen.ts
@@ -721,6 +721,18 @@ export type ParserEnable = {
trigger_id: string
}
+export type WorkflowTriggerResponse = {
+ created_at?: string | null
+ icon: string
+ id: string
+ node_id: string
+ provider_name: string
+ status: string
+ title: string
+ trigger_type: string
+ updated_at?: string | null
+}
+
export type WorkflowTriggerListResponse = {
data: Array<WorkflowTriggerResponse>
}
@@ -1856,18 +1868,6 @@ export type TextToSpeechVoiceResponse = {
value: string
}
-export type WorkflowTriggerResponse = {
- created_at?: string | null
- icon: string
- id: string
- node_id: string
- provider_name: string
- status: string
- title: string
- trigger_type: string
- updated_at?: string | null
-}
-
export type WorkflowAppLogPartialResponse = {
created_at?: number | null
created_by_account?: SimpleAccountResponse | null
@@ -4951,9 +4951,7 @@ export type DeleteAppsByAppIdAnnotationsData = {
}
export type DeleteAppsByAppIdAnnotationsResponses = {
- 200: {
- [key: string]: unknown
- }
+ 204: void
}
export type DeleteAppsByAppIdAnnotationsResponse =
@@ -5094,9 +5092,7 @@ export type DeleteAppsByAppIdAnnotationsByAnnotationIdData = {
}
export type DeleteAppsByAppIdAnnotationsByAnnotationIdResponses = {
- 200: {
- [key: string]: unknown
- }
+ 204: void
}
export type DeleteAppsByAppIdAnnotationsByAnnotationIdResponse =
@@ -6159,9 +6155,7 @@ export type PostAppsByAppIdTriggerEnableData = {
}
export type PostAppsByAppIdTriggerEnableResponses = {
- 200: {
- [key: string]: unknown
- }
+ 200: WorkflowTriggerResponse
}
export type PostAppsByAppIdTriggerEnableResponse =
@@ -7569,9 +7563,7 @@ export type DeleteAppsByAppIdWorkflowsByWorkflowIdData = {
}
export type DeleteAppsByAppIdWorkflowsByWorkflowIdResponses = {
- 200: {
- [key: string]: unknown
- }
+ 204: void
}
export type DeleteAppsByAppIdWorkflowsByWorkflowIdResponse =
diff --git a/packages/contracts/generated/api/console/apps/zod.gen.ts b/packages/contracts/generated/api/console/apps/zod.gen.ts
index d8ab6cd9316..c7229a4d2ad 100644
--- a/packages/contracts/generated/api/console/apps/zod.gen.ts
+++ b/packages/contracts/generated/api/console/apps/zod.gen.ts
@@ -451,6 +451,28 @@ export const zParserEnable = z.object({
trigger_id: z.string(),
})
+/**
+ * WorkflowTriggerResponse
+ */
+export const zWorkflowTriggerResponse = z.object({
+ created_at: z.iso.datetime().nullish(),
+ icon: z.string(),
+ id: z.string(),
+ node_id: z.string(),
+ provider_name: z.string(),
+ status: z.string(),
+ title: z.string(),
+ trigger_type: z.string(),
+ updated_at: z.iso.datetime().nullish(),
+})
+
+/**
+ * WorkflowTriggerListResponse
+ */
+export const zWorkflowTriggerListResponse = z.object({
+ data: z.array(zWorkflowTriggerResponse),
+})
+
/**
* WorkflowAgentSandboxDownloadPayload
*/
@@ -1312,28 +1334,6 @@ export const zTextToSpeechVoiceResponse = z.object({
*/
export const zTextToSpeechVoiceListResponse = z.array(zTextToSpeechVoiceResponse)
-/**
- * WorkflowTriggerResponse
- */
-export const zWorkflowTriggerResponse = z.object({
- created_at: z.iso.datetime().nullish(),
- icon: z.string(),
- id: z.string(),
- node_id: z.string(),
- provider_name: z.string(),
- status: z.string(),
- title: z.string(),
- trigger_type: z.string(),
- updated_at: z.iso.datetime().nullish(),
-})
-
-/**
- * WorkflowTriggerListResponse
- */
-export const zWorkflowTriggerListResponse = z.object({
- data: z.array(zWorkflowTriggerResponse),
-})
-
/**
* SimpleAccountResponse
*/
@@ -5905,9 +5905,9 @@ export const zDeleteAppsByAppIdAnnotationsPath = z.object({
})
/**
- * Success
+ * Annotations deleted successfully
*/
-export const zDeleteAppsByAppIdAnnotationsResponse = z.record(z.string(), z.unknown())
+export const zDeleteAppsByAppIdAnnotationsResponse = z.void()
export const zGetAppsByAppIdAnnotationsPath = z.object({
app_id: z.uuid(),
@@ -5979,9 +5979,9 @@ export const zDeleteAppsByAppIdAnnotationsByAnnotationIdPath = z.object({
})
/**
- * Success
+ * Annotation deleted successfully
*/
-export const zDeleteAppsByAppIdAnnotationsByAnnotationIdResponse = z.record(z.string(), z.unknown())
+export const zDeleteAppsByAppIdAnnotationsByAnnotationIdResponse = z.void()
export const zPostAppsByAppIdAnnotationsByAnnotationIdBody = zUpdateAnnotationPayload
@@ -6590,7 +6590,7 @@ export const zPostAppsByAppIdTriggerEnablePath = z.object({
/**
* Success
*/
-export const zPostAppsByAppIdTriggerEnableResponse = z.record(z.string(), z.unknown())
+export const zPostAppsByAppIdTriggerEnableResponse = zWorkflowTriggerResponse
export const zGetAppsByAppIdTriggersPath = z.object({
app_id: z.uuid(),
@@ -7488,9 +7488,9 @@ export const zDeleteAppsByAppIdWorkflowsByWorkflowIdPath = z.object({
})
/**
- * Success
+ * Workflow deleted successfully
*/
-export const zDeleteAppsByAppIdWorkflowsByWorkflowIdResponse = z.record(z.string(), z.unknown())
+export const zDeleteAppsByAppIdWorkflowsByWorkflowIdResponse = z.void()
export const zPatchAppsByAppIdWorkflowsByWorkflowIdBody = zWorkflowUpdatePayload
diff --git a/packages/contracts/generated/api/console/auth/types.gen.ts b/packages/contracts/generated/api/console/auth/types.gen.ts
index 3f83a36fb2a..7b9404d5bfb 100644
--- a/packages/contracts/generated/api/console/auth/types.gen.ts
+++ b/packages/contracts/generated/api/console/auth/types.gen.ts
@@ -205,9 +205,7 @@ export type DeleteAuthPluginDatasourceByProviderIdCustomClientData = {
}
export type DeleteAuthPluginDatasourceByProviderIdCustomClientResponses = {
- 200: {
- [key: string]: unknown
- }
+ 200: SimpleResultResponse
}
export type DeleteAuthPluginDatasourceByProviderIdCustomClientResponse =
diff --git a/packages/contracts/generated/api/console/auth/zod.gen.ts b/packages/contracts/generated/api/console/auth/zod.gen.ts
index cedba982045..b52a8f4f63a 100644
--- a/packages/contracts/generated/api/console/auth/zod.gen.ts
+++ b/packages/contracts/generated/api/console/auth/zod.gen.ts
@@ -223,10 +223,7 @@ export const zDeleteAuthPluginDatasourceByProviderIdCustomClientPath = z.object(
/**
* Success
*/
-export const zDeleteAuthPluginDatasourceByProviderIdCustomClientResponse = z.record(
- z.string(),
- z.unknown(),
-)
+export const zDeleteAuthPluginDatasourceByProviderIdCustomClientResponse = zSimpleResultResponse
export const zPostAuthPluginDatasourceByProviderIdCustomClientBody = zDatasourceCustomClientPayload
diff --git a/packages/contracts/generated/api/console/rag/orpc.gen.ts b/packages/contracts/generated/api/console/rag/orpc.gen.ts
index d2a27ca561d..3f100ea1d64 100644
--- a/packages/contracts/generated/api/console/rag/orpc.gen.ts
+++ b/packages/contracts/generated/api/console/rag/orpc.gen.ts
@@ -73,8 +73,10 @@ import {
zPatchRagPipelineCustomizedTemplatesByTemplateIdBody,
zPatchRagPipelineCustomizedTemplatesByTemplateIdPath,
zPatchRagPipelineCustomizedTemplatesByTemplateIdResponse,
+ zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdBody,
zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdPath,
zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdResponse,
+ zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdBody,
zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdPath,
zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdResponse,
zPostRagPipelineCustomizedTemplatesByTemplateIdPath,
@@ -89,6 +91,7 @@ import {
zPostRagPipelinesByPipelineIdWorkflowRunsTasksByTaskIdStopResponse,
zPostRagPipelinesByPipelineIdWorkflowsByWorkflowIdRestorePath,
zPostRagPipelinesByPipelineIdWorkflowsByWorkflowIdRestoreResponse,
+ zPostRagPipelinesByPipelineIdWorkflowsDraftBody,
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunBody,
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunPath,
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunResponse,
@@ -924,7 +927,10 @@ export const patch2 = oc
tags: ['console'],
})
.input(
- z.object({ params: zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdPath }),
+ z.object({
+ body: zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdBody,
+ params: zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdPath,
+ }),
)
.output(zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdResponse)
@@ -1000,7 +1006,12 @@ export const post15 = oc
summary: 'Sync draft workflow',
tags: ['console'],
})
- .input(z.object({ params: zPostRagPipelinesByPipelineIdWorkflowsDraftPath }))
+ .input(
+ z.object({
+ body: zPostRagPipelinesByPipelineIdWorkflowsDraftBody,
+ params: zPostRagPipelinesByPipelineIdWorkflowsDraftPath,
+ }),
+ )
.output(zPostRagPipelinesByPipelineIdWorkflowsDraftResponse)
export const draft = {
@@ -1244,7 +1255,12 @@ export const patch3 = oc
summary: 'Update workflow attributes',
tags: ['console'],
})
- .input(z.object({ params: zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdPath }))
+ .input(
+ z.object({
+ body: zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdBody,
+ params: zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdPath,
+ }),
+ )
.output(zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdResponse)
export const byWorkflowId = {
diff --git a/packages/contracts/generated/api/console/rag/types.gen.ts b/packages/contracts/generated/api/console/rag/types.gen.ts
index 70953beb772..ab067db23cd 100644
--- a/packages/contracts/generated/api/console/rag/types.gen.ts
+++ b/packages/contracts/generated/api/console/rag/types.gen.ts
@@ -180,6 +180,31 @@ export type WorkflowResponse = {
version_number?: number | null
}
+export type DraftWorkflowSyncPayload = {
+ conversation_variables?: Array<{
+ [key: string]: unknown
+ }> | null
+ environment_variables?: Array<{
+ [key: string]: unknown
+ }> | null
+ features?: {
+ [key: string]: unknown
+ } | null
+ graph: {
+ [key: string]: unknown
+ }
+ hash?: string | null
+ rag_pipeline_variables?: Array<{
+ [key: string]: unknown
+ }> | null
+}
+
+export type RagPipelineWorkflowSyncResponse = {
+ hash: string
+ result: string
+ updated_at: number
+}
+
export type DatasourceNodeRunPayload = {
credential_id?: string | null
datasource_type: string
@@ -277,6 +302,11 @@ export type WorkflowDraftVariableResponse = {
visible: boolean
}
+export type WorkflowDraftVariablePatchPayload = {
+ name?: string | null
+ value?: unknown | null
+}
+
export type RagPipelineWorkflowPublishResponse = {
created_at: number
result: string
@@ -304,10 +334,9 @@ export type PublishedWorkflowRunPayload = {
start_node_id: string
}
-export type RagPipelineWorkflowSyncResponse = {
- hash: string
- result: string
- updated_at: number
+export type WorkflowUpdatePayload = {
+ marked_comment?: string | null
+ marked_name?: string | null
}
export type ImportStatus = 'completed' | 'completed-with-warnings' | 'failed' | 'pending'
@@ -1122,7 +1151,7 @@ export type GetRagPipelinesByPipelineIdWorkflowsDraftResponse =
GetRagPipelinesByPipelineIdWorkflowsDraftResponses[keyof GetRagPipelinesByPipelineIdWorkflowsDraftResponses]
export type PostRagPipelinesByPipelineIdWorkflowsDraftData = {
- body?: never
+ body: DraftWorkflowSyncPayload
path: {
pipeline_id: string
}
@@ -1131,9 +1160,7 @@ export type PostRagPipelinesByPipelineIdWorkflowsDraftData = {
}
export type PostRagPipelinesByPipelineIdWorkflowsDraftResponses = {
- 200: {
- [key: string]: unknown
- }
+ 200: RagPipelineWorkflowSyncResponse
}
export type PostRagPipelinesByPipelineIdWorkflowsDraftResponse =
@@ -1428,7 +1455,7 @@ export type GetRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdRespon
GetRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdResponses[keyof GetRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdResponses]
export type PatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdData = {
- body?: never
+ body: WorkflowDraftVariablePatchPayload
path: {
pipeline_id: string
variable_id: string
@@ -1601,7 +1628,7 @@ export type DeleteRagPipelinesByPipelineIdWorkflowsByWorkflowIdResponse =
DeleteRagPipelinesByPipelineIdWorkflowsByWorkflowIdResponses[keyof DeleteRagPipelinesByPipelineIdWorkflowsByWorkflowIdResponses]
export type PatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdData = {
- body?: never
+ body: WorkflowUpdatePayload
path: {
pipeline_id: string
workflow_id: string
diff --git a/packages/contracts/generated/api/console/rag/zod.gen.ts b/packages/contracts/generated/api/console/rag/zod.gen.ts
index a5afe6f4948..5e69ab42976 100644
--- a/packages/contracts/generated/api/console/rag/zod.gen.ts
+++ b/packages/contracts/generated/api/console/rag/zod.gen.ts
@@ -76,6 +76,27 @@ export const zDefaultBlockConfigsResponse = z.array(z.record(z.string(), z.unkno
*/
export const zDefaultBlockConfigResponse = z.record(z.string(), z.unknown())
+/**
+ * DraftWorkflowSyncPayload
+ */
+export const zDraftWorkflowSyncPayload = z.object({
+ conversation_variables: z.array(z.record(z.string(), z.unknown())).nullish(),
+ environment_variables: z.array(z.record(z.string(), z.unknown())).nullish(),
+ features: z.record(z.string(), z.unknown()).nullish(),
+ graph: z.record(z.string(), z.unknown()),
+ hash: z.string().nullish(),
+ rag_pipeline_variables: z.array(z.record(z.string(), z.unknown())).nullish(),
+})
+
+/**
+ * RagPipelineWorkflowSyncResponse
+ */
+export const zRagPipelineWorkflowSyncResponse = z.object({
+ hash: z.string(),
+ result: z.string(),
+ updated_at: z.int(),
+})
+
/**
* DatasourceNodeRunPayload
*/
@@ -126,6 +147,14 @@ export const zDraftWorkflowRunPayload = z.object({
start_node_id: z.string(),
})
+/**
+ * WorkflowDraftVariablePatchPayload
+ */
+export const zWorkflowDraftVariablePatchPayload = z.object({
+ name: z.string().nullish(),
+ value: z.unknown().nullish(),
+})
+
/**
* RagPipelineWorkflowPublishResponse
*/
@@ -157,12 +186,11 @@ export const zPublishedWorkflowRunPayload = z.object({
})
/**
- * RagPipelineWorkflowSyncResponse
+ * WorkflowUpdatePayload
*/
-export const zRagPipelineWorkflowSyncResponse = z.object({
- hash: z.string(),
- result: z.string(),
- updated_at: z.int(),
+export const zWorkflowUpdatePayload = z.object({
+ marked_comment: z.string().max(100).nullish(),
+ marked_name: z.string().max(20).nullish(),
})
/**
@@ -1169,6 +1197,8 @@ export const zGetRagPipelinesByPipelineIdWorkflowsDraftPath = z.object({
*/
export const zGetRagPipelinesByPipelineIdWorkflowsDraftResponse = zWorkflowResponse
+export const zPostRagPipelinesByPipelineIdWorkflowsDraftBody = zDraftWorkflowSyncPayload
+
export const zPostRagPipelinesByPipelineIdWorkflowsDraftPath = z.object({
pipeline_id: z.uuid(),
})
@@ -1176,7 +1206,7 @@ export const zPostRagPipelinesByPipelineIdWorkflowsDraftPath = z.object({
/**
* Success
*/
-export const zPostRagPipelinesByPipelineIdWorkflowsDraftResponse = z.record(z.string(), z.unknown())
+export const zPostRagPipelinesByPipelineIdWorkflowsDraftResponse = zRagPipelineWorkflowSyncResponse
export const zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunBody =
zDatasourceNodeRunPayload
@@ -1382,6 +1412,9 @@ export const zGetRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdPath
export const zGetRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdResponse =
zWorkflowDraftVariableResponse
+export const zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdBody =
+ zWorkflowDraftVariablePatchPayload
+
export const zPatchRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdPath = z.object({
pipeline_id: z.uuid(),
variable_id: z.uuid(),
@@ -1500,6 +1533,8 @@ export const zDeleteRagPipelinesByPipelineIdWorkflowsByWorkflowIdPath = z.object
*/
export const zDeleteRagPipelinesByPipelineIdWorkflowsByWorkflowIdResponse = z.void()
+export const zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdBody = zWorkflowUpdatePayload
+
export const zPatchRagPipelinesByPipelineIdWorkflowsByWorkflowIdPath = z.object({
pipeline_id: z.uuid(),
workflow_id: z.string(),