refactor(web): migrate console contracts to generated routes (#38233)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Stephen Zhou 2026-07-01 13:41:37 +08:00 committed by GitHub
parent 0923ebaf88
commit 93981cf75f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
52 changed files with 2134 additions and 679 deletions

View File

@ -6,7 +6,7 @@ from typing import Any, NotRequired, TypedDict, cast
from flask import abort, request
from flask_restx import Resource, fields
from pydantic import AliasChoices, BaseModel, Field, RootModel, ValidationError, field_validator
from pydantic import AliasChoices, BaseModel, ConfigDict, Field, RootModel, ValidationError, field_validator
from sqlalchemy.orm import Session, sessionmaker
from werkzeug.exceptions import BadRequest, Forbidden, InternalServerError, NotFound
@ -159,8 +159,71 @@ class ConvertToWorkflowPayload(BaseModel):
icon_background: str | None = None
class WorkflowFeatureTogglePayload(BaseModel):
model_config = ConfigDict(extra="allow")
enabled: bool | None = None
class WorkflowSuggestedQuestionsAfterAnswerPayload(WorkflowFeatureTogglePayload):
model: dict[str, Any] | None = None
prompt: str | None = None
class WorkflowTextToSpeechPayload(WorkflowFeatureTogglePayload):
language: str | None = None
voice: str | None = None
autoPlay: str | None = None
class WorkflowSensitiveWordAvoidancePayload(WorkflowFeatureTogglePayload):
type: str | None = None
config: dict[str, Any] | None = None
class WorkflowFileUploadTransferPayload(WorkflowFeatureTogglePayload):
number_limits: int | None = None
transfer_methods: list[str] | None = None
class WorkflowFileUploadImagePayload(WorkflowFileUploadTransferPayload):
detail: str | None = None
class WorkflowFileUploadPreviewConfigPayload(BaseModel):
mode: str | None = None
file_type_list: list[str] | None = None
class WorkflowFileUploadPayload(WorkflowFeatureTogglePayload):
allowed_file_types: list[str] | None = None
allowed_file_extensions: list[str] | None = None
allowed_file_upload_methods: list[str] | None = None
number_limits: int | None = None
image: WorkflowFileUploadImagePayload | None = None
document: WorkflowFileUploadTransferPayload | None = None
audio: WorkflowFileUploadTransferPayload | None = None
video: WorkflowFileUploadTransferPayload | None = None
custom: WorkflowFileUploadTransferPayload | None = None
preview_config: WorkflowFileUploadPreviewConfigPayload | None = None
fileUploadConfig: dict[str, Any] | None = None
class WorkflowFeaturesConfigPayload(BaseModel):
model_config = ConfigDict(extra="allow")
opening_statement: str | None = None
suggested_questions: list[str] | None = None
suggested_questions_after_answer: WorkflowSuggestedQuestionsAfterAnswerPayload | None = None
text_to_speech: WorkflowTextToSpeechPayload | None = None
speech_to_text: WorkflowFeatureTogglePayload | None = None
retriever_resource: WorkflowFeatureTogglePayload | None = None
sensitive_word_avoidance: WorkflowSensitiveWordAvoidancePayload | None = None
file_upload: WorkflowFileUploadPayload | None = None
class WorkflowFeaturesPayload(BaseModel):
features: dict[str, Any] = Field(
features: WorkflowFeaturesConfigPayload = Field(
...,
description="Workflow feature configuration",
)
@ -344,6 +407,15 @@ register_schema_models(
ConvertToWorkflowPayload,
WorkflowListQuery,
WorkflowUpdatePayload,
WorkflowFeatureTogglePayload,
WorkflowSuggestedQuestionsAfterAnswerPayload,
WorkflowTextToSpeechPayload,
WorkflowSensitiveWordAvoidancePayload,
WorkflowFileUploadTransferPayload,
WorkflowFileUploadImagePayload,
WorkflowFileUploadPreviewConfigPayload,
WorkflowFileUploadPayload,
WorkflowFeaturesConfigPayload,
WorkflowFeaturesPayload,
WorkflowOnlineUsersPayload,
DraftWorkflowTriggerRunPayload,
@ -1275,7 +1347,7 @@ class WorkflowFeaturesApi(Resource):
def post(self, current_user: Account, app_model: App):
args = WorkflowFeaturesPayload.model_validate(console_ns.payload or {})
features = args.features
features = args.features.model_dump(mode="json", exclude_unset=True)
workflow_service = WorkflowService()
workflow_service.update_draft_workflow_features(app_model=app_model, features=features, account=current_user)

View File

@ -189,14 +189,14 @@ class WorkflowCommentReplyUpdate(ResponseModel):
register_schema_models(
console_ns,
AccountWithRole,
WorkflowCommentMentionUsersPayload,
WorkflowCommentCreatePayload,
WorkflowCommentUpdatePayload,
WorkflowCommentReplyPayload,
)
register_response_schema_models(
console_ns,
AccountWithRole,
WorkflowCommentMentionUsersPayload,
WorkflowCommentAccount,
WorkflowCommentReply,
WorkflowCommentMention,

View File

@ -6,7 +6,7 @@ from uuid import UUID
from flask import Response, request
from flask_restx import Resource, fields, marshal, marshal_with
from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field
from sqlalchemy.orm import sessionmaker
from controllers.common.errors import InvalidArgumentError, NotFoundError
@ -79,15 +79,33 @@ class WorkflowDraftVariableUpdatePayload(BaseModel):
value: Any | None = Field(default=None, description="Variable value")
class WorkflowVariableItemPayload(BaseModel):
model_config = ConfigDict(extra="allow")
id: str | None = None
name: str | None = None
value_type: str | None = None
value: Any | None = None
description: str | None = None
class ConversationVariableItemPayload(WorkflowVariableItemPayload):
pass
class EnvironmentVariableItemPayload(WorkflowVariableItemPayload):
pass
class ConversationVariableUpdatePayload(BaseModel):
conversation_variables: list[dict[str, Any]] = Field(
conversation_variables: list[ConversationVariableItemPayload] = Field(
...,
description="Conversation variables for the draft workflow",
)
class EnvironmentVariableUpdatePayload(BaseModel):
environment_variables: list[dict[str, Any]] = Field(
environment_variables: list[EnvironmentVariableItemPayload] = Field(
...,
description="Environment variables for the draft workflow",
)
@ -114,7 +132,9 @@ register_schema_models(
console_ns,
WorkflowDraftVariableListQuery,
WorkflowDraftVariableUpdatePayload,
ConversationVariableItemPayload,
ConversationVariableUpdatePayload,
EnvironmentVariableItemPayload,
EnvironmentVariableUpdatePayload,
)
register_response_schema_models(console_ns, SimpleResultResponse, EnvironmentVariableListResponse)
@ -615,7 +635,9 @@ class ConversationVariableCollectionApi(Resource):
workflow_service = WorkflowService()
conversation_variables_list = payload.conversation_variables
conversation_variables_list = [
variable.model_dump(mode="json", exclude_unset=True) for variable in payload.conversation_variables
]
conversation_variables = [
variable_factory.build_conversation_variable_from_mapping(obj) for obj in conversation_variables_list
]
@ -707,7 +729,9 @@ class EnvironmentVariableCollectionApi(Resource):
workflow_service = WorkflowService()
environment_variables_list = payload.environment_variables
environment_variables_list = [
variable.model_dump(mode="json", exclude_unset=True) for variable in payload.environment_variables
]
environment_variables = [
variable_factory.build_environment_variable_from_mapping(obj) for obj in environment_variables_list
]

View File

@ -17,6 +17,7 @@ from controllers.console.wraps import (
)
from enums.cloud_plan import CloudPlan
from extensions.ext_database import db
from fields.base import ResponseModel
from libs.login import login_required
from models import Account
from services.billing_service import BillingService
@ -35,8 +36,12 @@ class BillingResponse(RootModel[dict[str, Any]]):
root: dict[str, Any]
class BillingInvoiceResponse(ResponseModel):
url: str
register_schema_models(console_ns, SubscriptionQuery, PartnerTenantsPayload)
register_response_schema_models(console_ns, BillingResponse)
register_response_schema_models(console_ns, BillingResponse, BillingInvoiceResponse)
@console_ns.route("/billing/subscription")
@ -57,7 +62,7 @@ class Subscription(Resource):
@console_ns.route("/billing/invoices")
class Invoices(Resource):
@console_ns.response(200, "Success", console_ns.models[BillingResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[BillingInvoiceResponse.__name__])
@setup_required
@login_required
@account_initialization_required

View File

@ -3,7 +3,7 @@ from uuid import UUID
from flask import request
from flask_restx import Resource
from pydantic import BaseModel, Field, RootModel, computed_field, field_validator
from pydantic import BaseModel, Field, computed_field, field_validator
from constants.languages import languages
from controllers.common.schema import query_params_from_model, register_response_schema_models, register_schema_models
@ -70,8 +70,14 @@ class LearnDifyAppListResponse(ResponseModel):
recommended_apps: list[RecommendedAppResponse]
class RecommendedAppDetailResponse(RootModel[dict[str, Any]]):
root: dict[str, Any]
class RecommendedAppDetailResponse(ResponseModel):
id: str
name: str
icon: str | None = None
icon_background: str | None = None
mode: str
export_data: str
can_trial: bool | None = None
register_schema_models(

View File

@ -38,6 +38,22 @@ register_response_schema_models(console_ns, AllowedExtensionsResponse, TextConte
PREVIEW_WORDS_LIMIT = 3000
_FILE_UPLOAD_PARAMS = {
"file": {
"description": "File to upload",
"in": "formData",
"type": "file",
"required": True,
},
"source": {
"description": "Optional upload source",
"in": "formData",
"type": "string",
"enum": ["datasets"],
"required": False,
},
}
@console_ns.route("/files/upload")
class FileApi(Resource):
@ -64,6 +80,7 @@ class FileApi(Resource):
@login_required
@account_initialization_required
@cloud_edition_billing_resource_check("documents")
@console_ns.doc(consumes=["multipart/form-data"], params=_FILE_UPLOAD_PARAMS)
@console_ns.response(201, "File uploaded successfully", console_ns.models[FileResponse.__name__])
@with_current_user
def post(self, current_user: Account):

View File

@ -84,8 +84,6 @@ class MemberActionTenantResponse(ResponseModel):
register_enum_models(console_ns, TenantAccountRole)
register_schema_models(
console_ns,
AccountWithRole,
AccountWithRoleList,
MemberInvitePayload,
MemberRoleUpdatePayload,
OwnerTransferEmailPayload,
@ -94,6 +92,8 @@ register_schema_models(
)
register_response_schema_models(
console_ns,
AccountWithRole,
AccountWithRoleList,
SimpleResultDataResponse,
SimpleResultResponse,
VerificationTokenResponse,

View File

@ -302,11 +302,28 @@ class PluginListResponse(ResponseModel):
class PluginVersionsResponse(ResponseModel):
versions: Any
versions: Mapping[str, PluginService.LatestPluginCache | None]
class PluginInstallationItemResponse(ResponseModel):
id: str
created_at: datetime
updated_at: datetime
tenant_id: str
endpoints_setups: int
endpoints_active: int
runtime_type: str
source: PluginInstallationSource
meta: Mapping[str, Any]
plugin_id: str
plugin_unique_identifier: str
version: str
checksum: str
declaration: Mapping[str, Any]
class PluginInstallationsResponse(ResponseModel):
plugins: Any
plugins: list[PluginInstallationItemResponse]
class PluginManifestResponse(ResponseModel):

View File

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Any
from typing import Any, Literal
from flask import request
from flask_restx import Resource
@ -9,7 +9,7 @@ from sqlalchemy import select
from werkzeug.exceptions import NotFound
from configs import dify_config
from controllers.common.schema import register_response_schema_models
from controllers.common.schema import query_params_from_model, register_response_schema_models, register_schema_models
from controllers.console import console_ns
from controllers.console.wraps import RBACPermission, RBACResourceScope, rbac_permission_required
from core.db.session_factory import session_factory
@ -538,6 +538,20 @@ class _DeleteMemberBindingsRequest(BaseModel):
return value
class _AccessControlLanguageQuery(BaseModel):
language: Literal["en", "ja", "zh"] | None = Field(default=None, description="Localized policy label language")
register_schema_models(
console_ns,
_ResourceAccessScopeRequest,
_ReplaceBindingsRequest,
_DeleteMemberBindingsRequest,
_AccessControlLanguageQuery,
svc.ReplaceUserAccessPolicies,
)
@console_ns.route("/workspaces/current/rbac/my-permissions")
class RBACMyPermissionsApi(Resource):
@login_required
@ -557,6 +571,7 @@ class RBACMyPermissionsApi(Resource):
@console_ns.route("/workspaces/current/rbac/apps/<uuid:app_id>/access-policy")
class RBACAppMatrixApi(Resource):
@login_required
@console_ns.doc(params=query_params_from_model(_AccessControlLanguageQuery))
@console_ns.response(200, "Success", console_ns.models[svc.AppAccessMatrix.__name__])
def get(self, app_id):
tenant_id, account_id = _current_ids()
@ -574,6 +589,7 @@ class RBACAppWhitelistApi(Resource):
return _dump(svc.RBACService.AppAccess.whitelist(tenant_id, account_id, str(app_id)))
@login_required
@console_ns.expect(console_ns.models[_ResourceAccessScopeRequest.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.ResourceWhitelist.__name__])
def put(self, app_id):
tenant_id, account_id = _current_ids()
@ -591,6 +607,7 @@ class RBACAppWhitelistApi(Resource):
@console_ns.route("/workspaces/current/rbac/apps/<uuid:app_id>/user-access-policies")
class RBACAppUserAccessPoliciesApi(Resource):
@login_required
@console_ns.doc(params=query_params_from_model(_AccessControlLanguageQuery))
@console_ns.response(200, "Success", console_ns.models[svc.ResourceUserAccessPoliciesResponse.__name__])
def get(self, app_id):
tenant_id, account_id = _current_ids()
@ -602,6 +619,7 @@ class RBACAppUserAccessPoliciesApi(Resource):
@console_ns.route("/workspaces/current/rbac/apps/<uuid:app_id>/users/<uuid:target_account_id>/access-policies")
class RBACAppUserAccessPolicyAssignmentApi(Resource):
@login_required
@console_ns.expect(console_ns.models[svc.ReplaceUserAccessPolicies.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.ReplaceUserAccessPoliciesResponse.__name__])
def put(self, app_id, target_account_id):
tenant_id, account_id = _current_ids()
@ -635,6 +653,7 @@ class RBACAppMemberBindingsApi(Resource):
return _dump(svc.RBACService.AppAccess.list_member_bindings(tenant_id, account_id, str(app_id), str(policy_id)))
@login_required
@console_ns.expect(console_ns.models[_DeleteMemberBindingsRequest.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.MemberBindingsResponse.__name__])
def delete(self, app_id, policy_id):
tenant_id, account_id = _current_ids()
@ -657,6 +676,7 @@ class RBACAppMemberBindingsApi(Resource):
@console_ns.route("/workspaces/current/rbac/datasets/<uuid:dataset_id>/access-policy")
class RBACDatasetMatrixApi(Resource):
@login_required
@console_ns.doc(params=query_params_from_model(_AccessControlLanguageQuery))
@console_ns.response(200, "Success", console_ns.models[svc.DatasetAccessMatrix.__name__])
def get(self, dataset_id):
tenant_id, account_id = _current_ids()
@ -674,6 +694,7 @@ class RBACDatasetWhitelistApi(Resource):
return _dump(svc.RBACService.DatasetAccess.whitelist(tenant_id, account_id, str(dataset_id)))
@login_required
@console_ns.expect(console_ns.models[_ResourceAccessScopeRequest.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.ResourceWhitelist.__name__])
def put(self, dataset_id):
tenant_id, account_id = _current_ids()
@ -691,6 +712,7 @@ class RBACDatasetWhitelistApi(Resource):
@console_ns.route("/workspaces/current/rbac/datasets/<uuid:dataset_id>/user-access-policies")
class RBACDatasetUserAccessPoliciesApi(Resource):
@login_required
@console_ns.doc(params=query_params_from_model(_AccessControlLanguageQuery))
@console_ns.response(200, "Success", console_ns.models[svc.ResourceUserAccessPoliciesResponse.__name__])
def get(self, dataset_id):
tenant_id, account_id = _current_ids()
@ -702,6 +724,7 @@ class RBACDatasetUserAccessPoliciesApi(Resource):
@console_ns.route("/workspaces/current/rbac/datasets/<uuid:dataset_id>/users/<uuid:target_account_id>/access-policies")
class RBACDatasetUserAccessPolicyAssignmentApi(Resource):
@login_required
@console_ns.expect(console_ns.models[svc.ReplaceUserAccessPolicies.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.ReplaceUserAccessPoliciesResponse.__name__])
def put(self, dataset_id, target_account_id):
tenant_id, account_id = _current_ids()
@ -741,6 +764,7 @@ class RBACDatasetMemberBindingsApi(Resource):
)
@login_required
@console_ns.expect(console_ns.models[_DeleteMemberBindingsRequest.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.MemberBindingsResponse.__name__])
def delete(self, dataset_id, policy_id):
tenant_id, account_id = _current_ids()
@ -779,6 +803,7 @@ class RBACWorkspaceAppRoleBindingsApi(Resource):
@console_ns.route("/workspaces/current/rbac/workspace/apps/access-policies/<uuid:policy_id>/bindings")
class RBACWorkspaceAppBindingsApi(Resource):
@login_required
@console_ns.expect(console_ns.models[_ReplaceBindingsRequest.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.AccessMatrixItem.__name__])
def put(self, policy_id):
tenant_id, account_id = _current_ids()
@ -826,6 +851,7 @@ class RBACWorkspaceDatasetRoleBindingsApi(Resource):
@console_ns.route("/workspaces/current/rbac/workspace/datasets/access-policies/<uuid:policy_id>/bindings")
class RBACWorkspaceDatasetBindingsApi(Resource):
@login_required
@console_ns.expect(console_ns.models[_ReplaceBindingsRequest.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.AccessMatrixItem.__name__])
def put(self, policy_id):
tenant_id, account_id = _current_ids()
@ -867,6 +893,9 @@ class _ReplaceMemberRolesRequest(BaseModel):
return value
register_schema_models(console_ns, _ReplaceMemberRolesRequest)
@console_ns.route("/workspaces/current/rbac/members/<uuid:member_id>/rbac-roles")
class RBACMemberRolesApi(Resource):
@login_required
@ -876,6 +905,7 @@ class RBACMemberRolesApi(Resource):
return _dump(svc.RBACService.MemberRoles.get(tenant_id, account_id, str(member_id)))
@login_required
@console_ns.expect(console_ns.models[_ReplaceMemberRolesRequest.__name__])
@console_ns.response(200, "Success", console_ns.models[svc.MemberRolesResponse.__name__])
def put(self, member_id):
tenant_id, account_id = _current_ids()

View File

@ -13,9 +13,15 @@ from controllers.common.fields import BinaryFileResponse, RedirectResponse, Simp
from controllers.common.schema import register_response_schema_models, register_schema_models
from core.plugin.entities.plugin_daemon import CredentialType
from core.plugin.impl.oauth import OAuthHandler
from core.trigger.entities.entities import SubscriptionBuilderUpdater
from core.trigger.entities.api_entities import (
SubscriptionBuilderApiEntity,
TriggerProviderApiEntity,
TriggerProviderSubscriptionApiEntity,
)
from core.trigger.entities.entities import RequestLog, SubscriptionBuilderUpdater
from core.trigger.trigger_manager import TriggerManager
from extensions.ext_database import db
from fields.base import ResponseModel
from graphon.model_runtime.utils.encoders import jsonable_encoder
from libs.login import login_required
from models.account import Account
@ -70,7 +76,7 @@ class TriggerOAuthClientPayload(BaseModel):
class TriggerOAuthAuthorizeResponse(BaseModel):
authorization_url: str
subscription_builder_id: str
subscription_builder: Any
subscription_builder: SubscriptionBuilderApiEntity
class TriggerOAuthClientResponse(BaseModel):
@ -87,6 +93,26 @@ class TriggerProviderOpaqueResponse(RootModel[Any]):
root: Any
class TriggerProviderListResponse(RootModel[list[TriggerProviderApiEntity]]):
root: list[TriggerProviderApiEntity]
class TriggerSubscriptionListResponse(RootModel[list[TriggerProviderSubscriptionApiEntity]]):
root: list[TriggerProviderSubscriptionApiEntity]
class TriggerSubscriptionBuilderCreateResponse(ResponseModel):
subscription_builder: SubscriptionBuilderApiEntity
class TriggerSubscriptionBuilderVerifyResponse(ResponseModel):
verified: bool
class TriggerSubscriptionBuilderLogsResponse(ResponseModel):
logs: list[RequestLog]
register_schema_models(
console_ns,
TriggerSubscriptionBuilderCreatePayload,
@ -102,6 +128,15 @@ register_response_schema_models(
TriggerOAuthAuthorizeResponse,
TriggerOAuthClientResponse,
TriggerProviderOpaqueResponse,
TriggerProviderApiEntity,
TriggerProviderListResponse,
TriggerProviderSubscriptionApiEntity,
TriggerSubscriptionListResponse,
SubscriptionBuilderApiEntity,
TriggerSubscriptionBuilderCreateResponse,
TriggerSubscriptionBuilderVerifyResponse,
RequestLog,
TriggerSubscriptionBuilderLogsResponse,
)
@ -118,7 +153,7 @@ class TriggerProviderIconApi(Resource):
@console_ns.route("/workspaces/current/triggers")
class TriggerProviderListApi(Resource):
@console_ns.response(200, "Success", console_ns.models[TriggerProviderOpaqueResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerProviderListResponse.__name__])
@setup_required
@login_required
@account_initialization_required
@ -130,7 +165,7 @@ class TriggerProviderListApi(Resource):
@console_ns.route("/workspaces/current/trigger-provider/<path:provider>/info")
class TriggerProviderInfoApi(Resource):
@console_ns.response(200, "Success", console_ns.models[TriggerProviderOpaqueResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerProviderApiEntity.__name__])
@setup_required
@login_required
@account_initialization_required
@ -142,7 +177,7 @@ class TriggerProviderInfoApi(Resource):
@console_ns.route("/workspaces/current/trigger-provider/<path:provider>/subscriptions/list")
class TriggerSubscriptionListApi(Resource):
@console_ns.response(200, "Success", console_ns.models[TriggerProviderOpaqueResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerSubscriptionListResponse.__name__])
@setup_required
@login_required
@edit_permission_required
@ -172,7 +207,7 @@ class TriggerSubscriptionListApi(Resource):
)
class TriggerSubscriptionBuilderCreateApi(Resource):
@console_ns.expect(console_ns.models[TriggerSubscriptionBuilderCreatePayload.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerProviderOpaqueResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerSubscriptionBuilderCreateResponse.__name__])
@setup_required
@login_required
@edit_permission_required
@ -202,7 +237,7 @@ class TriggerSubscriptionBuilderCreateApi(Resource):
"/workspaces/current/trigger-provider/<path:provider>/subscriptions/builder/<path:subscription_builder_id>",
)
class TriggerSubscriptionBuilderGetApi(Resource):
@console_ns.response(200, "Success", console_ns.models[TriggerProviderOpaqueResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[SubscriptionBuilderApiEntity.__name__])
@setup_required
@login_required
@edit_permission_required
@ -220,7 +255,7 @@ class TriggerSubscriptionBuilderGetApi(Resource):
)
class TriggerSubscriptionBuilderVerifyApi(Resource):
@console_ns.expect(console_ns.models[TriggerSubscriptionBuilderVerifyPayload.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerProviderOpaqueResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerSubscriptionBuilderVerifyResponse.__name__])
@setup_required
@login_required
@edit_permission_required
@ -253,7 +288,7 @@ class TriggerSubscriptionBuilderVerifyApi(Resource):
)
class TriggerSubscriptionBuilderUpdateApi(Resource):
@console_ns.expect(console_ns.models[TriggerSubscriptionBuilderUpdatePayload.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerProviderOpaqueResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[SubscriptionBuilderApiEntity.__name__])
@setup_required
@login_required
@edit_permission_required
@ -286,7 +321,7 @@ class TriggerSubscriptionBuilderUpdateApi(Resource):
"/workspaces/current/trigger-provider/<path:provider>/subscriptions/builder/logs/<path:subscription_builder_id>",
)
class TriggerSubscriptionBuilderLogsApi(Resource):
@console_ns.response(200, "Success", console_ns.models[TriggerProviderOpaqueResponse.__name__])
@console_ns.response(200, "Success", console_ns.models[TriggerSubscriptionBuilderLogsResponse.__name__])
@setup_required
@login_required
@edit_permission_required

View File

@ -5243,7 +5243,7 @@ Refresh MCP server configuration and regenerate server code
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [BillingResponse](#billingresponse)<br> |
| 200 | Success | **application/json**: [BillingInvoiceResponse](#billinginvoiceresponse)<br> |
### [PUT] /billing/partners/{partner_key}/tenants
Sync partner tenants bindings
@ -6836,6 +6836,12 @@ Check if dataset is in use
| 200 | Success | **application/json**: [UploadConfig](#uploadconfig)<br> |
### [POST] /files/upload
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **multipart/form-data**: { **"file"**: binary, **"source"**: string, <br>**Available values:** "datasets" }<br> |
#### Responses
| Code | Description | Schema |
@ -11140,6 +11146,12 @@ Returns permission flags that control workspace features like member invitations
| app_id | path | | Yes | string (uuid) |
| policy_id | path | | Yes | string |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [_DeleteMemberBindingsRequest](#_deletememberbindingsrequest)<br> |
#### Responses
| Code | Description | Schema |
@ -11179,6 +11191,7 @@ Returns permission flags that control workspace features like member invitations
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| language | query | Localized policy label language | No | string, <br>**Available values:** "en", "ja", "zh" |
| app_id | path | | Yes | string (uuid) |
#### Responses
@ -11192,6 +11205,7 @@ Returns permission flags that control workspace features like member invitations
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| language | query | Localized policy label language | No | string, <br>**Available values:** "en", "ja", "zh" |
| app_id | path | | Yes | string (uuid) |
#### Responses
@ -11208,6 +11222,12 @@ Returns permission flags that control workspace features like member invitations
| app_id | path | | Yes | string (uuid) |
| target_account_id | path | | Yes | string (uuid) |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [ReplaceUserAccessPolicies](#replaceuseraccesspolicies)<br> |
#### Responses
| Code | Description | Schema |
@ -11234,6 +11254,12 @@ Returns permission flags that control workspace features like member invitations
| ---- | ---------- | ----------- | -------- | ------ |
| app_id | path | | Yes | string (uuid) |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [_ResourceAccessScopeRequest](#_resourceaccessscoperequest)<br> |
#### Responses
| Code | Description | Schema |
@ -11248,6 +11274,12 @@ Returns permission flags that control workspace features like member invitations
| dataset_id | path | | Yes | string (uuid) |
| policy_id | path | | Yes | string |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [_DeleteMemberBindingsRequest](#_deletememberbindingsrequest)<br> |
#### Responses
| Code | Description | Schema |
@ -11287,6 +11319,7 @@ Returns permission flags that control workspace features like member invitations
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| language | query | Localized policy label language | No | string, <br>**Available values:** "en", "ja", "zh" |
| dataset_id | path | | Yes | string (uuid) |
#### Responses
@ -11300,6 +11333,7 @@ Returns permission flags that control workspace features like member invitations
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| language | query | Localized policy label language | No | string, <br>**Available values:** "en", "ja", "zh" |
| dataset_id | path | | Yes | string (uuid) |
#### Responses
@ -11316,6 +11350,12 @@ Returns permission flags that control workspace features like member invitations
| dataset_id | path | | Yes | string (uuid) |
| target_account_id | path | | Yes | string (uuid) |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [ReplaceUserAccessPolicies](#replaceuseraccesspolicies)<br> |
#### Responses
| Code | Description | Schema |
@ -11342,6 +11382,12 @@ Returns permission flags that control workspace features like member invitations
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | | Yes | string (uuid) |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [_ResourceAccessScopeRequest](#_resourceaccessscoperequest)<br> |
#### Responses
| Code | Description | Schema |
@ -11368,6 +11414,12 @@ Returns permission flags that control workspace features like member invitations
| ---- | ---------- | ----------- | -------- | ------ |
| member_id | path | | Yes | string (uuid) |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [_ReplaceMemberRolesRequest](#_replacememberrolesrequest)<br> |
#### Responses
| Code | Description | Schema |
@ -11488,6 +11540,12 @@ Returns permission flags that control workspace features like member invitations
| ---- | ---------- | ----------- | -------- | ------ |
| policy_id | path | | Yes | string (uuid) |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [_ReplaceBindingsRequest](#_replacebindingsrequest)<br> |
#### Responses
| Code | Description | Schema |
@ -11534,6 +11592,12 @@ Returns permission flags that control workspace features like member invitations
| ---- | ---------- | ----------- | -------- | ------ |
| policy_id | path | | Yes | string (uuid) |
#### Request Body
| Required | Schema |
| -------- | ------ |
| Yes | **application/json**: [_ReplaceBindingsRequest](#_replacebindingsrequest)<br> |
#### Responses
| Code | Description | Schema |
@ -12110,7 +12174,7 @@ Returns permission flags that control workspace features like member invitations
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [TriggerProviderOpaqueResponse](#triggerprovideropaqueresponse)<br> |
| 200 | Success | **application/json**: [TriggerProviderApiEntity](#triggerproviderapientity)<br> |
### [DELETE] /workspaces/current/trigger-provider/{provider}/oauth/client
**Remove custom OAuth client configuration**
@ -12204,7 +12268,7 @@ Returns permission flags that control workspace features like member invitations
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [TriggerProviderOpaqueResponse](#triggerprovideropaqueresponse)<br> |
| 200 | Success | **application/json**: [TriggerSubscriptionBuilderCreateResponse](#triggersubscriptionbuildercreateresponse)<br> |
### [GET] /workspaces/current/trigger-provider/{provider}/subscriptions/builder/logs/{subscription_builder_id}
**Get the request logs for a subscription instance for a trigger provider**
@ -12220,7 +12284,7 @@ Returns permission flags that control workspace features like member invitations
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [TriggerProviderOpaqueResponse](#triggerprovideropaqueresponse)<br> |
| 200 | Success | **application/json**: [TriggerSubscriptionBuilderLogsResponse](#triggersubscriptionbuilderlogsresponse)<br> |
### [POST] /workspaces/current/trigger-provider/{provider}/subscriptions/builder/update/{subscription_builder_id}
**Update a subscription instance for a trigger provider**
@ -12242,7 +12306,7 @@ Returns permission flags that control workspace features like member invitations
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [TriggerProviderOpaqueResponse](#triggerprovideropaqueresponse)<br> |
| 200 | Success | **application/json**: [SubscriptionBuilderApiEntity](#subscriptionbuilderapientity)<br> |
### [POST] /workspaces/current/trigger-provider/{provider}/subscriptions/builder/verify-and-update/{subscription_builder_id}
**Verify and update a subscription instance for a trigger provider**
@ -12264,7 +12328,7 @@ Returns permission flags that control workspace features like member invitations
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [TriggerProviderOpaqueResponse](#triggerprovideropaqueresponse)<br> |
| 200 | Success | **application/json**: [TriggerSubscriptionBuilderVerifyResponse](#triggersubscriptionbuilderverifyresponse)<br> |
### [GET] /workspaces/current/trigger-provider/{provider}/subscriptions/builder/{subscription_builder_id}
**Get a subscription instance for a trigger provider**
@ -12280,7 +12344,7 @@ Returns permission flags that control workspace features like member invitations
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [TriggerProviderOpaqueResponse](#triggerprovideropaqueresponse)<br> |
| 200 | Success | **application/json**: [SubscriptionBuilderApiEntity](#subscriptionbuilderapientity)<br> |
### [GET] /workspaces/current/trigger-provider/{provider}/subscriptions/list
**List all trigger subscriptions for the current tenant's provider**
@ -12295,7 +12359,7 @@ Returns permission flags that control workspace features like member invitations
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [TriggerProviderOpaqueResponse](#triggerprovideropaqueresponse)<br> |
| 200 | Success | **application/json**: [TriggerSubscriptionListResponse](#triggersubscriptionlistresponse)<br> |
### [GET] /workspaces/current/trigger-provider/{provider}/subscriptions/oauth/authorize
**Initiate OAuth authorization flow for a trigger provider**
@ -12377,7 +12441,7 @@ Returns permission flags that control workspace features like member invitations
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | **application/json**: [TriggerProviderOpaqueResponse](#triggerprovideropaqueresponse)<br> |
| 200 | Success | **application/json**: [TriggerProviderListResponse](#triggerproviderlistresponse)<br> |
### [POST] /workspaces/custom-config
#### Request Body
@ -12682,6 +12746,7 @@ Default namespace
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| avatar | string | | No |
| avatar_url | string | | Yes |
| created_at | integer | | No |
| email | string | | Yes |
| id | string | | Yes |
@ -15016,6 +15081,12 @@ AppMCPServer Status Enum
| use_icon_as_answer_icon | boolean | | No |
| workflow | [WorkflowPartial](#workflowpartial) | | No |
#### AppSelectorScope
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| AppSelectorScope | string | | |
#### AppSiteResponse
| Name | Type | Description | Required |
@ -15179,6 +15250,12 @@ Retrieval settings for Amazon Bedrock knowledge base queries.
| score_threshold | number | Minimum relevance score threshold | No |
| top_k | integer | Maximum number of results to retrieve | No |
#### BillingInvoiceResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| url | string | | Yes |
#### BillingModel
| Name | Type | Description | Required |
@ -15717,6 +15794,16 @@ Enum class for configurate method of provider model.
| auto_generate | boolean | Automatically generate the conversation name. When `true`, the `name` field is ignored. | No |
| name | string | Conversation name. Required when `auto_generate` is `false`. | No |
#### ConversationVariableItemPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| description | string | | No |
| id | string | | No |
| name | string | | No |
| value | | | No |
| value_type | string | | No |
#### ConversationVariableResponse
| Name | Type | Description | Required |
@ -15733,7 +15820,7 @@ Enum class for configurate method of provider model.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| conversation_variables | [ object ] | Conversation variables for the draft workflow | Yes |
| conversation_variables | [ [ConversationVariableItemPayload](#conversationvariableitempayload) ] | Conversation variables for the draft workflow | Yes |
#### ConversationVariablesQuery
@ -17079,6 +17166,16 @@ Request payload for bulk downloading documents as a zip archive.
| reason | string | | No |
| secret_likely | boolean | | No |
#### EnvironmentVariableItemPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| description | string | | No |
| id | string | | No |
| name | string | | No |
| value | | | No |
| value_type | string | | No |
#### EnvironmentVariableItemResponse
| Name | Type | Description | Required |
@ -17104,7 +17201,7 @@ Request payload for bulk downloading documents as a zip archive.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| environment_variables | [ object ] | Environment variables for the draft workflow | Yes |
| environment_variables | [ [EnvironmentVariableItemPayload](#environmentvariableitempayload) ] | Environment variables for the draft workflow | Yes |
#### ErrorDocsResponse
@ -17113,6 +17210,56 @@ Request payload for bulk downloading documents as a zip archive.
| data | [ [DocumentStatusResponse](#documentstatusresponse) ] | | Yes |
| total | integer | | Yes |
#### EventApiEntity
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| description | [I18nObject](#i18nobject) | The description of the trigger | Yes |
| identity | [EventIdentity](#eventidentity) | The identity of the trigger | Yes |
| name | string | The name of the trigger | Yes |
| output_schema | object | The output schema of the trigger | Yes |
| parameters | [ [EventParameter](#eventparameter) ] | The parameters of the trigger | Yes |
#### EventIdentity
The identity of the event
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| author | string | The author of the event | Yes |
| label | [I18nObject](#i18nobject) | The label of the event | Yes |
| name | string | The name of the event | Yes |
| provider | string | The provider of the event | No |
#### EventParameter
The parameter of the event
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| auto_generate | [PluginParameterAutoGenerate](#pluginparameterautogenerate) | The auto generate of the parameter | No |
| default | integer<br>number<br>string<br>[ object ] | | No |
| description | [I18nObject](#i18nobject) | | No |
| label | [I18nObject](#i18nobject) | The label presented to the user | Yes |
| max | number<br>integer | | No |
| min | number<br>integer | | No |
| multiple | boolean | Whether the parameter is multiple select, only valid for select or dynamic-select type | No |
| name | string | The name of the parameter | Yes |
| options | [ [PluginParameterOption](#pluginparameteroption) ] | | No |
| precision | integer | | No |
| required | boolean | | No |
| scope | string | | No |
| template | [PluginParameterTemplate](#pluginparametertemplate) | The template of the parameter | No |
| type | [EventParameterType](#eventparametertype) | | Yes |
#### EventParameterType
The type of the parameter
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| EventParameterType | string | The type of the parameter | |
#### EventStreamResponse
| Name | Type | Description | Required |
@ -17939,6 +18086,17 @@ Enum class for large language model mode.
| ---- | ---- | ----------- | -------- |
| LLMMode | string | Enum class for large language model mode. | |
#### LatestPluginCache
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| alternative_plugin_id | string | | Yes |
| deprecated_reason | string | | Yes |
| plugin_id | string | | Yes |
| status | string | | Yes |
| unique_identifier | string | | Yes |
| version | string | | Yes |
#### LearnDifyAppListResponse
| Name | Type | Description | Required |
@ -18392,6 +18550,12 @@ Enum class for model property key.
| ---- | ---- | ----------- | -------- |
| payment_link | string | | Yes |
#### ModelSelectorScope
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| ModelSelectorScope | string | | |
#### ModelStatus
Enum class for model status.
@ -18682,6 +18846,15 @@ Coarse node-level status used by Inspector to pick a banner.
| refresh_token | string | | Yes |
| token_type | string | | Yes |
#### OAuthSchema
OAuth schema
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| client_schema | [ [ProviderConfig](#providerconfig) ] | client schema like client_id, client_secret, etc. | No |
| credentials_schema | [ [ProviderConfig](#providerconfig) ] | credentials schema like access_token, refresh_token, etc. | No |
#### OAuthTokenRequest
| Name | Type | Description | Required |
@ -18699,6 +18872,13 @@ Coarse node-level status used by Inspector to pick a banner.
| ---- | ---- | ----------- | -------- |
| OpaqueObjectResponse | object | | |
#### Option
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| label | [I18nObject](#i18nobject) | The label of the option | Yes |
| value | string | The value of the option | Yes |
#### OutputErrorStrategy
Per-output failure handling strategy.
@ -19404,6 +19584,25 @@ Shared permission levels for resources (datasets, credentials, etc.)
| ---- | ---- | ----------- | -------- |
| endpoints | [ object ] | Endpoint information | Yes |
#### PluginInstallationItemResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| checksum | string | | Yes |
| created_at | dateTime | | Yes |
| declaration | object | | Yes |
| endpoints_active | integer | | Yes |
| endpoints_setups | integer | | Yes |
| id | string | | Yes |
| meta | object | | Yes |
| plugin_id | string | | Yes |
| plugin_unique_identifier | string | | Yes |
| runtime_type | string | | Yes |
| source | [PluginInstallationSource](#plugininstallationsource) | | Yes |
| tenant_id | string | | Yes |
| updated_at | dateTime | | Yes |
| version | string | | Yes |
#### PluginInstallationPermissionModel
| Name | Type | Description | Required |
@ -19427,7 +19626,7 @@ Shared permission levels for resources (datasets, credentials, etc.)
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| plugins | | | Yes |
| plugins | [ [PluginInstallationItemResponse](#plugininstallationitemresponse) ] | | Yes |
#### PluginListResponse
@ -19461,6 +19660,26 @@ Shared permission levels for resources (datasets, credentials, etc.)
| message | string | | No |
| success | boolean | | Yes |
#### PluginParameterAutoGenerate
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| type | [core__plugin__entities__parameters__PluginParameterAutoGenerate__Type](#core__plugin__entities__parameters__pluginparameterautogenerate__type) | | Yes |
#### PluginParameterOption
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| icon | string | The icon of the option, can be a url or a base64 encoded image | No |
| label | [I18nObject](#i18nobject) | The label of the option | Yes |
| value | string | The value of the option | Yes |
#### PluginParameterTemplate
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| enabled | boolean | Whether the parameter is jinja enabled | No |
#### PluginPermissionResponse
| Name | Type | Description | Required |
@ -19497,7 +19716,7 @@ Shared permission levels for resources (datasets, credentials, etc.)
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| versions | | | Yes |
| versions | object | | Yes |
#### PreProcessingRule
@ -19540,6 +19759,24 @@ Dataset Process Rule Mode
| ---- | ---- | ----------- | -------- |
| ProcessRuleMode | string | Dataset Process Rule Mode | |
#### ProviderConfig
Model class for common provider settings like credentials
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| default | integer<br>string<br>number<br>boolean | | No |
| help | [I18nObject](#i18nobject) | | No |
| label | [I18nObject](#i18nobject) | | No |
| multiple | boolean | | No |
| name | string | The name of the credentials | Yes |
| options | [ [Option](#option) ] | | No |
| placeholder | [I18nObject](#i18nobject) | | No |
| required | boolean | | No |
| scope | [AppSelectorScope](#appselectorscope)<br>[ModelSelectorScope](#modelselectorscope)<br>[ToolSelectorScope](#toolselectorscope) | | No |
| type | [core__entities__provider_entities__BasicProviderConfig__Type](#core__entities__provider_entities__basicproviderconfig__type) | The type of the credentials | Yes |
| url | string | | No |
#### ProviderCredentialResponse
| Name | Type | Description | Required |
@ -19722,6 +19959,14 @@ Model class for provider quota configuration.
| ---- | ---- | ----------- | -------- |
| QuotaUnit | string | | |
#### RBACResourceWhitelistScope
Whitelist scopes accepted by RBAC app and dataset access config APIs.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| RBACResourceWhitelistScope | string | Whitelist scopes accepted by RBAC app and dataset access config APIs. | |
#### RBACRole
| Name | Type | Description | Required |
@ -19820,7 +20065,13 @@ Model class for provider quota configuration.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| RecommendedAppDetailResponse | object | | |
| can_trial | boolean | | No |
| export_data | string | | Yes |
| icon | string | | No |
| icon_background | string | | No |
| id | string | | Yes |
| mode | string | | Yes |
| name | string | | Yes |
#### RecommendedAppInfoResponse
@ -19906,12 +20157,28 @@ Model class for provider quota configuration.
| ---- | ---- | ----------- | -------- |
| url | string | URL to fetch | Yes |
#### ReplaceUserAccessPolicies
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| access_policy_ids | [ string ] | | No |
#### ReplaceUserAccessPoliciesResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| access_policies | [ [AccessPolicy](#accesspolicy) ] | | No |
#### RequestLog
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | dateTime | The created at of the request log | Yes |
| endpoint | string | The endpoint of the request log | Yes |
| id | string | The id of the request log | Yes |
| request | object | The request of the request log | Yes |
| response | object | The response of the request log | Yes |
#### RerankingModel
| Name | Type | Description | Required |
@ -20638,6 +20905,29 @@ Default configuration for form inputs.
| type | [ValueSourceType](#valuesourcetype) | | Yes |
| value | string | | No |
#### SubscriptionBuilderApiEntity
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| credential_type | [CredentialType](#credentialtype) | The credential type of the subscription builder | Yes |
| credentials | object | The credentials of the subscription builder | Yes |
| endpoint | string | The endpoint id of the subscription builder | Yes |
| id | string | The id of the subscription builder | Yes |
| name | string | The name of the subscription builder | Yes |
| parameters | object | The parameters of the subscription builder | Yes |
| properties | object | The properties of the subscription builder | Yes |
| provider | string | The provider id of the subscription builder | Yes |
#### SubscriptionConstructor
The subscription constructor of the trigger provider
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| credentials_schema | [ [ProviderConfig](#providerconfig) ] | The credentials schema of the subscription constructor | No |
| oauth_schema | [OAuthSchema](#oauthschema) | The OAuth schema of the subscription constructor if OAuth is supported | No |
| parameters | [ [EventParameter](#eventparameter) ] | The parameters schema of the subscription constructor | No |
#### SubscriptionModel
| Name | Type | Description | Required |
@ -20953,6 +21243,12 @@ Enum class for tool provider
| ---- | ---- | ----------- | -------- |
| ToolProviderType | string | Enum class for tool provider | |
#### ToolSelectorScope
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| ToolSelectorScope | string | | |
#### TraceAppConfigResponse
| Name | Type | Description | Required |
@ -21189,12 +21485,18 @@ Enum class for tool provider
| updated_at | long | | No |
| updated_by | string | | No |
#### TriggerCreationMethod
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| TriggerCreationMethod | string | | |
#### TriggerOAuthAuthorizeResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| authorization_url | string | | Yes |
| subscription_builder | | | Yes |
| subscription_builder | [SubscriptionBuilderApiEntity](#subscriptionbuilderapientity) | | Yes |
| subscription_builder_id | string | | Yes |
#### TriggerOAuthClientPayload
@ -21216,18 +21518,68 @@ Enum class for tool provider
| redirect_uri | string | | Yes |
| system_configured | boolean | | Yes |
#### TriggerProviderApiEntity
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| author | string | The author of the trigger provider | Yes |
| description | [I18nObject](#i18nobject) | The description of the trigger provider | Yes |
| events | [ [EventApiEntity](#eventapientity) ] | The events of the trigger provider | Yes |
| icon | string | The icon of the trigger provider | No |
| icon_dark | string | The dark icon of the trigger provider | No |
| label | [I18nObject](#i18nobject) | The label of the trigger provider | Yes |
| name | string | The name of the trigger provider | Yes |
| plugin_id | string | The plugin id of the tool | No |
| plugin_unique_identifier | string | The unique identifier of the tool | No |
| subscription_constructor | [SubscriptionConstructor](#subscriptionconstructor) | The subscription constructor of the trigger provider | No |
| subscription_schema | [ [ProviderConfig](#providerconfig) ] | The subscription schema of the trigger provider | No |
| supported_creation_methods | [ [TriggerCreationMethod](#triggercreationmethod) ] | Supported creation methods for the trigger provider. like 'OAUTH', 'APIKEY', 'MANUAL'. | No |
| tags | [ string ] | The tags of the trigger provider | No |
#### TriggerProviderListResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| TriggerProviderListResponse | array | | |
#### TriggerProviderOpaqueResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| TriggerProviderOpaqueResponse | | | |
#### TriggerProviderSubscriptionApiEntity
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| credential_type | [CredentialType](#credentialtype) | The type of the credential | Yes |
| credentials | object | The credentials of the subscription | Yes |
| endpoint | string | The endpoint of the subscription | Yes |
| id | string | The unique id of the subscription | Yes |
| name | string | The name of the subscription | Yes |
| parameters | object | The parameters of the subscription | Yes |
| properties | object | The properties of the subscription | Yes |
| provider | string | The provider id of the subscription | Yes |
| workflows_in_use | integer | The number of workflows using this subscription | Yes |
#### TriggerSubscriptionBuilderCreatePayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| credential_type | string, <br>**Default:** unauthorized | | No |
#### TriggerSubscriptionBuilderCreateResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| subscription_builder | [SubscriptionBuilderApiEntity](#subscriptionbuilderapientity) | | Yes |
#### TriggerSubscriptionBuilderLogsResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| logs | [ [RequestLog](#requestlog) ] | | Yes |
#### TriggerSubscriptionBuilderUpdatePayload
| Name | Type | Description | Required |
@ -21243,6 +21595,18 @@ Enum class for tool provider
| ---- | ---- | ----------- | -------- |
| credentials | object | | Yes |
#### TriggerSubscriptionBuilderVerifyResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| verified | boolean | | Yes |
#### TriggerSubscriptionListResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| TriggerSubscriptionListResponse | array | | |
#### Type
| Name | Type | Description | Required |
@ -21866,11 +22230,71 @@ How a workflow node is bound to an Agent.
| ---- | ---- | ----------- | -------- |
| WorkflowExecutionStatus | string | | |
#### WorkflowFeatureTogglePayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| enabled | boolean | | No |
#### WorkflowFeaturesConfigPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| file_upload | [WorkflowFileUploadPayload](#workflowfileuploadpayload) | | No |
| opening_statement | string | | No |
| retriever_resource | [WorkflowFeatureTogglePayload](#workflowfeaturetogglepayload) | | No |
| sensitive_word_avoidance | [WorkflowSensitiveWordAvoidancePayload](#workflowsensitivewordavoidancepayload) | | No |
| speech_to_text | [WorkflowFeatureTogglePayload](#workflowfeaturetogglepayload) | | No |
| suggested_questions | [ string ] | | No |
| suggested_questions_after_answer | [WorkflowSuggestedQuestionsAfterAnswerPayload](#workflowsuggestedquestionsafteranswerpayload) | | No |
| text_to_speech | [WorkflowTextToSpeechPayload](#workflowtexttospeechpayload) | | No |
#### WorkflowFeaturesPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| features | object | Workflow feature configuration | Yes |
| features | [WorkflowFeaturesConfigPayload](#workflowfeaturesconfigpayload) | Workflow feature configuration | Yes |
#### WorkflowFileUploadImagePayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| detail | string | | No |
| enabled | boolean | | No |
| number_limits | integer | | No |
| transfer_methods | [ string ] | | No |
#### WorkflowFileUploadPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| allowed_file_extensions | [ string ] | | No |
| allowed_file_types | [ string ] | | No |
| allowed_file_upload_methods | [ string ] | | No |
| audio | [WorkflowFileUploadTransferPayload](#workflowfileuploadtransferpayload) | | No |
| custom | [WorkflowFileUploadTransferPayload](#workflowfileuploadtransferpayload) | | No |
| document | [WorkflowFileUploadTransferPayload](#workflowfileuploadtransferpayload) | | No |
| enabled | boolean | | No |
| fileUploadConfig | object | | No |
| image | [WorkflowFileUploadImagePayload](#workflowfileuploadimagepayload) | | No |
| number_limits | integer | | No |
| preview_config | [WorkflowFileUploadPreviewConfigPayload](#workflowfileuploadpreviewconfigpayload) | | No |
| video | [WorkflowFileUploadTransferPayload](#workflowfileuploadtransferpayload) | | No |
#### WorkflowFileUploadPreviewConfigPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| file_type_list | [ string ] | | No |
| mode | string | | No |
#### WorkflowFileUploadTransferPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| enabled | boolean | | No |
| number_limits | integer | | No |
| transfer_methods | [ string ] | | No |
#### WorkflowGeneratePayload
@ -22208,6 +22632,14 @@ Query parameters for workflow runs.
| workflow_run_id | string | | Yes |
| workflow_run_status | [WorkflowExecutionStatus](#workflowexecutionstatus) | | Yes |
#### WorkflowSensitiveWordAvoidancePayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| config | object | | No |
| enabled | boolean | | No |
| type | string | | No |
#### WorkflowStatisticQuery
| Name | Type | Description | Required |
@ -22215,6 +22647,23 @@ Query parameters for workflow runs.
| end | string | End date and time (YYYY-MM-DD HH:MM) | No |
| start | string | Start date and time (YYYY-MM-DD HH:MM) | No |
#### WorkflowSuggestedQuestionsAfterAnswerPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| enabled | boolean | | No |
| model | object | | No |
| prompt | string | | No |
#### WorkflowTextToSpeechPayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| autoPlay | string | | No |
| enabled | boolean | | No |
| language | string | | No |
| voice | string | | No |
#### WorkflowToolCreatePayload
| Name | Type | Description | Required |
@ -22377,6 +22826,12 @@ Workflow tool configuration
| ---- | ---- | ----------- | -------- |
| permission_keys | [ string ] | | No |
#### _AccessControlLanguageQuery
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| language | string | Localized policy label language | No |
#### _AccessPolicyList
| Name | Type | Description | Required |
@ -22428,6 +22883,12 @@ Workflow tool configuration
| model_provider_name | string | | No |
| summary_prompt | string | | No |
#### _DeleteMemberBindingsRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| account_ids | [ string ] | | No |
#### _MembersInRoleList
| Name | Type | Description | Required |
@ -22449,6 +22910,37 @@ Workflow tool configuration
| data | [ [RBACRole](#rbacrole) ] | | No |
| pagination | [Pagination](#pagination) | | No |
#### _ReplaceBindingsRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| account_ids | [ string ] | | No |
| role_ids | [ string ] | | No |
#### _ReplaceMemberRolesRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| role_ids | [ string ], <br>**Default:** | | No |
#### _ResourceAccessScopeRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| scope | [RBACResourceWhitelistScope](#rbacresourcewhitelistscope) | | Yes |
#### core__entities__provider_entities__BasicProviderConfig__Type
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| core__entities__provider_entities__BasicProviderConfig__Type | string | | |
#### core__plugin__entities__parameters__PluginParameterAutoGenerate__Type
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| core__plugin__entities__parameters__PluginParameterAutoGenerate__Type | string | | |
#### core__tools__entities__common_entities__I18nObject
Model class for i18n object.

View File

@ -46,6 +46,20 @@ def _get_operations(payload):
yield operation
def _response_schema(operation, status="200"):
return operation["responses"][status]["content"]["application/json"]["schema"]
def _request_schema(operation, content_type="application/json"):
return operation["requestBody"]["content"][content_type]["schema"]
def _nullable_schema_ref(schema):
if "$ref" in schema:
return schema["$ref"]
return next(item["$ref"] for item in schema["anyOf"] if "$ref" in item)
def test_generate_specs_writes_console_web_and_service_openapi_files(tmp_path):
module = _load_generate_swagger_specs_module()
@ -166,6 +180,78 @@ def test_generate_specs_include_agent_v2_knowledge_set_schema_and_query_enums(tm
assert schemas["AgentKnowledgeQueryMode"]["enum"] == ["generated_query", "user_query"]
def test_generate_specs_include_console_contract_shapes_for_schema_migration(tmp_path):
module = _load_generate_swagger_specs_module()
written_paths = module.generate_specs(tmp_path)
console_path = next(path for path in written_paths if path.name == "console-openapi.json")
payload = json.loads(console_path.read_text(encoding="utf-8"))
schemas = payload["components"]["schemas"]
paths = payload["paths"]
file_upload_schema = _request_schema(paths["/files/upload"]["post"], "multipart/form-data")
assert file_upload_schema["required"] == ["file"]
assert file_upload_schema["properties"]["file"]["format"] == "binary"
assert file_upload_schema["properties"]["file"]["type"] == "string"
assert file_upload_schema["properties"]["source"]["enum"] == ["datasets"]
invoices_schema_ref = _response_schema(paths["/billing/invoices"]["get"])["$ref"].removeprefix(
"#/components/schemas/"
)
assert schemas[invoices_schema_ref]["properties"]["url"]["type"] == "string"
app_detail_schema = schemas["RecommendedAppDetailResponse"]
assert app_detail_schema["properties"]["id"]["type"] == "string"
assert app_detail_schema["properties"]["export_data"]["type"] == "string"
assert {"type": "boolean"} in app_detail_schema["properties"]["can_trial"]["anyOf"]
plugin_versions = schemas["PluginVersionsResponse"]["properties"]["versions"]
assert plugin_versions["additionalProperties"]["anyOf"][0]["$ref"] == "#/components/schemas/LatestPluginCache"
assert plugin_versions["additionalProperties"]["anyOf"][1]["type"] == "null"
plugin_installations = schemas["PluginInstallationsResponse"]["properties"]["plugins"]
assert plugin_installations["items"]["$ref"] == "#/components/schemas/PluginInstallationItemResponse"
rbac_whitelist_request = _request_schema(paths["/workspaces/current/rbac/apps/{app_id}/whitelist"]["put"])
assert rbac_whitelist_request["$ref"] == "#/components/schemas/_ResourceAccessScopeRequest"
app_access_policy_params = paths["/workspaces/current/rbac/apps/{app_id}/access-policy"]["get"]["parameters"]
language_param = next(param for param in app_access_policy_params if param["name"] == "language")
assert language_param["schema"]["enum"] == ["en", "ja", "zh"]
trigger_list_schema = _response_schema(paths["/workspaces/current/triggers"]["get"])
assert trigger_list_schema["$ref"] == "#/components/schemas/TriggerProviderListResponse"
trigger_builder_create_schema = _response_schema(
paths["/workspaces/current/trigger-provider/{provider}/subscriptions/builder/create"]["post"]
)
assert trigger_builder_create_schema["$ref"] == "#/components/schemas/TriggerSubscriptionBuilderCreateResponse"
assert (
schemas["TriggerSubscriptionBuilderCreateResponse"]["properties"]["subscription_builder"]["$ref"]
== "#/components/schemas/SubscriptionBuilderApiEntity"
)
conversation_variables = schemas["ConversationVariableUpdatePayload"]["properties"]["conversation_variables"]
assert conversation_variables["items"]["$ref"] == "#/components/schemas/ConversationVariableItemPayload"
workflow_features = schemas["WorkflowFeaturesPayload"]["properties"]["features"]
assert workflow_features["$ref"] == "#/components/schemas/WorkflowFeaturesConfigPayload"
workflow_feature_properties = schemas["WorkflowFeaturesConfigPayload"]["properties"]
assert _nullable_schema_ref(workflow_feature_properties["suggested_questions_after_answer"]) == (
"#/components/schemas/WorkflowSuggestedQuestionsAfterAnswerPayload"
)
assert _nullable_schema_ref(workflow_feature_properties["text_to_speech"]) == (
"#/components/schemas/WorkflowTextToSpeechPayload"
)
assert _nullable_schema_ref(workflow_feature_properties["sensitive_word_avoidance"]) == (
"#/components/schemas/WorkflowSensitiveWordAvoidancePayload"
)
assert {"enabled", "model", "prompt"} <= set(schemas["WorkflowSuggestedQuestionsAfterAnswerPayload"]["properties"])
assert {"enabled", "language", "voice", "autoPlay"} <= set(schemas["WorkflowTextToSpeechPayload"]["properties"])
assert {"enabled", "type", "config"} <= set(schemas["WorkflowSensitiveWordAvoidancePayload"]["properties"])
file_upload = schemas["WorkflowFileUploadPayload"]["properties"]
assert {"document", "audio", "video", "custom", "preview_config"} <= set(file_upload)
assert "detail" in schemas["WorkflowFileUploadImagePayload"]["properties"]
assert {"mode", "file_type_list"} <= set(schemas["WorkflowFileUploadPreviewConfigPayload"]["properties"])
assert schemas["AccountWithRole"]["properties"]["avatar_url"]["readOnly"] is True
def test_checked_in_agent_v2_knowledge_openapi_and_generated_contracts_are_in_sync():
api_dir = Path(__file__).resolve().parents[3]
repo_root = api_dir.parent

View File

@ -1011,9 +1011,7 @@ export type WorkflowDraftVariableList = {
}
export type ConversationVariableUpdatePayload = {
conversation_variables: Array<{
[key: string]: unknown
}>
conversation_variables: Array<ConversationVariableItemPayload>
}
export type EnvironmentVariableListResponse = {
@ -1021,15 +1019,11 @@ export type EnvironmentVariableListResponse = {
}
export type EnvironmentVariableUpdatePayload = {
environment_variables: Array<{
[key: string]: unknown
}>
environment_variables: Array<EnvironmentVariableItemPayload>
}
export type WorkflowFeaturesPayload = {
features: {
[key: string]: unknown
}
features: WorkflowFeaturesConfigPayload
}
export type HumanInputDeliveryTestPayload = {
@ -1816,6 +1810,7 @@ export type WorkflowCommentBasic = {
export type AccountWithRole = {
avatar?: string | null
readonly avatar_url: string | null
created_at?: number | null
email: string
id: string
@ -1903,6 +1898,15 @@ export type PipelineVariableResponse = {
variable: string
}
export type ConversationVariableItemPayload = {
description?: string | null
id?: string | null
name?: string | null
value?: unknown | null
value_type?: string | null
[key: string]: unknown
}
export type EnvironmentVariableItemResponse = {
description?: string | null
editable: boolean
@ -1916,6 +1920,27 @@ export type EnvironmentVariableItemResponse = {
visible: boolean
}
export type EnvironmentVariableItemPayload = {
description?: string | null
id?: string | null
name?: string | null
value?: unknown | null
value_type?: string | null
[key: string]: unknown
}
export type WorkflowFeaturesConfigPayload = {
file_upload?: WorkflowFileUploadPayload | null
opening_statement?: string | null
retriever_resource?: WorkflowFeatureTogglePayload | null
sensitive_word_avoidance?: WorkflowSensitiveWordAvoidancePayload | null
speech_to_text?: WorkflowFeatureTogglePayload | null
suggested_questions?: Array<string> | null
suggested_questions_after_answer?: WorkflowSuggestedQuestionsAfterAnswerPayload | null
text_to_speech?: WorkflowTextToSpeechPayload | null
[key: string]: unknown
}
export type AgentConfigSnapshotSummaryResponse = {
agent_id?: string | null
created_at?: number | null
@ -2259,6 +2284,55 @@ export type WorkflowRunForArchivedLogResponse = {
triggered_from?: string | null
}
export type WorkflowFileUploadPayload = {
allowed_file_extensions?: Array<string> | null
allowed_file_types?: Array<string> | null
allowed_file_upload_methods?: Array<string> | null
audio?: WorkflowFileUploadTransferPayload | null
custom?: WorkflowFileUploadTransferPayload | null
document?: WorkflowFileUploadTransferPayload | null
enabled?: boolean | null
fileUploadConfig?: {
[key: string]: unknown
} | null
image?: WorkflowFileUploadImagePayload | null
number_limits?: number | null
preview_config?: WorkflowFileUploadPreviewConfigPayload | null
video?: WorkflowFileUploadTransferPayload | null
[key: string]: unknown
}
export type WorkflowFeatureTogglePayload = {
enabled?: boolean | null
[key: string]: unknown
}
export type WorkflowSensitiveWordAvoidancePayload = {
config?: {
[key: string]: unknown
} | null
enabled?: boolean | null
type?: string | null
[key: string]: unknown
}
export type WorkflowSuggestedQuestionsAfterAnswerPayload = {
enabled?: boolean | null
model?: {
[key: string]: unknown
} | null
prompt?: string | null
[key: string]: unknown
}
export type WorkflowTextToSpeechPayload = {
autoPlay?: string | null
enabled?: boolean | null
language?: string | null
voice?: string | null
[key: string]: unknown
}
export type AgentScope = 'roster' | 'workflow_only'
export type AgentSource = 'agent_app' | 'imported' | 'roster' | 'system' | 'workflow'
@ -2505,6 +2579,26 @@ export type FormInputConfig
export type JsonValue2 = unknown
export type WorkflowFileUploadTransferPayload = {
enabled?: boolean | null
number_limits?: number | null
transfer_methods?: Array<string> | null
[key: string]: unknown
}
export type WorkflowFileUploadImagePayload = {
detail?: string | null
enabled?: boolean | null
number_limits?: number | null
transfer_methods?: Array<string> | null
[key: string]: unknown
}
export type WorkflowFileUploadPreviewConfigPayload = {
file_type_list?: Array<string> | null
mode?: string | null
}
export type AgentFeatureToggleConfig = {
enabled?: boolean
[key: string]: unknown
@ -2922,6 +3016,10 @@ export type WorkflowCommentBasicListWritable = {
data: Array<WorkflowCommentBasicWritable>
}
export type WorkflowCommentMentionUsersPayloadWritable = {
users: Array<AccountWithRoleWritable>
}
export type WorkflowCommentDetailWritable = {
content: string
created_at?: number | null
@ -3012,6 +3110,21 @@ export type WorkflowCommentBasicWritable = {
updated_at?: number | null
}
export type AccountWithRoleWritable = {
avatar?: string | null
created_at?: number | null
email: string
id: string
last_active_at?: number | null
last_login_at?: number | null
name: string
role: string
roles?: Array<{
[key: string]: string
}>
status: string
}
export type WorkflowCommentAccountWritable = {
email: string
id: string

View File

@ -654,27 +654,6 @@ export const zSyncDraftWorkflowResponse = z.object({
updated_at: z.string().optional(),
})
/**
* ConversationVariableUpdatePayload
*/
export const zConversationVariableUpdatePayload = z.object({
conversation_variables: z.array(z.record(z.string(), z.unknown())),
})
/**
* EnvironmentVariableUpdatePayload
*/
export const zEnvironmentVariableUpdatePayload = z.object({
environment_variables: z.array(z.record(z.string(), z.unknown())),
})
/**
* WorkflowFeaturesPayload
*/
export const zWorkflowFeaturesPayload = z.object({
features: z.record(z.string(), z.unknown()),
})
/**
* HumanInputDeliveryTestPayload
*/
@ -1737,6 +1716,7 @@ export const zSandboxUploadResponse = z.object({
*/
export const zAccountWithRole = z.object({
avatar: z.string().nullish(),
avatar_url: z.string().nullable(),
created_at: z.int().nullish(),
email: z.string(),
id: z.string(),
@ -1966,6 +1946,24 @@ export const zWorkflowPaginationResponse = z.object({
page: z.int(),
})
/**
* ConversationVariableItemPayload
*/
export const zConversationVariableItemPayload = z.object({
description: z.string().nullish(),
id: z.string().nullish(),
name: z.string().nullish(),
value: z.unknown().nullish(),
value_type: z.string().nullish(),
})
/**
* ConversationVariableUpdatePayload
*/
export const zConversationVariableUpdatePayload = z.object({
conversation_variables: z.array(zConversationVariableItemPayload),
})
/**
* EnvironmentVariableItemResponse
*/
@ -1989,6 +1987,24 @@ export const zEnvironmentVariableListResponse = z.object({
items: z.array(zEnvironmentVariableItemResponse),
})
/**
* EnvironmentVariableItemPayload
*/
export const zEnvironmentVariableItemPayload = z.object({
description: z.string().nullish(),
id: z.string().nullish(),
name: z.string().nullish(),
value: z.unknown().nullish(),
value_type: z.string().nullish(),
})
/**
* EnvironmentVariableUpdatePayload
*/
export const zEnvironmentVariableUpdatePayload = z.object({
environment_variables: z.array(zEnvironmentVariableItemPayload),
})
/**
* AgentConfigSnapshotSummaryResponse
*/
@ -2668,6 +2684,41 @@ export const zWorkflowArchivedLogPaginationResponse = z.object({
total: z.int(),
})
/**
* WorkflowFeatureTogglePayload
*/
export const zWorkflowFeatureTogglePayload = z.object({
enabled: z.boolean().nullish(),
})
/**
* WorkflowSensitiveWordAvoidancePayload
*/
export const zWorkflowSensitiveWordAvoidancePayload = z.object({
config: z.record(z.string(), z.unknown()).nullish(),
enabled: z.boolean().nullish(),
type: z.string().nullish(),
})
/**
* WorkflowSuggestedQuestionsAfterAnswerPayload
*/
export const zWorkflowSuggestedQuestionsAfterAnswerPayload = z.object({
enabled: z.boolean().nullish(),
model: z.record(z.string(), z.unknown()).nullish(),
prompt: z.string().nullish(),
})
/**
* WorkflowTextToSpeechPayload
*/
export const zWorkflowTextToSpeechPayload = z.object({
autoPlay: z.string().nullish(),
enabled: z.boolean().nullish(),
language: z.string().nullish(),
voice: z.string().nullish(),
})
/**
* AgentScope
*
@ -2937,6 +2988,72 @@ export const zHumanInputFormSubmissionData = z.object({
submitted_data: z.record(z.string(), zJsonValue2).nullish(),
})
/**
* WorkflowFileUploadTransferPayload
*/
export const zWorkflowFileUploadTransferPayload = z.object({
enabled: z.boolean().nullish(),
number_limits: z.int().nullish(),
transfer_methods: z.array(z.string()).nullish(),
})
/**
* WorkflowFileUploadImagePayload
*/
export const zWorkflowFileUploadImagePayload = z.object({
detail: z.string().nullish(),
enabled: z.boolean().nullish(),
number_limits: z.int().nullish(),
transfer_methods: z.array(z.string()).nullish(),
})
/**
* WorkflowFileUploadPreviewConfigPayload
*/
export const zWorkflowFileUploadPreviewConfigPayload = z.object({
file_type_list: z.array(z.string()).nullish(),
mode: z.string().nullish(),
})
/**
* WorkflowFileUploadPayload
*/
export const zWorkflowFileUploadPayload = z.object({
allowed_file_extensions: z.array(z.string()).nullish(),
allowed_file_types: z.array(z.string()).nullish(),
allowed_file_upload_methods: z.array(z.string()).nullish(),
audio: zWorkflowFileUploadTransferPayload.nullish(),
custom: zWorkflowFileUploadTransferPayload.nullish(),
document: zWorkflowFileUploadTransferPayload.nullish(),
enabled: z.boolean().nullish(),
fileUploadConfig: z.record(z.string(), z.unknown()).nullish(),
image: zWorkflowFileUploadImagePayload.nullish(),
number_limits: z.int().nullish(),
preview_config: zWorkflowFileUploadPreviewConfigPayload.nullish(),
video: zWorkflowFileUploadTransferPayload.nullish(),
})
/**
* WorkflowFeaturesConfigPayload
*/
export const zWorkflowFeaturesConfigPayload = z.object({
file_upload: zWorkflowFileUploadPayload.nullish(),
opening_statement: z.string().nullish(),
retriever_resource: zWorkflowFeatureTogglePayload.nullish(),
sensitive_word_avoidance: zWorkflowSensitiveWordAvoidancePayload.nullish(),
speech_to_text: zWorkflowFeatureTogglePayload.nullish(),
suggested_questions: z.array(z.string()).nullish(),
suggested_questions_after_answer: zWorkflowSuggestedQuestionsAfterAnswerPayload.nullish(),
text_to_speech: zWorkflowTextToSpeechPayload.nullish(),
})
/**
* WorkflowFeaturesPayload
*/
export const zWorkflowFeaturesPayload = z.object({
features: zWorkflowFeaturesConfigPayload,
})
/**
* AgentFeatureToggleConfig
*/
@ -4017,6 +4134,29 @@ export const zAppDetailWithSiteWritable = z.object({
workflow: zWorkflowPartial.nullish(),
})
/**
* AccountWithRole
*/
export const zAccountWithRoleWritable = z.object({
avatar: z.string().nullish(),
created_at: z.int().nullish(),
email: z.string(),
id: z.string(),
last_active_at: z.int().nullish(),
last_login_at: z.int().nullish(),
name: z.string(),
role: z.string(),
roles: z.array(z.record(z.string(), z.string())).optional(),
status: z.string(),
})
/**
* WorkflowCommentMentionUsersPayload
*/
export const zWorkflowCommentMentionUsersPayloadWritable = z.object({
users: z.array(zAccountWithRoleWritable),
})
/**
* WorkflowCommentAccount
*/

View File

@ -4,14 +4,18 @@ export type ClientOptions = {
baseUrl: `${string}://${string}/console/api` | (string & {})
}
export type BillingResponse = {
[key: string]: unknown
export type BillingInvoiceResponse = {
url: string
}
export type PartnerTenantsPayload = {
click_id: string
}
export type BillingResponse = {
[key: string]: unknown
}
export type GetBillingInvoicesData = {
body?: never
path?: never
@ -20,7 +24,7 @@ export type GetBillingInvoicesData = {
}
export type GetBillingInvoicesResponses = {
200: BillingResponse
200: BillingInvoiceResponse
}
export type GetBillingInvoicesResponse

View File

@ -3,9 +3,11 @@
import * as z from 'zod'
/**
* BillingResponse
* BillingInvoiceResponse
*/
export const zBillingResponse = z.record(z.string(), z.unknown())
export const zBillingInvoiceResponse = z.object({
url: z.string(),
})
/**
* PartnerTenantsPayload
@ -14,10 +16,15 @@ export const zPartnerTenantsPayload = z.object({
click_id: z.string(),
})
/**
* BillingResponse
*/
export const zBillingResponse = z.record(z.string(), z.unknown())
/**
* Success
*/
export const zGetBillingInvoicesResponse = zBillingResponse
export const zGetBillingInvoicesResponse = zBillingInvoiceResponse
export const zPutBillingPartnersByPartnerKeyTenantsBody = zPartnerTenantsPayload

View File

@ -14,7 +14,13 @@ export type LearnDifyAppListResponse = {
}
export type RecommendedAppDetailResponse = {
[key: string]: unknown
can_trial?: boolean | null
export_data: string
icon?: string | null
icon_background?: string | null
id: string
mode: string
name: string
}
export type BannerListResponse = Array<BannerResponse>

View File

@ -5,7 +5,15 @@ import * as z from 'zod'
/**
* RecommendedAppDetailResponse
*/
export const zRecommendedAppDetailResponse = z.record(z.string(), z.unknown())
export const zRecommendedAppDetailResponse = z.object({
can_trial: z.boolean().nullish(),
export_data: z.string(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
id: z.string(),
mode: z.string(),
name: z.string(),
})
/**
* BannerResponse

View File

@ -8,6 +8,7 @@ import {
zGetFilesByFileIdPreviewResponse,
zGetFilesSupportTypeResponse,
zGetFilesUploadResponse,
zPostFilesUploadBody,
zPostFilesUploadResponse,
} from './zod.gen'
@ -44,6 +45,7 @@ export const post = oc
successStatus: 201,
tags: ['console'],
})
.input(z.object({ body: zPostFilesUploadBody }))
.output(zPostFilesUploadResponse)
export const upload = {

View File

@ -71,7 +71,10 @@ export type GetFilesUploadResponses = {
export type GetFilesUploadResponse = GetFilesUploadResponses[keyof GetFilesUploadResponses]
export type PostFilesUploadData = {
body?: never
body: {
file: Blob | File
source?: 'datasets'
}
path?: never
query?: never
url: '/files/upload'

View File

@ -63,6 +63,11 @@ export const zGetFilesSupportTypeResponse = zAllowedExtensionsResponse
*/
export const zGetFilesUploadResponse = zUploadConfig
export const zPostFilesUploadBody = z.object({
file: z.custom<Blob | File>(),
source: z.enum(['datasets']).optional(),
})
/**
* File uploaded successfully
*/

View File

@ -21,8 +21,10 @@ import {
zDeleteWorkspacesCurrentModelProvidersByProviderModelsResponse,
zDeleteWorkspacesCurrentRbacAccessPoliciesByPolicyIdPath,
zDeleteWorkspacesCurrentRbacAccessPoliciesByPolicyIdResponse,
zDeleteWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdMemberBindingsBody,
zDeleteWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdMemberBindingsPath,
zDeleteWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdMemberBindingsResponse,
zDeleteWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdMemberBindingsBody,
zDeleteWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdMemberBindingsPath,
zDeleteWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdMemberBindingsResponse,
zDeleteWorkspacesCurrentRbacRolesByRoleIdPath,
@ -106,8 +108,10 @@ import {
zGetWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdRoleBindingsPath,
zGetWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdRoleBindingsResponse,
zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyPath,
zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyQuery,
zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyResponse,
zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesPath,
zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesQuery,
zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesResponse,
zGetWorkspacesCurrentRbacAppsByAppIdWhitelistPath,
zGetWorkspacesCurrentRbacAppsByAppIdWhitelistResponse,
@ -116,8 +120,10 @@ import {
zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdRoleBindingsPath,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdRoleBindingsResponse,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyPath,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyQuery,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyResponse,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesPath,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesQuery,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesResponse,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistPath,
zGetWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistResponse,
@ -390,20 +396,27 @@ import {
zPutWorkspacesCurrentRbacAccessPolicyBindingsByBindingIdLockResponse,
zPutWorkspacesCurrentRbacAccessPolicyBindingsByBindingIdUnlockPath,
zPutWorkspacesCurrentRbacAccessPolicyBindingsByBindingIdUnlockResponse,
zPutWorkspacesCurrentRbacAppsByAppIdUsersByTargetAccountIdAccessPoliciesBody,
zPutWorkspacesCurrentRbacAppsByAppIdUsersByTargetAccountIdAccessPoliciesPath,
zPutWorkspacesCurrentRbacAppsByAppIdUsersByTargetAccountIdAccessPoliciesResponse,
zPutWorkspacesCurrentRbacAppsByAppIdWhitelistBody,
zPutWorkspacesCurrentRbacAppsByAppIdWhitelistPath,
zPutWorkspacesCurrentRbacAppsByAppIdWhitelistResponse,
zPutWorkspacesCurrentRbacDatasetsByDatasetIdUsersByTargetAccountIdAccessPoliciesBody,
zPutWorkspacesCurrentRbacDatasetsByDatasetIdUsersByTargetAccountIdAccessPoliciesPath,
zPutWorkspacesCurrentRbacDatasetsByDatasetIdUsersByTargetAccountIdAccessPoliciesResponse,
zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistBody,
zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistPath,
zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistResponse,
zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesBody,
zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesPath,
zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesResponse,
zPutWorkspacesCurrentRbacRolesByRoleIdPath,
zPutWorkspacesCurrentRbacRolesByRoleIdResponse,
zPutWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdBindingsBody,
zPutWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdBindingsPath,
zPutWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdBindingsResponse,
zPutWorkspacesCurrentRbacWorkspaceDatasetsAccessPoliciesByPolicyIdBindingsBody,
zPutWorkspacesCurrentRbacWorkspaceDatasetsAccessPoliciesByPolicyIdBindingsPath,
zPutWorkspacesCurrentRbacWorkspaceDatasetsAccessPoliciesByPolicyIdBindingsResponse,
zPutWorkspacesCurrentToolProviderMcpBody,
@ -2229,6 +2242,7 @@ export const delete10 = oc
})
.input(
z.object({
body: zDeleteWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdMemberBindingsBody,
params: zDeleteWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdMemberBindingsPath,
}),
)
@ -2290,7 +2304,12 @@ export const get37 = oc
path: '/workspaces/current/rbac/apps/{app_id}/access-policy',
tags: ['console'],
})
.input(z.object({ params: zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyPath }))
.input(
z.object({
params: zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyPath,
query: zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyQuery.optional(),
}),
)
.output(zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyResponse)
export const accessPolicy = {
@ -2305,7 +2324,12 @@ export const get38 = oc
path: '/workspaces/current/rbac/apps/{app_id}/user-access-policies',
tags: ['console'],
})
.input(z.object({ params: zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesPath }))
.input(
z.object({
params: zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesPath,
query: zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesQuery.optional(),
}),
)
.output(zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesResponse)
export const userAccessPolicies = {
@ -2322,6 +2346,7 @@ export const put7 = oc
})
.input(
z.object({
body: zPutWorkspacesCurrentRbacAppsByAppIdUsersByTargetAccountIdAccessPoliciesBody,
params: zPutWorkspacesCurrentRbacAppsByAppIdUsersByTargetAccountIdAccessPoliciesPath,
}),
)
@ -2358,7 +2383,12 @@ export const put8 = oc
path: '/workspaces/current/rbac/apps/{app_id}/whitelist',
tags: ['console'],
})
.input(z.object({ params: zPutWorkspacesCurrentRbacAppsByAppIdWhitelistPath }))
.input(
z.object({
body: zPutWorkspacesCurrentRbacAppsByAppIdWhitelistBody,
params: zPutWorkspacesCurrentRbacAppsByAppIdWhitelistPath,
}),
)
.output(zPutWorkspacesCurrentRbacAppsByAppIdWhitelistResponse)
export const whitelist = {
@ -2389,6 +2419,7 @@ export const delete11 = oc
})
.input(
z.object({
body: zDeleteWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdMemberBindingsBody,
params:
zDeleteWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdMemberBindingsPath,
}),
@ -2457,7 +2488,12 @@ export const get42 = oc
path: '/workspaces/current/rbac/datasets/{dataset_id}/access-policy',
tags: ['console'],
})
.input(z.object({ params: zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyPath }))
.input(
z.object({
params: zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyPath,
query: zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyQuery.optional(),
}),
)
.output(zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyResponse)
export const accessPolicy2 = {
@ -2472,7 +2508,12 @@ export const get43 = oc
path: '/workspaces/current/rbac/datasets/{dataset_id}/user-access-policies',
tags: ['console'],
})
.input(z.object({ params: zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesPath }))
.input(
z.object({
params: zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesPath,
query: zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesQuery.optional(),
}),
)
.output(zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesResponse)
export const userAccessPolicies2 = {
@ -2489,6 +2530,7 @@ export const put9 = oc
})
.input(
z.object({
body: zPutWorkspacesCurrentRbacDatasetsByDatasetIdUsersByTargetAccountIdAccessPoliciesBody,
params: zPutWorkspacesCurrentRbacDatasetsByDatasetIdUsersByTargetAccountIdAccessPoliciesPath,
}),
)
@ -2525,7 +2567,12 @@ export const put10 = oc
path: '/workspaces/current/rbac/datasets/{dataset_id}/whitelist',
tags: ['console'],
})
.input(z.object({ params: zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistPath }))
.input(
z.object({
body: zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistBody,
params: zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistPath,
}),
)
.output(zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistResponse)
export const whitelist2 = {
@ -2564,7 +2611,12 @@ export const put11 = oc
path: '/workspaces/current/rbac/members/{member_id}/rbac-roles',
tags: ['console'],
})
.input(z.object({ params: zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesPath }))
.input(
z.object({
body: zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesBody,
params: zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesPath,
}),
)
.output(zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesResponse)
export const rbacRoles = {
@ -2751,6 +2803,7 @@ export const put13 = oc
})
.input(
z.object({
body: zPutWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdBindingsBody,
params: zPutWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdBindingsPath,
}),
)
@ -2837,6 +2890,7 @@ export const put14 = oc
})
.input(
z.object({
body: zPutWorkspacesCurrentRbacWorkspaceDatasetsAccessPoliciesByPolicyIdBindingsBody,
params: zPutWorkspacesCurrentRbacWorkspaceDatasetsAccessPoliciesByPolicyIdBindingsPath,
}),
)

View File

@ -433,11 +433,13 @@ export type ParserLatest = {
}
export type PluginInstallationsResponse = {
plugins: unknown
plugins: Array<PluginInstallationItemResponse>
}
export type PluginVersionsResponse = {
versions: unknown
versions: {
[key: string]: LatestPluginCache | null
}
}
export type PluginDynamicOptionsResponse = {
@ -530,6 +532,10 @@ export type AccessPolicyBindingState = {
is_locked?: boolean
}
export type DeleteMemberBindingsRequest = {
account_ids?: Array<string>
}
export type MemberBindingsResponse = {
data?: Array<AccessPolicyMemberBinding>
}
@ -548,6 +554,10 @@ export type ResourceUserAccessPoliciesResponse = {
scope: string
}
export type ReplaceUserAccessPolicies = {
access_policy_ids?: Array<string>
}
export type ReplaceUserAccessPoliciesResponse = {
access_policies?: Array<AccessPolicy>
}
@ -556,6 +566,10 @@ export type ResourceWhitelist = {
account_ids?: Array<string>
}
export type ResourceAccessScopeRequest = {
scope: RbacResourceWhitelistScope
}
export type DatasetAccessMatrix = {
dataset_id?: string
items?: Array<AccessMatrixItem>
@ -566,6 +580,10 @@ export type MemberRolesResponse = {
roles?: Array<RbacRole>
}
export type ReplaceMemberRolesRequest = {
role_ids?: Array<string>
}
export type MyPermissionsResponse = {
app?: ResourcePermissionSnapshot
dataset?: ResourcePermissionSnapshot
@ -598,6 +616,11 @@ export type MembersInRoleList = {
pagination?: Pagination | null
}
export type ReplaceBindingsRequest = {
account_ids?: Array<string>
role_ids?: Array<string>
}
export type AccessMatrixItem = {
accounts?: Array<AccessPolicyAccount>
policy?: AccessPolicy | null
@ -781,7 +804,21 @@ export type WorkflowToolUpdatePayload = {
workflow_tool_id: string
}
export type TriggerProviderOpaqueResponse = unknown
export type TriggerProviderApiEntity = {
author: string
description: I18nObject
events: Array<EventApiEntity>
icon?: string | null
icon_dark?: string | null
label: I18nObject
name: string
plugin_id?: string | null
plugin_unique_identifier?: string | null
subscription_constructor?: SubscriptionConstructor | null
subscription_schema?: Array<ProviderConfig>
supported_creation_methods?: Array<TriggerCreationMethod>
tags?: Array<string>
}
export type TriggerOAuthClientResponse = {
configured: boolean
@ -815,22 +852,57 @@ export type TriggerSubscriptionBuilderUpdatePayload = {
} | null
}
export type TriggerProviderOpaqueResponse = unknown
export type TriggerSubscriptionBuilderCreatePayload = {
credential_type?: string
}
export type TriggerSubscriptionBuilderCreateResponse = {
subscription_builder: SubscriptionBuilderApiEntity
}
export type TriggerSubscriptionBuilderLogsResponse = {
logs: Array<RequestLog>
}
export type SubscriptionBuilderApiEntity = {
credential_type: CredentialType
credentials: {
[key: string]: string
}
endpoint: string
id: string
name: string
parameters: {
[key: string]: unknown
}
properties: {
[key: string]: unknown
}
provider: string
}
export type TriggerSubscriptionBuilderVerifyPayload = {
credentials: {
[key: string]: unknown
}
}
export type TriggerSubscriptionBuilderVerifyResponse = {
verified: boolean
}
export type TriggerSubscriptionListResponse = Array<TriggerProviderSubscriptionApiEntity>
export type TriggerOAuthAuthorizeResponse = {
authorization_url: string
subscription_builder: unknown
subscription_builder: SubscriptionBuilderApiEntity
subscription_builder_id: string
}
export type TriggerProviderListResponse = Array<TriggerProviderApiEntity>
export type WorkspaceCustomConfigPayload = {
remove_webapp_brand?: boolean | null
replace_webapp_logo?: string | null
@ -923,6 +995,7 @@ export type AnonymousInlineModel7B8B49Ca164e = {
export type AccountWithRole = {
avatar?: string | null
readonly avatar_url: string | null
created_at?: number | null
email: string
id: string
@ -1058,6 +1131,36 @@ export type PluginAutoUpgradeSettingsResponseModel = {
upgrade_time_of_day: number
}
export type PluginInstallationItemResponse = {
checksum: string
created_at: string
declaration: {
[key: string]: unknown
}
endpoints_active: number
endpoints_setups: number
id: string
meta: {
[key: string]: unknown
}
plugin_id: string
plugin_unique_identifier: string
runtime_type: string
source: PluginInstallationSource
tenant_id: string
updated_at: string
version: string
}
export type LatestPluginCache = {
alternative_plugin_id: string
deprecated_reason: string
plugin_id: string
status: string
unique_identifier: string
version: string
}
export type DebugPermission = 'admins' | 'everyone' | 'noone'
export type InstallPermission = 'admins' | 'everyone' | 'noone'
@ -1148,6 +1251,8 @@ export type ResourceUserAccessPolicies = {
roles?: Array<RbacRole>
}
export type RbacResourceWhitelistScope = 'all' | 'only_me' | 'specific'
export type ResourcePermissionSnapshot = {
default_permission_keys?: Array<string>
overrides?: Array<ResourcePermissionKeys>
@ -1198,6 +1303,75 @@ export type WorkflowToolParameterConfiguration = {
name: string
}
export type I18nObject = {
en_US: string
ja_JP?: string | null
pt_BR?: string | null
zh_Hans?: string | null
}
export type EventApiEntity = {
description: I18nObject
identity: EventIdentity
name: string
output_schema: {
[key: string]: unknown
} | null
parameters: Array<EventParameter>
}
export type SubscriptionConstructor = {
credentials_schema?: Array<ProviderConfig>
oauth_schema?: OAuthSchema | null
parameters?: Array<EventParameter>
}
export type ProviderConfig = {
default?: number | string | number | boolean | null
help?: I18nObject | null
label?: I18nObject | null
multiple?: boolean
name: string
options?: Array<Option> | null
placeholder?: I18nObject | null
required?: boolean
scope?: AppSelectorScope | ModelSelectorScope | ToolSelectorScope | null
type: CoreEntitiesProviderEntitiesBasicProviderConfigType
url?: string | null
}
export type TriggerCreationMethod = 'APIKEY' | 'MANUAL' | 'OAUTH'
export type RequestLog = {
created_at: string
endpoint: string
id: string
request: {
[key: string]: unknown
}
response: {
[key: string]: unknown
}
}
export type TriggerProviderSubscriptionApiEntity = {
credential_type: CredentialType
credentials: {
[key: string]: unknown
}
endpoint: string
id: string
name: string
parameters: {
[key: string]: unknown
}
properties: {
[key: string]: unknown
}
provider: string
workflows_in_use: number
}
export type SimpleProviderEntityResponse = {
icon_small?: I18nObject | null
icon_small_dark?: I18nObject | null
@ -1220,13 +1394,6 @@ export type CustomConfigurationResponse = {
status: CustomConfigurationStatus
}
export type I18nObject = {
en_US: string
ja_JP?: string | null
pt_BR?: string | null
zh_Hans?: string | null
}
export type ProviderHelpEntity = {
title: GraphonModelRuntimeEntitiesCommonEntitiesI18nObject
url: GraphonModelRuntimeEntitiesCommonEntitiesI18nObject
@ -1312,6 +1479,8 @@ export type StrategySetting = 'disabled' | 'fix_only' | 'latest'
export type UpgradeMode = 'all' | 'exclude' | 'partial'
export type PluginInstallationSource = 'github' | 'marketplace' | 'package' | 'remote'
export type CoreToolsEntitiesCommonEntitiesI18nObject = {
en_US: string
ja_JP?: string | null
@ -1383,8 +1552,6 @@ export type PluginDeclarationResponse = {
version: string
}
export type PluginInstallationSource = 'github' | 'marketplace' | 'package' | 'remote'
export type RbacRoleAccount = {
account_id: string
account_name?: string
@ -1405,6 +1572,62 @@ export type PermissionCatalogItem = {
export type ToolParameterForm = 'form' | 'llm' | 'schema'
export type EventIdentity = {
author: string
label: I18nObject
name: string
provider?: string | null
}
export type EventParameter = {
auto_generate?: PluginParameterAutoGenerate | null
default?: number | number | string | Array<unknown> | null
description?: I18nObject | null
label: I18nObject
max?: number | number | null
min?: number | number | null
multiple?: boolean
name: string
options?: Array<PluginParameterOption> | null
precision?: number | null
required?: boolean
scope?: string | null
template?: PluginParameterTemplate | null
type: EventParameterType
}
export type OAuthSchema = {
client_schema?: Array<ProviderConfig>
credentials_schema?: Array<ProviderConfig>
}
export type Option = {
label: I18nObject
value: string
}
export type AppSelectorScope = 'all' | 'chat' | 'completion' | 'workflow'
export type ModelSelectorScope
= | 'llm'
| 'moderation'
| 'rerank'
| 'speech2text'
| 'text-embedding'
| 'tts'
| 'vision'
export type ToolSelectorScope = 'all' | 'builtin' | 'custom' | 'workflow'
export type CoreEntitiesProviderEntitiesBasicProviderConfigType
= | 'app-selector'
| 'array[tools]'
| 'boolean'
| 'model-selector'
| 'secret-input'
| 'select'
| 'text-input'
export type AiModelEntityResponse = {
deprecated?: boolean
features?: Array<ModelFeature> | null
@ -1483,6 +1706,34 @@ export type ProviderEntityResponse = {
supported_model_types: Array<ModelType>
}
export type PluginParameterAutoGenerate = {
type: CorePluginEntitiesParametersPluginParameterAutoGenerateType
}
export type PluginParameterOption = {
icon?: string | null
label: I18nObject
value: string
}
export type PluginParameterTemplate = {
enabled?: boolean
}
export type EventParameterType
= | 'app-selector'
| 'array'
| 'boolean'
| 'checkbox'
| 'dynamic-select'
| 'file'
| 'files'
| 'model-selector'
| 'number'
| 'object'
| 'select'
| 'string'
export type PriceConfigResponse = {
currency: string
input: string
@ -1511,6 +1762,27 @@ export type RestrictModel = {
model_type: ModelType
}
export type CorePluginEntitiesParametersPluginParameterAutoGenerateType = 'prompt_instruction'
export type AccountWithRoleListWritable = {
accounts: Array<AccountWithRoleWritable>
}
export type AccountWithRoleWritable = {
avatar?: string | null
created_at?: number | null
email: string
id: string
last_active_at?: number | null
last_login_at?: number | null
name: string
role: string
roles?: Array<{
[key: string]: string
}>
status: string
}
export type GetWorkspacesData = {
body?: never
path?: never
@ -3111,7 +3383,7 @@ export type PutWorkspacesCurrentRbacAccessPolicyBindingsByBindingIdUnlockRespons
= PutWorkspacesCurrentRbacAccessPolicyBindingsByBindingIdUnlockResponses[keyof PutWorkspacesCurrentRbacAccessPolicyBindingsByBindingIdUnlockResponses]
export type DeleteWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdMemberBindingsData = {
body?: never
body: DeleteMemberBindingsRequest
path: {
app_id: string
policy_id: string
@ -3167,7 +3439,9 @@ export type GetWorkspacesCurrentRbacAppsByAppIdAccessPolicyData = {
path: {
app_id: string
}
query?: never
query?: {
language?: 'en' | 'ja' | 'zh'
}
url: '/workspaces/current/rbac/apps/{app_id}/access-policy'
}
@ -3183,7 +3457,9 @@ export type GetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesData = {
path: {
app_id: string
}
query?: never
query?: {
language?: 'en' | 'ja' | 'zh'
}
url: '/workspaces/current/rbac/apps/{app_id}/user-access-policies'
}
@ -3195,7 +3471,7 @@ export type GetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesResponse
= GetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesResponses[keyof GetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesResponses]
export type PutWorkspacesCurrentRbacAppsByAppIdUsersByTargetAccountIdAccessPoliciesData = {
body?: never
body: ReplaceUserAccessPolicies
path: {
app_id: string
target_account_id: string
@ -3228,7 +3504,7 @@ export type GetWorkspacesCurrentRbacAppsByAppIdWhitelistResponse
= GetWorkspacesCurrentRbacAppsByAppIdWhitelistResponses[keyof GetWorkspacesCurrentRbacAppsByAppIdWhitelistResponses]
export type PutWorkspacesCurrentRbacAppsByAppIdWhitelistData = {
body?: never
body: ResourceAccessScopeRequest
path: {
app_id: string
}
@ -3245,7 +3521,7 @@ export type PutWorkspacesCurrentRbacAppsByAppIdWhitelistResponse
export type DeleteWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdMemberBindingsData
= {
body?: never
body: DeleteMemberBindingsRequest
path: {
dataset_id: string
policy_id: string
@ -3304,7 +3580,9 @@ export type GetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyData = {
path: {
dataset_id: string
}
query?: never
query?: {
language?: 'en' | 'ja' | 'zh'
}
url: '/workspaces/current/rbac/datasets/{dataset_id}/access-policy'
}
@ -3320,7 +3598,9 @@ export type GetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesData =
path: {
dataset_id: string
}
query?: never
query?: {
language?: 'en' | 'ja' | 'zh'
}
url: '/workspaces/current/rbac/datasets/{dataset_id}/user-access-policies'
}
@ -3332,7 +3612,7 @@ export type GetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesRespons
= GetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesResponses[keyof GetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesResponses]
export type PutWorkspacesCurrentRbacDatasetsByDatasetIdUsersByTargetAccountIdAccessPoliciesData = {
body?: never
body: ReplaceUserAccessPolicies
path: {
dataset_id: string
target_account_id: string
@ -3366,7 +3646,7 @@ export type GetWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistResponse
= GetWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistResponses[keyof GetWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistResponses]
export type PutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistData = {
body?: never
body: ResourceAccessScopeRequest
path: {
dataset_id: string
}
@ -3398,7 +3678,7 @@ export type GetWorkspacesCurrentRbacMembersByMemberIdRbacRolesResponse
= GetWorkspacesCurrentRbacMembersByMemberIdRbacRolesResponses[keyof GetWorkspacesCurrentRbacMembersByMemberIdRbacRolesResponses]
export type PutWorkspacesCurrentRbacMembersByMemberIdRbacRolesData = {
body?: never
body: ReplaceMemberRolesRequest
path: {
member_id: string
}
@ -3578,7 +3858,7 @@ export type GetWorkspacesCurrentRbacRolesByRoleIdMembersResponse
= GetWorkspacesCurrentRbacRolesByRoleIdMembersResponses[keyof GetWorkspacesCurrentRbacRolesByRoleIdMembersResponses]
export type PutWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdBindingsData = {
body?: never
body: ReplaceBindingsRequest
path: {
policy_id: string
}
@ -3640,7 +3920,7 @@ export type GetWorkspacesCurrentRbacWorkspaceAppsAccessPolicyResponse
= GetWorkspacesCurrentRbacWorkspaceAppsAccessPolicyResponses[keyof GetWorkspacesCurrentRbacWorkspaceAppsAccessPolicyResponses]
export type PutWorkspacesCurrentRbacWorkspaceDatasetsAccessPoliciesByPolicyIdBindingsData = {
body?: never
body: ReplaceBindingsRequest
path: {
policy_id: string
}
@ -4327,7 +4607,7 @@ export type GetWorkspacesCurrentTriggerProviderByProviderInfoData = {
}
export type GetWorkspacesCurrentTriggerProviderByProviderInfoResponses = {
200: TriggerProviderOpaqueResponse
200: TriggerProviderApiEntity
}
export type GetWorkspacesCurrentTriggerProviderByProviderInfoResponse
@ -4410,7 +4690,7 @@ export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderCr
}
export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderCreateResponses = {
200: TriggerProviderOpaqueResponse
200: TriggerSubscriptionBuilderCreateResponse
}
export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderCreateResponse
@ -4429,7 +4709,7 @@ export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderLog
export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderLogsBySubscriptionBuilderIdResponses
= {
200: TriggerProviderOpaqueResponse
200: TriggerSubscriptionBuilderLogsResponse
}
export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderLogsBySubscriptionBuilderIdResponse
@ -4448,7 +4728,7 @@ export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderUp
export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderUpdateBySubscriptionBuilderIdResponses
= {
200: TriggerProviderOpaqueResponse
200: SubscriptionBuilderApiEntity
}
export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderUpdateBySubscriptionBuilderIdResponse
@ -4467,7 +4747,7 @@ export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderVe
export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderVerifyAndUpdateBySubscriptionBuilderIdResponses
= {
200: TriggerProviderOpaqueResponse
200: TriggerSubscriptionBuilderVerifyResponse
}
export type PostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderVerifyAndUpdateBySubscriptionBuilderIdResponse
@ -4486,7 +4766,7 @@ export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderByS
export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBySubscriptionBuilderIdResponses
= {
200: TriggerProviderOpaqueResponse
200: SubscriptionBuilderApiEntity
}
export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBySubscriptionBuilderIdResponse
@ -4502,7 +4782,7 @@ export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsListData =
}
export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsListResponses = {
200: TriggerProviderOpaqueResponse
200: TriggerSubscriptionListResponse
}
export type GetWorkspacesCurrentTriggerProviderByProviderSubscriptionsListResponse
@ -4583,7 +4863,7 @@ export type GetWorkspacesCurrentTriggersData = {
}
export type GetWorkspacesCurrentTriggersResponses = {
200: TriggerProviderOpaqueResponse
200: TriggerProviderListResponse
}
export type GetWorkspacesCurrentTriggersResponse

View File

@ -366,20 +366,6 @@ export const zParserLatest = z.object({
plugin_ids: z.array(z.string()),
})
/**
* PluginInstallationsResponse
*/
export const zPluginInstallationsResponse = z.object({
plugins: z.unknown(),
})
/**
* PluginVersionsResponse
*/
export const zPluginVersionsResponse = z.object({
versions: z.unknown(),
})
/**
* PluginDynamicOptionsResponse
*/
@ -480,6 +466,20 @@ export const zAccessPolicyBindingState = z.object({
is_locked: z.boolean().optional().default(false),
})
/**
* _DeleteMemberBindingsRequest
*/
export const zDeleteMemberBindingsRequest = z.object({
account_ids: z.array(z.string()).optional(),
})
/**
* ReplaceUserAccessPolicies
*/
export const zReplaceUserAccessPolicies = z.object({
access_policy_ids: z.array(z.string()).optional(),
})
/**
* ReplaceUserAccessPoliciesResponse
*/
@ -494,6 +494,13 @@ export const zResourceWhitelist = z.object({
account_ids: z.array(z.string()).optional(),
})
/**
* _ReplaceMemberRolesRequest
*/
export const zReplaceMemberRolesRequest = z.object({
role_ids: z.array(z.string()).optional().default([]),
})
/**
* RBACRole
*/
@ -517,6 +524,14 @@ export const zMemberRolesResponse = z.object({
roles: z.array(zRbacRole).optional(),
})
/**
* _ReplaceBindingsRequest
*/
export const zReplaceBindingsRequest = z.object({
account_ids: z.array(z.string()).optional(),
role_ids: z.array(z.string()).optional(),
})
/**
* ToolProviderOpaqueResponse
*/
@ -599,11 +614,6 @@ export const zWorkflowToolDeletePayload = z.object({
workflow_tool_id: z.string(),
})
/**
* TriggerProviderOpaqueResponse
*/
export const zTriggerProviderOpaqueResponse = z.unknown()
/**
* TriggerOAuthClientResponse
*/
@ -635,6 +645,11 @@ export const zTriggerSubscriptionBuilderUpdatePayload = z.object({
properties: z.record(z.string(), z.unknown()).nullish(),
})
/**
* TriggerProviderOpaqueResponse
*/
export const zTriggerProviderOpaqueResponse = z.unknown()
/**
* TriggerSubscriptionBuilderCreatePayload
*/
@ -650,12 +665,10 @@ export const zTriggerSubscriptionBuilderVerifyPayload = z.object({
})
/**
* TriggerOAuthAuthorizeResponse
* TriggerSubscriptionBuilderVerifyResponse
*/
export const zTriggerOAuthAuthorizeResponse = z.object({
authorization_url: z.string(),
subscription_builder: z.unknown(),
subscription_builder_id: z.string(),
export const zTriggerSubscriptionBuilderVerifyResponse = z.object({
verified: z.boolean(),
})
/**
@ -893,6 +906,7 @@ export const zSnippetPagination = z.object({
*/
export const zAccountWithRole = z.object({
avatar: z.string().nullish(),
avatar_url: z.string().nullable(),
created_at: z.int().nullish(),
email: z.string(),
id: z.string(),
@ -1093,6 +1107,25 @@ export const zParserExcludePlugin = z.object({
plugin_id: z.string(),
})
/**
* LatestPluginCache
*/
export const zLatestPluginCache = z.object({
alternative_plugin_id: z.string(),
deprecated_reason: z.string(),
plugin_id: z.string(),
status: z.string(),
unique_identifier: z.string(),
version: z.string(),
})
/**
* PluginVersionsResponse
*/
export const zPluginVersionsResponse = z.object({
versions: z.record(z.string(), zLatestPluginCache.nullable()),
})
/**
* DebugPermission
*/
@ -1187,6 +1220,20 @@ export const zRoleBindingsResponse = z.object({
data: z.array(zAccessPolicyRoleBinding).optional(),
})
/**
* RBACResourceWhitelistScope
*
* Whitelist scopes accepted by RBAC app and dataset access config APIs.
*/
export const zRbacResourceWhitelistScope = z.enum(['all', 'only_me', 'specific'])
/**
* _ResourceAccessScopeRequest
*/
export const zResourceAccessScopeRequest = z.object({
scope: zRbacResourceWhitelistScope,
})
/**
* WorkspacePermissionSnapshot
*/
@ -1334,6 +1381,36 @@ export const zBuiltinToolAddPayload = z.object({
visibility: z.string().nullish(),
})
/**
* SubscriptionBuilderApiEntity
*/
export const zSubscriptionBuilderApiEntity = z.object({
credential_type: zCredentialType,
credentials: z.record(z.string(), z.string()),
endpoint: z.string(),
id: z.string(),
name: z.string(),
parameters: z.record(z.string(), z.unknown()),
properties: z.record(z.string(), z.unknown()),
provider: z.string(),
})
/**
* TriggerSubscriptionBuilderCreateResponse
*/
export const zTriggerSubscriptionBuilderCreateResponse = z.object({
subscription_builder: zSubscriptionBuilderApiEntity,
})
/**
* TriggerOAuthAuthorizeResponse
*/
export const zTriggerOAuthAuthorizeResponse = z.object({
authorization_url: z.string(),
subscription_builder: zSubscriptionBuilderApiEntity,
subscription_builder_id: z.string(),
})
/**
* IdentityMode
*
@ -1374,13 +1451,6 @@ export const zMcpProviderUpdatePayload = z.object({
server_url: z.string(),
})
/**
* ConfigurateMethod
*
* Enum class for configurate method of provider model.
*/
export const zConfigurateMethod = z.enum(['customizable-model', 'predefined-model'])
/**
* I18nObject
*
@ -1393,6 +1463,56 @@ export const zI18nObject = z.object({
zh_Hans: z.string().nullish(),
})
/**
* TriggerCreationMethod
*/
export const zTriggerCreationMethod = z.enum(['APIKEY', 'MANUAL', 'OAUTH'])
/**
* RequestLog
*/
export const zRequestLog = z.object({
created_at: z.iso.datetime(),
endpoint: z.string(),
id: z.string(),
request: z.record(z.string(), z.unknown()),
response: z.record(z.string(), z.unknown()),
})
/**
* TriggerSubscriptionBuilderLogsResponse
*/
export const zTriggerSubscriptionBuilderLogsResponse = z.object({
logs: z.array(zRequestLog),
})
/**
* TriggerProviderSubscriptionApiEntity
*/
export const zTriggerProviderSubscriptionApiEntity = z.object({
credential_type: zCredentialType,
credentials: z.record(z.string(), z.unknown()),
endpoint: z.string(),
id: z.string(),
name: z.string(),
parameters: z.record(z.string(), z.unknown()),
properties: z.record(z.string(), z.unknown()),
provider: z.string(),
workflows_in_use: z.int(),
})
/**
* TriggerSubscriptionListResponse
*/
export const zTriggerSubscriptionListResponse = z.array(zTriggerProviderSubscriptionApiEntity)
/**
* ConfigurateMethod
*
* Enum class for configurate method of provider model.
*/
export const zConfigurateMethod = z.enum(['customizable-model', 'predefined-model'])
/**
* ProviderType
*/
@ -1604,6 +1724,38 @@ export const zPluginAutoUpgradeFetchResponse = z.object({
category: zPluginCategory,
})
/**
* PluginInstallationSource
*/
export const zPluginInstallationSource = z.enum(['github', 'marketplace', 'package', 'remote'])
/**
* PluginInstallationItemResponse
*/
export const zPluginInstallationItemResponse = z.object({
checksum: z.string(),
created_at: z.iso.datetime(),
declaration: z.record(z.string(), z.unknown()),
endpoints_active: z.int(),
endpoints_setups: z.int(),
id: z.string(),
meta: z.record(z.string(), z.unknown()),
plugin_id: z.string(),
plugin_unique_identifier: z.string(),
runtime_type: z.string(),
source: zPluginInstallationSource,
tenant_id: z.string(),
updated_at: z.iso.datetime(),
version: z.string(),
})
/**
* PluginInstallationsResponse
*/
export const zPluginInstallationsResponse = z.object({
plugins: z.array(zPluginInstallationItemResponse),
})
/**
* I18nObject
*
@ -1665,11 +1817,6 @@ export const zPluginCategoryBuiltinToolProviderResponse = z.object({
type: zToolProviderType,
})
/**
* PluginInstallationSource
*/
export const zPluginInstallationSource = z.enum(['github', 'marketplace', 'package', 'remote'])
/**
* RBACRoleAccount
*/
@ -1792,6 +1939,91 @@ export const zWorkflowToolUpdatePayload = z.object({
workflow_tool_id: z.string(),
})
/**
* EventIdentity
*
* The identity of the event
*/
export const zEventIdentity = z.object({
author: z.string(),
label: zI18nObject,
name: z.string(),
provider: z.string().nullish(),
})
/**
* Option
*/
export const zOption = z.object({
label: zI18nObject,
value: z.string(),
})
/**
* AppSelectorScope
*/
export const zAppSelectorScope = z.enum(['all', 'chat', 'completion', 'workflow'])
/**
* ModelSelectorScope
*/
export const zModelSelectorScope = z.enum([
'llm',
'moderation',
'rerank',
'speech2text',
'text-embedding',
'tts',
'vision',
])
/**
* ToolSelectorScope
*/
export const zToolSelectorScope = z.enum(['all', 'builtin', 'custom', 'workflow'])
/**
* Type
*/
export const zCoreEntitiesProviderEntitiesBasicProviderConfigType = z.enum([
'app-selector',
'array[tools]',
'boolean',
'model-selector',
'secret-input',
'select',
'text-input',
])
/**
* ProviderConfig
*
* Model class for common provider settings like credentials
*/
export const zProviderConfig = z.object({
default: z.union([z.int(), z.string(), z.number(), z.boolean()]).nullish(),
help: zI18nObject.nullish(),
label: zI18nObject.nullish(),
multiple: z.boolean().optional().default(false),
name: z.string(),
options: z.array(zOption).nullish(),
placeholder: zI18nObject.nullish(),
required: z.boolean().optional().default(false),
scope: z.union([zAppSelectorScope, zModelSelectorScope, zToolSelectorScope]).nullish(),
type: zCoreEntitiesProviderEntitiesBasicProviderConfigType,
url: z.string().nullish(),
})
/**
* OAuthSchema
*
* OAuth schema
*/
export const zOAuthSchema = z.object({
client_schema: z.array(zProviderConfig).optional(),
credentials_schema: z.array(zProviderConfig).optional(),
})
/**
* UnaddedModelConfiguration
*
@ -1844,6 +2076,42 @@ export const zFieldModelSchema = z.object({
*/
export const zProviderQuotaType = z.enum(['free', 'paid', 'trial'])
/**
* PluginParameterOption
*/
export const zPluginParameterOption = z.object({
icon: z.string().nullish(),
label: zI18nObject,
value: z.string(),
})
/**
* PluginParameterTemplate
*/
export const zPluginParameterTemplate = z.object({
enabled: z.boolean().optional().default(false),
})
/**
* EventParameterType
*
* The type of the parameter
*/
export const zEventParameterType = z.enum([
'app-selector',
'array',
'boolean',
'checkbox',
'dynamic-select',
'file',
'files',
'model-selector',
'number',
'object',
'select',
'string',
])
/**
* PriceConfigResponse
*
@ -2147,6 +2415,111 @@ export const zModelProviderListResponse = z.object({
data: z.array(zProviderResponse),
})
/**
* Type
*/
export const zCorePluginEntitiesParametersPluginParameterAutoGenerateType = z.enum([
'prompt_instruction',
])
/**
* PluginParameterAutoGenerate
*/
export const zPluginParameterAutoGenerate = z.object({
type: zCorePluginEntitiesParametersPluginParameterAutoGenerateType,
})
/**
* EventParameter
*
* The parameter of the event
*/
export const zEventParameter = z.object({
auto_generate: zPluginParameterAutoGenerate.nullish(),
default: z.union([z.int(), z.number(), z.string(), z.array(z.unknown())]).nullish(),
description: zI18nObject.nullish(),
label: zI18nObject,
max: z.union([z.number(), z.int()]).nullish(),
min: z.union([z.number(), z.int()]).nullish(),
multiple: z.boolean().optional().default(false),
name: z.string(),
options: z.array(zPluginParameterOption).nullish(),
precision: z.int().nullish(),
required: z.boolean().optional().default(false),
scope: z.string().nullish(),
template: zPluginParameterTemplate.nullish(),
type: zEventParameterType,
})
/**
* EventApiEntity
*/
export const zEventApiEntity = z.object({
description: zI18nObject,
identity: zEventIdentity,
name: z.string(),
output_schema: z.record(z.string(), z.unknown()).nullable(),
parameters: z.array(zEventParameter),
})
/**
* SubscriptionConstructor
*
* The subscription constructor of the trigger provider
*/
export const zSubscriptionConstructor = z.object({
credentials_schema: z.array(zProviderConfig).optional(),
oauth_schema: zOAuthSchema.nullish(),
parameters: z.array(zEventParameter).optional(),
})
/**
* TriggerProviderApiEntity
*/
export const zTriggerProviderApiEntity = z.object({
author: z.string(),
description: zI18nObject,
events: z.array(zEventApiEntity),
icon: z.string().nullish(),
icon_dark: z.string().nullish(),
label: zI18nObject,
name: z.string(),
plugin_id: z.string().nullish().default(''),
plugin_unique_identifier: z.string().nullish().default(''),
subscription_constructor: zSubscriptionConstructor.nullish(),
subscription_schema: z.array(zProviderConfig).optional(),
supported_creation_methods: z.array(zTriggerCreationMethod).optional(),
tags: z.array(z.string()).optional(),
})
/**
* TriggerProviderListResponse
*/
export const zTriggerProviderListResponse = z.array(zTriggerProviderApiEntity)
/**
* AccountWithRole
*/
export const zAccountWithRoleWritable = z.object({
avatar: z.string().nullish(),
created_at: z.int().nullish(),
email: z.string(),
id: z.string(),
last_active_at: z.int().nullish(),
last_login_at: z.int().nullish(),
name: z.string(),
role: z.string(),
roles: z.array(z.record(z.string(), z.string())).optional(),
status: z.string(),
})
/**
* AccountWithRoleList
*/
export const zAccountWithRoleListWritable = z.object({
accounts: z.array(zAccountWithRoleWritable),
})
/**
* Success
*/
@ -3060,6 +3433,9 @@ export const zPutWorkspacesCurrentRbacAccessPolicyBindingsByBindingIdUnlockPath
export const zPutWorkspacesCurrentRbacAccessPolicyBindingsByBindingIdUnlockResponse
= zAccessPolicyBindingState
export const zDeleteWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdMemberBindingsBody
= zDeleteMemberBindingsRequest
export const zDeleteWorkspacesCurrentRbacAppsByAppIdAccessPoliciesByPolicyIdMemberBindingsPath
= z.object({
app_id: z.uuid(),
@ -3100,6 +3476,10 @@ export const zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyPath = z.object({
app_id: z.uuid(),
})
export const zGetWorkspacesCurrentRbacAppsByAppIdAccessPolicyQuery = z.object({
language: z.enum(['en', 'ja', 'zh']).optional(),
})
/**
* Success
*/
@ -3109,12 +3489,19 @@ export const zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesPath = z.obje
app_id: z.uuid(),
})
export const zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesQuery = z.object({
language: z.enum(['en', 'ja', 'zh']).optional(),
})
/**
* Success
*/
export const zGetWorkspacesCurrentRbacAppsByAppIdUserAccessPoliciesResponse
= zResourceUserAccessPoliciesResponse
export const zPutWorkspacesCurrentRbacAppsByAppIdUsersByTargetAccountIdAccessPoliciesBody
= zReplaceUserAccessPolicies
export const zPutWorkspacesCurrentRbacAppsByAppIdUsersByTargetAccountIdAccessPoliciesPath
= z.object({
app_id: z.uuid(),
@ -3136,6 +3523,8 @@ export const zGetWorkspacesCurrentRbacAppsByAppIdWhitelistPath = z.object({
*/
export const zGetWorkspacesCurrentRbacAppsByAppIdWhitelistResponse = zResourceWhitelist
export const zPutWorkspacesCurrentRbacAppsByAppIdWhitelistBody = zResourceAccessScopeRequest
export const zPutWorkspacesCurrentRbacAppsByAppIdWhitelistPath = z.object({
app_id: z.uuid(),
})
@ -3145,6 +3534,9 @@ export const zPutWorkspacesCurrentRbacAppsByAppIdWhitelistPath = z.object({
*/
export const zPutWorkspacesCurrentRbacAppsByAppIdWhitelistResponse = zResourceWhitelist
export const zDeleteWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdMemberBindingsBody
= zDeleteMemberBindingsRequest
export const zDeleteWorkspacesCurrentRbacDatasetsByDatasetIdAccessPoliciesByPolicyIdMemberBindingsPath
= z.object({
dataset_id: z.uuid(),
@ -3185,6 +3577,10 @@ export const zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyPath = z.ob
dataset_id: z.uuid(),
})
export const zGetWorkspacesCurrentRbacDatasetsByDatasetIdAccessPolicyQuery = z.object({
language: z.enum(['en', 'ja', 'zh']).optional(),
})
/**
* Success
*/
@ -3194,12 +3590,19 @@ export const zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesPath
dataset_id: z.uuid(),
})
export const zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesQuery = z.object({
language: z.enum(['en', 'ja', 'zh']).optional(),
})
/**
* Success
*/
export const zGetWorkspacesCurrentRbacDatasetsByDatasetIdUserAccessPoliciesResponse
= zResourceUserAccessPoliciesResponse
export const zPutWorkspacesCurrentRbacDatasetsByDatasetIdUsersByTargetAccountIdAccessPoliciesBody
= zReplaceUserAccessPolicies
export const zPutWorkspacesCurrentRbacDatasetsByDatasetIdUsersByTargetAccountIdAccessPoliciesPath
= z.object({
dataset_id: z.uuid(),
@ -3221,6 +3624,8 @@ export const zGetWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistPath = z.objec
*/
export const zGetWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistResponse = zResourceWhitelist
export const zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistBody = zResourceAccessScopeRequest
export const zPutWorkspacesCurrentRbacDatasetsByDatasetIdWhitelistPath = z.object({
dataset_id: z.uuid(),
})
@ -3239,6 +3644,8 @@ export const zGetWorkspacesCurrentRbacMembersByMemberIdRbacRolesPath = z.object(
*/
export const zGetWorkspacesCurrentRbacMembersByMemberIdRbacRolesResponse = zMemberRolesResponse
export const zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesBody = zReplaceMemberRolesRequest
export const zPutWorkspacesCurrentRbacMembersByMemberIdRbacRolesPath = z.object({
member_id: z.uuid(),
})
@ -3324,6 +3731,9 @@ export const zGetWorkspacesCurrentRbacRolesByRoleIdMembersPath = z.object({
*/
export const zGetWorkspacesCurrentRbacRolesByRoleIdMembersResponse = zMembersInRoleList
export const zPutWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdBindingsBody
= zReplaceBindingsRequest
export const zPutWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdBindingsPath = z.object({
policy_id: z.uuid(),
})
@ -3361,6 +3771,9 @@ export const zGetWorkspacesCurrentRbacWorkspaceAppsAccessPoliciesByPolicyIdRoleB
*/
export const zGetWorkspacesCurrentRbacWorkspaceAppsAccessPolicyResponse = zWorkspaceAccessMatrix
export const zPutWorkspacesCurrentRbacWorkspaceDatasetsAccessPoliciesByPolicyIdBindingsBody
= zReplaceBindingsRequest
export const zPutWorkspacesCurrentRbacWorkspaceDatasetsAccessPoliciesByPolicyIdBindingsPath
= z.object({
policy_id: z.uuid(),
@ -3762,8 +4175,7 @@ export const zGetWorkspacesCurrentTriggerProviderByProviderInfoPath = z.object({
/**
* Success
*/
export const zGetWorkspacesCurrentTriggerProviderByProviderInfoResponse
= zTriggerProviderOpaqueResponse
export const zGetWorkspacesCurrentTriggerProviderByProviderInfoResponse = zTriggerProviderApiEntity
export const zDeleteWorkspacesCurrentTriggerProviderByProviderOauthClientPath = z.object({
provider: z.string(),
@ -3825,7 +4237,7 @@ export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilder
* Success
*/
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderCreateResponse
= zTriggerProviderOpaqueResponse
= zTriggerSubscriptionBuilderCreateResponse
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderLogsBySubscriptionBuilderIdPath
= z.object({
@ -3837,7 +4249,7 @@ export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderL
* Success
*/
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderLogsBySubscriptionBuilderIdResponse
= zTriggerProviderOpaqueResponse
= zTriggerSubscriptionBuilderLogsResponse
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderUpdateBySubscriptionBuilderIdBody
= zTriggerSubscriptionBuilderUpdatePayload
@ -3852,7 +4264,7 @@ export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilder
* Success
*/
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderUpdateBySubscriptionBuilderIdResponse
= zTriggerProviderOpaqueResponse
= zSubscriptionBuilderApiEntity
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderVerifyAndUpdateBySubscriptionBuilderIdBody
= zTriggerSubscriptionBuilderVerifyPayload
@ -3867,7 +4279,7 @@ export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilder
* Success
*/
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderVerifyAndUpdateBySubscriptionBuilderIdResponse
= zTriggerProviderOpaqueResponse
= zTriggerSubscriptionBuilderVerifyResponse
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBySubscriptionBuilderIdPath
= z.object({
@ -3879,7 +4291,7 @@ export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderB
* Success
*/
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBySubscriptionBuilderIdResponse
= zTriggerProviderOpaqueResponse
= zSubscriptionBuilderApiEntity
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsListPath = z.object({
provider: z.string(),
@ -3889,7 +4301,7 @@ export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsListPath
* Success
*/
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsListResponse
= zTriggerProviderOpaqueResponse
= zTriggerSubscriptionListResponse
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsOauthAuthorizePath
= z.object({
@ -3945,7 +4357,7 @@ export const zPostWorkspacesCurrentTriggerProviderBySubscriptionIdSubscriptionsU
/**
* Success
*/
export const zGetWorkspacesCurrentTriggersResponse = zTriggerProviderOpaqueResponse
export const zGetWorkspacesCurrentTriggersResponse = zTriggerProviderListResponse
export const zPostWorkspacesCustomConfigBody = zWorkspaceCustomConfigPayload

View File

@ -40,7 +40,9 @@ vi.mock('@/service/billing', () => ({
vi.mock('@/service/client', () => ({
consoleClient: {
billing: {
invoices: () => mockInvoices(),
invoices: {
get: () => mockInvoices(),
},
},
},
}))

View File

@ -41,7 +41,9 @@ vi.mock('@/service/billing', () => ({
vi.mock('@/service/client', () => ({
consoleClient: {
billing: {
invoices: vi.fn().mockResolvedValue({ url: 'https://invoice.example.com' }),
invoices: {
get: vi.fn().mockResolvedValue({ url: 'https://invoice.example.com' }),
},
},
},
}))

View File

@ -22,17 +22,17 @@ export type SuggestedQuestionsAfterAnswer = EnabledOrDisabled & {
prompt?: string
}
export type TextToSpeech = EnabledOrDisabled & {
type TextToSpeech = EnabledOrDisabled & {
language?: string
voice?: string
autoPlay?: TtsAutoPlay
}
export type SpeechToText = EnabledOrDisabled
type SpeechToText = EnabledOrDisabled
export type RetrieverResource = EnabledOrDisabled
type RetrieverResource = EnabledOrDisabled
export type SensitiveWordAvoidance = EnabledOrDisabled & {
type SensitiveWordAvoidance = EnabledOrDisabled & {
type?: string
config?: any
}

View File

@ -27,7 +27,9 @@ vi.mock('@/service/billing', () => ({
vi.mock('@/service/client', () => ({
consoleClient: {
billing: {
invoices: vi.fn(),
invoices: {
get: vi.fn(),
},
},
},
}))
@ -45,7 +47,7 @@ vi.mock('../../../assets', () => ({
const mockUseAppContext = useAppContext as Mock
const mockUseProviderContext = useProviderContext as Mock
const mockUseAsyncWindowOpen = useAsyncWindowOpen as Mock
const mockBillingInvoices = consoleClient.billing.invoices as Mock
const mockBillingInvoices = consoleClient.billing.invoices.get as Mock
const mockFetchSubscriptionUrls = fetchSubscriptionUrls as Mock
let assignedHref = ''

View File

@ -99,7 +99,7 @@ const CloudPlanItem: FC<CloudPlanItemProps> = ({
}
await openAsyncWindow(async () => {
const res = await consoleClient.billing.invoices()
const res = await consoleClient.billing.invoices.get()
if (res.url)
return res.url
throw new Error('Failed to open billing page')

View File

@ -1,4 +1,4 @@
import type { WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { WorkflowCommentList } from '@/app/components/workflow/comment/types'
import { fireEvent, render, screen } from '@testing-library/react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { CommentIcon } from './comment-icon'
@ -56,6 +56,7 @@ const createComment = (overrides: Partial<WorkflowCommentList> = {}): WorkflowCo
id: 'user-1',
name: 'Alice',
email: 'alice@example.com',
avatar_url: null,
},
created_at: 1,
updated_at: 2,

View File

@ -1,7 +1,7 @@
'use client'
import type { FC, PointerEvent as ReactPointerEvent } from 'react'
import type { WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { WorkflowCommentList } from '@/app/components/workflow/comment/types'
import { memo, useCallback, useMemo, useRef, useState } from 'react'
import { useReactFlow, useViewport } from 'reactflow'
import { UserAvatarList } from '@/app/components/base/user-avatar-list'

View File

@ -1,4 +1,4 @@
import type { WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { WorkflowCommentList } from '@/app/components/workflow/comment/types'
import { fireEvent, render, screen } from '@testing-library/react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import CommentPreview from './comment-preview'
@ -27,8 +27,8 @@ vi.mock('../store', () => ({
}))
const createComment = (overrides: Partial<WorkflowCommentList> = {}): WorkflowCommentList => {
const author = { id: 'user-1', name: 'Alice', email: 'alice@example.com' }
const participant = { id: 'user-2', name: 'Bob', email: 'bob@example.com' }
const author = { id: 'user-1', name: 'Alice', email: 'alice@example.com', avatar_url: null }
const participant = { id: 'user-2', name: 'Bob', email: 'bob@example.com', avatar_url: null }
return {
id: 'comment-1',

View File

@ -1,7 +1,7 @@
'use client'
import type { FC } from 'react'
import type { WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { WorkflowCommentList } from '@/app/components/workflow/comment/types'
import { memo, useEffect, useMemo } from 'react'
import { UserAvatarList } from '@/app/components/base/user-avatar-list'
import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now'
@ -47,7 +47,7 @@ const CommentPreview: FC<CommentPreviewProps> = ({ comment, onClick }) => {
<div className="flex min-w-0 items-center gap-2">
<div className="truncate system-sm-medium text-text-primary">{authorName}</div>
<div className="shrink-0 system-2xs-regular text-text-tertiary">
{formatTimeFromNow(comment.updated_at * 1000)}
{formatTimeFromNow((comment.updated_at ?? comment.created_at ?? 0) * 1000)}
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
import type { UserProfile } from '@/contract/console/workflow-comment'
import type { UserProfile } from '@/app/components/workflow/comment/types'
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { useState } from 'react'
import { MentionInput } from './mention-input'
@ -32,8 +32,16 @@ vi.mock('@/next/navigation', () => ({
vi.mock('@/service/client', () => ({
consoleClient: {
workflowComments: {
mentionUsers: (...args: unknown[]) => mockFetchMentionableUsers(...args),
apps: {
byAppId: {
workflow: {
comments: {
mentionUsers: {
get: (...args: unknown[]) => mockFetchMentionableUsers(...args),
},
},
},
},
},
},
}))
@ -98,7 +106,7 @@ describe('MentionInput', () => {
await waitFor(() => {
expect(mockFetchMentionableUsers).toHaveBeenCalledWith({
params: { appId: 'app-1' },
params: { app_id: 'app-1' },
})
})

View File

@ -1,7 +1,7 @@
'use client'
import type { ReactNode } from 'react'
import type { UserProfile } from '@/contract/console/workflow-comment'
import type { UserProfile } from '@/app/components/workflow/comment/types'
import { Avatar } from '@langgenius/dify-ui/avatar'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
@ -165,8 +165,8 @@ const MentionInputInner = forwardRef<HTMLTextAreaElement, MentionInputProps>(({
state.setMentionableUsersLoading(appId, true)
try {
const response = await consoleClient.workflowComments.mentionUsers({
params: { appId },
const response = await consoleClient.apps.byAppId.workflow.comments.mentionUsers.get({
params: { app_id: appId },
})
workflowStore.getState().setMentionableUsersCache(appId, response.users)
}

View File

@ -1,4 +1,4 @@
import type { WorkflowCommentDetail } from '@/contract/console/workflow-comment'
import type { WorkflowCommentDetail } from '@/app/components/workflow/comment/types'
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
import { CommentThread } from './thread'

View File

@ -1,7 +1,7 @@
'use client'
import type { FC, ReactNode } from 'react'
import type { WorkflowCommentDetail, WorkflowCommentDetailReply } from '@/contract/console/workflow-comment'
import type { WorkflowCommentDetail, WorkflowCommentDetailReply } from '@/app/components/workflow/comment/types'
import { Avatar, AvatarFallback, AvatarImage, AvatarRoot } from '@langgenius/dify-ui/avatar'
import { cn } from '@langgenius/dify-ui/cn'
import {
@ -594,7 +594,7 @@ export const CommentThread: FC<CommentThreadProps> = memo(({
authorId={comment.created_by_account?.id || ''}
authorName={comment.created_by_account?.name || t('comments.fallback.user', { ns: 'workflow' })}
avatarUrl={comment.created_by_account?.avatar_url || null}
createdAt={comment.created_at}
createdAt={comment.created_at ?? comment.updated_at ?? 0}
content={comment.content}
mentionableNames={mentionableNames}
/>
@ -718,7 +718,7 @@ export const CommentThread: FC<CommentThreadProps> = memo(({
authorId={reply.created_by_account?.id || ''}
authorName={reply.created_by_account?.name || t('comments.fallback.user', { ns: 'workflow' })}
avatarUrl={reply.created_by_account?.avatar_url || null}
createdAt={reply.created_at}
createdAt={reply.created_at ?? 0}
content={reply.content}
mentionableNames={mentionableNames}
/>

View File

@ -0,0 +1,14 @@
import type {
AccountWithRole,
WorkflowCommentDetail as GeneratedWorkflowCommentDetail,
WorkflowCommentBasic,
WorkflowCommentReply,
} from '@dify/contracts/api/console/apps/types.gen'
export type UserProfile = Pick<AccountWithRole, 'id' | 'name' | 'email' | 'avatar_url'> & {
avatar_url?: string | null
}
export type WorkflowCommentList = WorkflowCommentBasic
export type WorkflowCommentDetail = GeneratedWorkflowCommentDetail
export type WorkflowCommentDetailReply = WorkflowCommentReply

View File

@ -1,4 +1,4 @@
import type { WorkflowCommentDetail, WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { WorkflowCommentDetail, WorkflowCommentList } from '@/app/components/workflow/comment/types'
import { act, waitFor } from '@testing-library/react'
import { createTestQueryClient, seedSystemFeatures } from '@/__tests__/utils/mock-system-features'
import { renderWorkflowHook } from '../../__tests__/workflow-test-env'
@ -59,17 +59,29 @@ vi.mock('@/service/client', () => ({
enable_collaboration_mode: globalFeatureState.enableCollaboration,
}),
},
workflowComments: {
create: (...args: unknown[]) => mockCreateWorkflowComment(...args),
delete: (...args: unknown[]) => mockDeleteWorkflowComment(...args),
detail: (...args: unknown[]) => mockFetchWorkflowComment(...args),
list: (...args: unknown[]) => mockFetchWorkflowComments(...args),
resolve: (...args: unknown[]) => mockResolveWorkflowComment(...args),
update: (...args: unknown[]) => mockUpdateWorkflowComment(...args),
replies: {
create: (...args: unknown[]) => mockCreateWorkflowCommentReply(...args),
delete: (...args: unknown[]) => mockDeleteWorkflowCommentReply(...args),
update: (...args: unknown[]) => mockUpdateWorkflowCommentReply(...args),
apps: {
byAppId: {
workflow: {
comments: {
get: (...args: unknown[]) => mockFetchWorkflowComments(...args),
post: (...args: unknown[]) => mockCreateWorkflowComment(...args),
byCommentId: {
delete: (...args: unknown[]) => mockDeleteWorkflowComment(...args),
get: (...args: unknown[]) => mockFetchWorkflowComment(...args),
put: (...args: unknown[]) => mockUpdateWorkflowComment(...args),
resolve: {
post: (...args: unknown[]) => mockResolveWorkflowComment(...args),
},
replies: {
post: (...args: unknown[]) => mockCreateWorkflowCommentReply(...args),
byReplyId: {
delete: (...args: unknown[]) => mockDeleteWorkflowCommentReply(...args),
put: (...args: unknown[]) => mockUpdateWorkflowCommentReply(...args),
},
},
},
},
},
},
},
},
@ -164,7 +176,7 @@ describe('useWorkflowComment', () => {
await waitFor(() => {
expect(mockFetchWorkflowComments).toHaveBeenCalledWith({
params: { appId: 'app-1' },
params: { app_id: 'app-1' },
})
})
@ -207,7 +219,7 @@ describe('useWorkflowComment', () => {
})
expect(mockCreateWorkflowComment).toHaveBeenCalledWith({
params: { appId: 'app-1' },
params: { app_id: 'app-1' },
body: {
position_x: 10,
position_y: 20,
@ -332,7 +344,7 @@ describe('useWorkflowComment', () => {
})
expect(mockUpdateWorkflowComment).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: comment.id },
params: { app_id: 'app-1', comment_id: comment.id },
body: {
content: 'hello',
position_x: 300,
@ -376,7 +388,7 @@ describe('useWorkflowComment', () => {
await waitFor(() => {
expect(mockFetchWorkflowComment).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: comment.id },
params: { app_id: 'app-1', comment_id: comment.id },
})
})
expect(mockFetchWorkflowComments).toHaveBeenCalledTimes(2)
@ -485,7 +497,7 @@ describe('useWorkflowComment', () => {
})
expect(mockResolveWorkflowComment).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: commentA.id },
params: { app_id: 'app-1', comment_id: commentA.id },
})
await act(async () => {
@ -495,21 +507,21 @@ describe('useWorkflowComment', () => {
})
expect(mockCreateWorkflowCommentReply).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: commentA.id },
params: { app_id: 'app-1', comment_id: commentA.id },
body: {
content: 'new reply',
mentioned_user_ids: ['user-2'],
},
})
expect(mockUpdateWorkflowCommentReply).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: commentA.id, replyId: 'reply-1' },
params: { app_id: 'app-1', comment_id: commentA.id, reply_id: 'reply-1' },
body: {
content: 'edited reply',
mentioned_user_ids: ['user-2'],
},
})
expect(mockDeleteWorkflowCommentReply).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: commentA.id, replyId: 'reply-1' },
params: { app_id: 'app-1', comment_id: commentA.id, reply_id: 'reply-1' },
})
await act(async () => {
@ -517,7 +529,7 @@ describe('useWorkflowComment', () => {
})
expect(mockDeleteWorkflowComment).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: commentA.id },
params: { app_id: 'app-1', comment_id: commentA.id },
})
await waitFor(() => {
expect(store.getState().activeCommentId).toBe(commentB.id)
@ -552,7 +564,7 @@ describe('useWorkflowComment', () => {
})
expect(mockCreateWorkflowCommentReply).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: 'comment-1' },
params: { app_id: 'app-1', comment_id: 'comment-1' },
body: {
content: 'new reply',
mentioned_user_ids: [],
@ -576,7 +588,7 @@ describe('useWorkflowComment', () => {
})
expect(mockUpdateWorkflowCommentReply).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: 'comment-1', replyId: 'reply-1' },
params: { app_id: 'app-1', comment_id: 'comment-1', reply_id: 'reply-1' },
body: {
content: 'updated reply',
mentioned_user_ids: [],
@ -600,7 +612,7 @@ describe('useWorkflowComment', () => {
})
expect(mockDeleteWorkflowCommentReply).toHaveBeenCalledWith({
params: { appId: 'app-1', commentId: 'comment-1', replyId: 'reply-1' },
params: { app_id: 'app-1', comment_id: 'comment-1', reply_id: 'reply-1' },
})
expect(store.getState().activeCommentDetailLoading).toBe(false)
})

View File

@ -1,4 +1,4 @@
import type { UserProfile, WorkflowCommentDetail, WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { UserProfile, WorkflowCommentDetail, WorkflowCommentList } from '@/app/components/workflow/comment/types'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useCallback, useEffect, useMemo, useRef } from 'react'
import { useReactFlow } from 'reactflow'
@ -12,7 +12,10 @@ import { ControlMode } from '../types'
const EMPTY_USERS: UserProfile[] = []
const normalizeTimestamp = (value: number | string): number => {
const normalizeTimestamp = (value: number | string | null | undefined): number => {
if (value == null)
return Math.floor(Date.now() / 1000)
if (typeof value === 'number')
return value
@ -84,8 +87,8 @@ export const useWorkflowComment = () => {
if (!appId)
return
const detail = await consoleClient.workflowComments.detail({
params: { appId, commentId },
const detail = await consoleClient.apps.byAppId.workflow.comments.byCommentId.get({
params: { app_id: appId, comment_id: commentId },
})
commentDetailCacheRef.current = {
@ -102,8 +105,8 @@ export const useWorkflowComment = () => {
setCommentsLoading(true)
try {
const response = await consoleClient.workflowComments.list({
params: { appId },
const response = await consoleClient.apps.byAppId.workflow.comments.get({
params: { app_id: appId },
})
setComments(response.data)
}
@ -150,8 +153,8 @@ export const useWorkflowComment = () => {
y: pendingComment.pageY,
})
const newComment = await consoleClient.workflowComments.create({
params: { appId },
const newComment = await consoleClient.apps.byAppId.workflow.comments.post({
params: { app_id: appId },
body: {
position_x: flowPosition.x,
position_y: flowPosition.y,
@ -165,7 +168,7 @@ export const useWorkflowComment = () => {
id: userProfile?.id ?? '',
name: userProfile?.name ?? '',
email: userProfile?.email ?? '',
avatar_url: userProfile?.avatar_url || userProfile?.avatar || undefined,
avatar_url: userProfile?.avatar_url || userProfile?.avatar || null,
}
const mentionedUsers = mentionedUserIds
.map(mentionedId => mentionableUserById.get(mentionedId))
@ -179,7 +182,7 @@ export const useWorkflowComment = () => {
id: user.id,
name: user.name,
email: user.email,
avatar_url: user.avatar_url,
avatar_url: user.avatar_url ?? null,
})
}
}
@ -284,8 +287,8 @@ export const useWorkflowComment = () => {
setActiveCommentLoading(!cachedDetail)
try {
const detail = await consoleClient.workflowComments.detail({
params: { appId, commentId: comment.id },
const detail = await consoleClient.apps.byAppId.workflow.comments.byCommentId.get({
params: { app_id: appId, comment_id: comment.id },
})
commentDetailCacheRef.current = {
@ -322,8 +325,8 @@ export const useWorkflowComment = () => {
setActiveCommentLoading(true)
try {
await consoleClient.workflowComments.resolve({
params: { appId, commentId },
await consoleClient.apps.byAppId.workflow.comments.byCommentId.resolve.post({
params: { app_id: appId, comment_id: commentId },
})
collaborationManager.emitCommentsUpdate(appId)
@ -345,8 +348,8 @@ export const useWorkflowComment = () => {
setActiveCommentLoading(true)
try {
await consoleClient.workflowComments.delete({
params: { appId, commentId },
await consoleClient.apps.byAppId.workflow.comments.byCommentId.delete({
params: { app_id: appId, comment_id: commentId },
})
collaborationManager.emitCommentsUpdate(appId)
@ -421,8 +424,8 @@ export const useWorkflowComment = () => {
}
try {
await consoleClient.workflowComments.update({
params: { appId, commentId },
await consoleClient.apps.byAppId.workflow.comments.byCommentId.put({
params: { app_id: appId, comment_id: commentId },
body: {
content: targetComment.content,
position_x: nextPosition.position_x,
@ -468,8 +471,8 @@ export const useWorkflowComment = () => {
return
try {
await consoleClient.workflowComments.update({
params: { appId, commentId },
await consoleClient.apps.byAppId.workflow.comments.byCommentId.put({
params: { app_id: appId, comment_id: commentId },
body: {
content: trimmed,
position_x: positionX,
@ -497,8 +500,8 @@ export const useWorkflowComment = () => {
setReplySubmitting(true)
try {
await consoleClient.workflowComments.replies.create({
params: { appId, commentId },
await consoleClient.apps.byAppId.workflow.comments.byCommentId.replies.post({
params: { app_id: appId, comment_id: commentId },
body: { content: trimmed, mentioned_user_ids: mentionedUserIds },
})
@ -524,8 +527,8 @@ export const useWorkflowComment = () => {
setReplyUpdating(true)
try {
await consoleClient.workflowComments.replies.update({
params: { appId, commentId, replyId },
await consoleClient.apps.byAppId.workflow.comments.byCommentId.replies.byReplyId.put({
params: { app_id: appId, comment_id: commentId, reply_id: replyId },
body: { content: trimmed, mentioned_user_ids: mentionedUserIds },
})
@ -548,8 +551,8 @@ export const useWorkflowComment = () => {
setActiveCommentLoading(true)
try {
await consoleClient.workflowComments.replies.delete({
params: { appId, commentId, replyId },
await consoleClient.apps.byAppId.workflow.comments.byCommentId.replies.byReplyId.delete({
params: { app_id: appId, comment_id: commentId, reply_id: replyId },
})
collaborationManager.emitCommentsUpdate(appId)

View File

@ -1,4 +1,4 @@
import type { WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { WorkflowCommentList } from '@/app/components/workflow/comment/types'
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
import CommentsPanel from '../index'

View File

@ -1,4 +1,4 @@
import type { WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { WorkflowCommentList } from '@/app/components/workflow/comment/types'
import { cn } from '@langgenius/dify-ui/cn'
import { Switch } from '@langgenius/dify-ui/switch'
import { RiCheckboxCircleFill, RiCheckboxCircleLine, RiCheckLine, RiCloseLine, RiFilter3Line } from '@remixicon/react'
@ -163,7 +163,7 @@ const CommentsPanel = () => {
<div className="flex min-w-0 items-center gap-2">
<div className="truncate system-sm-medium text-text-primary">{c.created_by_account?.name ?? ''}</div>
<div className="shrink-0 system-2xs-regular text-text-tertiary">
{formatTimeFromNow(c.updated_at * 1000)}
{formatTimeFromNow((c.updated_at ?? c.created_at ?? 0) * 1000)}
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
import type { StateCreator } from 'zustand'
import type { UserProfile, WorkflowCommentDetail, WorkflowCommentList } from '@/contract/console/workflow-comment'
import type { UserProfile, WorkflowCommentDetail, WorkflowCommentList } from '@/app/components/workflow/comment/types'
export type CommentSliceShape = {
comments: WorkflowCommentList[]

View File

@ -98,7 +98,7 @@ const EducationApplyAgeContent = () => {
setIsOpeningBillingPortal(true)
try {
await openAsyncWindow(async () => {
const res = await consoleClient.billing.invoices()
const res = await consoleClient.billing.invoices.get()
if (res.url)
return res.url

View File

@ -1,32 +0,0 @@
import { billing } from '@dify/contracts/api/console/billing/orpc.gen'
import { type } from '@orpc/contract'
import { base } from '../base'
export const invoicesContract = base
.route({
path: '/billing/invoices',
method: 'GET',
})
.input(type<unknown>())
.output(type<{ url: string }>())
export const bindPartnerStackContract = base
.route({
path: '/billing/partners/{partnerKey}/tenants',
method: 'PUT',
})
.input(type<{
params: {
partnerKey: string
}
body: {
click_id: string
}
}>())
.output(type<unknown>())
export const billingRouterContract = {
...billing,
invoices: invoicesContract,
bindPartnerStack: bindPartnerStackContract,
}

View File

@ -1,25 +0,0 @@
import type { PostFilesUploadResponse } from '@dify/contracts/api/console/files/types.gen'
import { files } from '@dify/contracts/api/console/files/orpc.gen'
import { type } from '@orpc/contract'
import { base } from '../base'
export const fileUploadContract = base
.route({
path: '/files/upload',
method: 'POST',
successStatus: 201,
})
.input(type<{
body: {
file: File
}
}>())
.output(type<PostFilesUploadResponse>())
export const filesRouterContract = {
...files,
upload: {
...files.upload,
post: fileUploadContract,
},
}

View File

@ -1,253 +0,0 @@
import type { CommonResponse } from '@/models/common'
import { type } from '@orpc/contract'
import { base } from '../base'
export type UserProfile = {
id: string
name: string
email: string
avatar_url?: string
}
export type WorkflowCommentList = {
id: string
position_x: number
position_y: number
content: string
created_by: string
created_by_account: UserProfile | null
created_at: number
updated_at: number
resolved: boolean
resolved_by?: string | null
resolved_by_account?: UserProfile | null
resolved_at?: number | null
mention_count: number
reply_count: number
participants: UserProfile[]
}
type WorkflowCommentDetailMention = {
mentioned_user_id: string
mentioned_user_account?: UserProfile | null
reply_id: string | null
}
export type WorkflowCommentDetailReply = {
id: string
content: string
created_by: string
created_by_account?: UserProfile | null
created_at: number
}
export type WorkflowCommentDetail = {
id: string
position_x: number
position_y: number
content: string
created_by: string
created_by_account: UserProfile | null
created_at: number
updated_at: number
resolved: boolean
resolved_by?: string | null
resolved_by_account?: UserProfile | null
resolved_at?: number | null
replies: WorkflowCommentDetailReply[]
mentions: WorkflowCommentDetailMention[]
}
type WorkflowCommentCreateRes = {
id: string
created_at: number
}
type WorkflowCommentUpdateRes = {
id: string
updated_at: number
}
type WorkflowCommentResolveRes = {
id: string
resolved: boolean
resolved_by: string
resolved_at: number
}
type WorkflowCommentReplyCreateRes = {
id: string
created_at: number
}
type WorkflowCommentReplyUpdateRes = {
id: string
updated_at: number
}
type CreateCommentParams = {
position_x: number
position_y: number
content: string
mentioned_user_ids?: string[]
}
type UpdateCommentParams = {
content: string
position_x?: number
position_y?: number
mentioned_user_ids?: string[]
}
type CreateReplyParams = {
content: string
mentioned_user_ids?: string[]
}
const workflowCommentListContract = base
.route({
path: '/apps/{appId}/workflow/comments',
method: 'GET',
})
.input(type<{
params: {
appId: string
}
}>())
.output(type<{ data: WorkflowCommentList[] }>())
const workflowCommentCreateContract = base
.route({
path: '/apps/{appId}/workflow/comments',
method: 'POST',
})
.input(type<{
params: {
appId: string
}
body: CreateCommentParams
}>())
.output(type<WorkflowCommentCreateRes>())
const workflowCommentDetailContract = base
.route({
path: '/apps/{appId}/workflow/comments/{commentId}',
method: 'GET',
})
.input(type<{
params: {
appId: string
commentId: string
}
}>())
.output(type<WorkflowCommentDetail>())
const workflowCommentUpdateContract = base
.route({
path: '/apps/{appId}/workflow/comments/{commentId}',
method: 'PUT',
})
.input(type<{
params: {
appId: string
commentId: string
}
body: UpdateCommentParams
}>())
.output(type<WorkflowCommentUpdateRes>())
const workflowCommentDeleteContract = base
.route({
path: '/apps/{appId}/workflow/comments/{commentId}',
method: 'DELETE',
})
.input(type<{
params: {
appId: string
commentId: string
}
}>())
.output(type<CommonResponse>())
const workflowCommentResolveContract = base
.route({
path: '/apps/{appId}/workflow/comments/{commentId}/resolve',
method: 'POST',
})
.input(type<{
params: {
appId: string
commentId: string
}
}>())
.output(type<WorkflowCommentResolveRes>())
const workflowCommentReplyCreateContract = base
.route({
path: '/apps/{appId}/workflow/comments/{commentId}/replies',
method: 'POST',
})
.input(type<{
params: {
appId: string
commentId: string
}
body: CreateReplyParams
}>())
.output(type<WorkflowCommentReplyCreateRes>())
const workflowCommentReplyUpdateContract = base
.route({
path: '/apps/{appId}/workflow/comments/{commentId}/replies/{replyId}',
method: 'PUT',
})
.input(type<{
params: {
appId: string
commentId: string
replyId: string
}
body: CreateReplyParams
}>())
.output(type<WorkflowCommentReplyUpdateRes>())
const workflowCommentReplyDeleteContract = base
.route({
path: '/apps/{appId}/workflow/comments/{commentId}/replies/{replyId}',
method: 'DELETE',
})
.input(type<{
params: {
appId: string
commentId: string
replyId: string
}
}>())
.output(type<CommonResponse>())
const workflowCommentMentionUsersContract = base
.route({
path: '/apps/{appId}/workflow/comments/mention-users',
method: 'GET',
})
.input(type<{
params: {
appId: string
}
}>())
.output(type<{ users: UserProfile[] }>())
export const workflowCommentContracts = {
list: workflowCommentListContract,
create: workflowCommentCreateContract,
detail: workflowCommentDetailContract,
update: workflowCommentUpdateContract,
delete: workflowCommentDeleteContract,
resolve: workflowCommentResolveContract,
mentionUsers: workflowCommentMentionUsersContract,
replies: {
create: workflowCommentReplyCreateContract,
update: workflowCommentReplyUpdateContract,
delete: workflowCommentReplyDeleteContract,
},
}

View File

@ -1,87 +0,0 @@
import type {
FileUpload,
RetrieverResource,
SensitiveWordAvoidance,
SpeechToText,
SuggestedQuestionsAfterAnswer,
TextToSpeech,
} from '@/app/components/base/features/types'
import type { ConversationVariable, EnvironmentVariable } from '@/app/components/workflow/types'
import type { CommonResponse } from '@/models/common'
import { type } from '@orpc/contract'
import { base } from '../base'
export type WorkflowDraftFeaturesPayload = {
opening_statement: string
suggested_questions: string[]
suggested_questions_after_answer?: SuggestedQuestionsAfterAnswer
text_to_speech?: TextToSpeech
speech_to_text?: SpeechToText
retriever_resource?: RetrieverResource
sensitive_word_avoidance?: SensitiveWordAvoidance
file_upload?: FileUpload
}
export const workflowDraftEnvironmentVariablesContract = base
.route({
path: '/apps/{appId}/workflows/draft/environment-variables',
method: 'GET',
})
.input(type<{
params: {
appId: string
}
}>())
.output(type<{ items: EnvironmentVariable[] }>())
export const workflowDraftUpdateEnvironmentVariablesContract = base
.route({
path: '/apps/{appId}/workflows/draft/environment-variables',
method: 'POST',
})
.input(type<{
params: {
appId: string
}
body: {
environment_variables: EnvironmentVariable[]
}
}>())
.output(type<CommonResponse>())
export const workflowDraftUpdateConversationVariablesContract = base
.route({
path: '/apps/{appId}/workflows/draft/conversation-variables',
method: 'POST',
})
.input(type<{
params: {
appId: string
}
body: {
conversation_variables: ConversationVariable[]
}
}>())
.output(type<CommonResponse>())
export const workflowDraftUpdateFeaturesContract = base
.route({
path: '/apps/{appId}/workflows/draft/features',
method: 'POST',
})
.input(type<{
params: {
appId: string
}
body: {
features: WorkflowDraftFeaturesPayload
}
}>())
.output(type<CommonResponse>())
export const workflowDraftRouterContract = {
environmentVariables: workflowDraftEnvironmentVariablesContract,
updateEnvironmentVariables: workflowDraftUpdateEnvironmentVariablesContract,
updateConversationVariables: workflowDraftUpdateConversationVariablesContract,
updateFeatures: workflowDraftUpdateFeaturesContract,
}

View File

@ -8,6 +8,7 @@ import { appDslVersion } from '@dify/contracts/api/console/app-dsl-version/orpc.
import { app } from '@dify/contracts/api/console/app/orpc.gen'
import { apps } from '@dify/contracts/api/console/apps/orpc.gen'
import { auth } from '@dify/contracts/api/console/auth/orpc.gen'
import { billing } from '@dify/contracts/api/console/billing/orpc.gen'
import { codeBasedExtension } from '@dify/contracts/api/console/code-based-extension/orpc.gen'
import { compliance } from '@dify/contracts/api/console/compliance/orpc.gen'
import { dataSource } from '@dify/contracts/api/console/data-source/orpc.gen'
@ -15,6 +16,7 @@ import { datasets } from '@dify/contracts/api/console/datasets/orpc.gen'
import { emailCodeLogin } from '@dify/contracts/api/console/email-code-login/orpc.gen'
import { emailRegister } from '@dify/contracts/api/console/email-register/orpc.gen'
import { features } from '@dify/contracts/api/console/features/orpc.gen'
import { files } from '@dify/contracts/api/console/files/orpc.gen'
import { forgotPassword } from '@dify/contracts/api/console/forgot-password/orpc.gen'
import { form } from '@dify/contracts/api/console/form/orpc.gen'
import { info } from '@dify/contracts/api/console/info/orpc.gen'
@ -44,16 +46,12 @@ import { workflow } from '@dify/contracts/api/console/workflow/orpc.gen'
import { workspaces } from '@dify/contracts/api/console/workspaces/orpc.gen'
import { contract as enterpriseContract } from '@dify/contracts/enterprise/orpc.gen'
import { rbacAccessConfigContract } from './console/access-control'
import { billingRouterContract } from './console/billing'
import { exploreRouterContract } from './console/explore'
import { filesRouterContract } from './console/files'
import { modelProvidersRouterContract } from './console/model-providers'
import { pluginsRouterContract } from './console/plugins'
import { snippetsRouterContract } from './console/snippets'
import { triggersRouterContract } from './console/trigger'
import { trialAppsRouterContract } from './console/try-app'
import { workflowDraftRouterContract } from './console/workflow'
import { workflowCommentContracts } from './console/workflow-comment'
const communityContract = {
account,
@ -66,6 +64,7 @@ const communityContract = {
appDslVersion,
apps,
auth,
billing,
codeBasedExtension,
compliance,
dataSource,
@ -73,6 +72,7 @@ const communityContract = {
emailCodeLogin,
emailRegister,
features,
files,
forgotPassword,
form,
info,
@ -105,15 +105,11 @@ const communityContract = {
export const consoleRouterContract = {
enterprise: enterpriseContract,
...communityContract,
billing: billingRouterContract,
explore: exploreRouterContract,
files: filesRouterContract,
modelProviders: modelProvidersRouterContract,
plugins: pluginsRouterContract,
rbacAccessConfig: rbacAccessConfigContract,
snippets: snippetsRouterContract,
triggers: triggersRouterContract,
trialApps: trialAppsRouterContract,
workflowComments: workflowCommentContracts,
workflowDraft: workflowDraftRouterContract,
}

View File

@ -12,10 +12,8 @@ async function loadGeneratedConsoleContract(segment: string) {
}
const customConsoleContractLoaders: Record<string, () => Promise<AnyContractRouter>> = {
billing: () => import('@/contract/console/billing').then(({ billingRouterContract }) => wrapConsoleContract('billing', billingRouterContract)),
enterprise: () => import('@dify/contracts/enterprise/orpc.gen').then(({ contract }) => wrapConsoleContract('enterprise', contract)),
explore: () => import('@/contract/console/explore').then(({ exploreRouterContract }) => wrapConsoleContract('explore', exploreRouterContract)),
files: () => import('@/contract/console/files').then(({ filesRouterContract }) => wrapConsoleContract('files', filesRouterContract)),
modelProviders: () =>
import('@/contract/console/model-providers').then(({ modelProvidersRouterContract }) => wrapConsoleContract('modelProviders', modelProvidersRouterContract)),
plugins: () => import('@/contract/console/plugins').then(({ pluginsRouterContract }) => wrapConsoleContract('plugins', pluginsRouterContract)),
@ -24,10 +22,6 @@ const customConsoleContractLoaders: Record<string, () => Promise<AnyContractRout
snippets: () => import('@/contract/console/snippets').then(({ snippetsRouterContract }) => wrapConsoleContract('snippets', snippetsRouterContract)),
triggers: () => import('@/contract/console/trigger').then(({ triggersRouterContract }) => wrapConsoleContract('triggers', triggersRouterContract)),
trialApps: () => import('@/contract/console/try-app').then(({ trialAppsRouterContract }) => wrapConsoleContract('trialApps', trialAppsRouterContract)),
workflowComments: () =>
import('@/contract/console/workflow-comment').then(({ workflowCommentContracts }) => wrapConsoleContract('workflowComments', workflowCommentContracts)),
workflowDraft: () =>
import('@/contract/console/workflow').then(({ workflowDraftRouterContract }) => wrapConsoleContract('workflowDraft', workflowDraftRouterContract)),
}
export async function loadConsoleContractForSegment(segment: string) {

View File

@ -6,9 +6,9 @@ const currentPlanVectorSpaceQueryKey = ['billing', 'current-plan-vector-space']
export const useBindPartnerStackInfo = () => {
return useMutation({
mutationKey: consoleQuery.billing.bindPartnerStack.mutationKey(),
mutationFn: (data: { partnerKey: string, clickId: string }) => consoleClient.billing.bindPartnerStack({
params: { partnerKey: data.partnerKey },
mutationKey: consoleQuery.billing.partners.byPartnerKey.tenants.put.mutationKey(),
mutationFn: (data: { partnerKey: string, clickId: string }) => consoleClient.billing.partners.byPartnerKey.tenants.put({
params: { partner_key: data.partnerKey },
body: { click_id: data.clickId },
}),
})
@ -16,10 +16,10 @@ export const useBindPartnerStackInfo = () => {
export const useBillingUrl = (enabled: boolean) => {
return useQuery({
queryKey: consoleQuery.billing.invoices.queryKey(),
queryKey: consoleQuery.billing.invoices.get.queryKey(),
enabled,
queryFn: async () => {
const res = await consoleClient.billing.invoices()
const res = await consoleClient.billing.invoices.get()
return res.url
},
})

View File

@ -1,5 +1,5 @@
import type { WorkflowFeaturesConfigPayload } from '@dify/contracts/api/console/apps/types.gen'
import type { BlockEnum, ConversationVariable, EnvironmentVariable } from '@/app/components/workflow/types'
import type { WorkflowDraftFeaturesPayload as ContractWorkflowDraftFeaturesPayload } from '@/contract/console/workflow'
import type { CommonResponse } from '@/models/common'
import type { FlowType } from '@/types/common'
import type {
@ -13,7 +13,7 @@ import { get, post } from './base'
import { consoleClient } from './client'
import { getFlowPrefix } from './utils'
export type WorkflowDraftFeaturesPayload = ContractWorkflowDraftFeaturesPayload
export type WorkflowDraftFeaturesPayload = WorkflowFeaturesConfigPayload
export const fetchWorkflowDraft = (url: string) => {
return get(url, {}, { silent: true }) as Promise<FetchWorkflowDraftResponse>
@ -104,8 +104,8 @@ export const updateEnvironmentVariables = ({ appId, environmentVariables }: {
appId: string
environmentVariables: EnvironmentVariable[]
}) => {
return consoleClient.workflowDraft.updateEnvironmentVariables({
params: { appId },
return consoleClient.apps.byAppId.workflows.draft.environmentVariables.post({
params: { app_id: appId },
body: { environment_variables: environmentVariables },
})
}
@ -114,18 +114,18 @@ export const updateConversationVariables = ({ appId, conversationVariables }: {
appId: string
conversationVariables: ConversationVariable[]
}) => {
return consoleClient.workflowDraft.updateConversationVariables({
params: { appId },
return consoleClient.apps.byAppId.workflows.draft.conversationVariables.post({
params: { app_id: appId },
body: { conversation_variables: conversationVariables },
})
}
export const updateFeatures = ({ appId, features }: {
appId: string
features: ContractWorkflowDraftFeaturesPayload
features: WorkflowDraftFeaturesPayload
}) => {
return consoleClient.workflowDraft.updateFeatures({
params: { appId },
return consoleClient.apps.byAppId.workflows.draft.features.post({
params: { app_id: appId },
body: { features },
})
}