Skip to content

armgit / dify

Public Imported from GitHub
0

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

refactor(api): migrate console explore endpoints to BaseModel (#37953)

chariri94c0967e3086
diff --git a/api/controllers/console/explore/completion.py b/api/controllers/console/explore/completion.py
index ef761c8febd..2f27827a0a6 100644
--- a/api/controllers/console/explore/completion.py
+++ b/api/controllers/console/explore/completion.py
@@ -7,7 +7,7 @@ from sqlalchemy.orm import Session
from werkzeug.exceptions import InternalServerError, NotFound
import services
-from controllers.common.fields import GeneratedAppResponse, SimpleResultResponse
+from controllers.common.fields import SimpleResultResponse
from controllers.common.schema import register_response_schema_models, register_schema_models
from controllers.console.app.error import (
AppUnavailableError,
@@ -75,7 +75,7 @@ class ChatMessagePayload(BaseModel):
register_schema_models(console_ns, CompletionMessageExplorePayload, ChatMessagePayload)
-register_response_schema_models(console_ns, GeneratedAppResponse, SimpleResultResponse)
+register_response_schema_models(console_ns, SimpleResultResponse)
# define completion api for user
@@ -85,7 +85,7 @@ register_response_schema_models(console_ns, GeneratedAppResponse, SimpleResultRe
)
class CompletionApi(InstalledAppResource):
@console_ns.expect(console_ns.models[CompletionMessageExplorePayload.__name__])
- @console_ns.response(200, "Success", console_ns.models[GeneratedAppResponse.__name__])
+ @console_ns.response(200, "Success")
@with_current_user
@with_session
def post(self, session: Session, current_user: Account, installed_app: InstalledApp):
@@ -114,6 +114,7 @@ class CompletionApi(InstalledAppResource):
streaming=streaming,
)
+ # response-contract:ignore compact_generate_response
return helper.compact_generate_response(response)
except services.errors.conversation.ConversationNotExistsError:
raise NotFound("Conversation Not Exists.")
@@ -158,7 +159,7 @@ class CompletionStopApi(InstalledAppResource):
app_mode=AppMode.value_of(app_model.mode),
)
- return {"result": "success"}, 200
+ return SimpleResultResponse(result="success").model_dump(mode="json"), 200
@console_ns.route(
@@ -167,7 +168,7 @@ class CompletionStopApi(InstalledAppResource):
)
class ChatApi(InstalledAppResource):
@console_ns.expect(console_ns.models[ChatMessagePayload.__name__])
- @console_ns.response(200, "Success", console_ns.models[GeneratedAppResponse.__name__])
+ @console_ns.response(200, "Success")
@with_current_user
@with_session
def post(self, session: Session, current_user: Account, installed_app: InstalledApp):
@@ -196,6 +197,7 @@ class ChatApi(InstalledAppResource):
streaming=True,
)
+ # response-contract:ignore compact_generate_response
return helper.compact_generate_response(response)
except services.errors.conversation.ConversationNotExistsError:
raise NotFound("Conversation Not Exists.")
@@ -243,4 +245,4 @@ class ChatStopApi(InstalledAppResource):
app_mode=app_mode,
)
- return {"result": "success"}, 200
+ return SimpleResultResponse(result="success").model_dump(mode="json"), 200
diff --git a/api/controllers/console/explore/message.py b/api/controllers/console/explore/message.py
index 891966bee5b..0e27e2db25b 100644
--- a/api/controllers/console/explore/message.py
+++ b/api/controllers/console/explore/message.py
@@ -8,7 +8,6 @@ from sqlalchemy.orm import Session
from werkzeug.exceptions import InternalServerError, NotFound
from controllers.common.controller_schemas import MessageFeedbackPayload, MessageListQuery
-from controllers.common.fields import GeneratedAppResponse
from controllers.common.schema import query_params_from_model, register_response_schema_models, register_schema_models
from controllers.console.app.error import (
AppMoreLikeThisDisabledError,
@@ -61,7 +60,6 @@ class MoreLikeThisQuery(BaseModel):
register_schema_models(console_ns, MessageListQuery, MessageFeedbackPayload, MoreLikeThisQuery)
register_response_schema_models(
console_ns,
- GeneratedAppResponse,
ExploreMessageInfiniteScrollPagination,
ResultResponse,
SuggestedQuestionsResponse,
@@ -144,7 +142,7 @@ class MessageFeedbackApi(InstalledAppResource):
)
class MessageMoreLikeThisApi(InstalledAppResource):
@console_ns.doc(params=query_params_from_model(MoreLikeThisQuery))
- @console_ns.response(200, "Success", console_ns.models[GeneratedAppResponse.__name__])
+ @console_ns.response(200, "Success")
@with_current_user
@with_session
def get(self, session: Session, current_user: Account, installed_app: InstalledApp, message_id: UUID):
@@ -169,6 +167,7 @@ class MessageMoreLikeThisApi(InstalledAppResource):
invoke_from=InvokeFrom.EXPLORE,
streaming=streaming,
)
+ # response-contract:ignore compact_generate_response
return helper.compact_generate_response(response)
except MessageNotExistsError:
raise NotFound("Message Not Exists.")
diff --git a/api/controllers/console/explore/trial.py b/api/controllers/console/explore/trial.py
index 4488f645702..0d54bf7f473 100644
--- a/api/controllers/console/explore/trial.py
+++ b/api/controllers/console/explore/trial.py
@@ -1,9 +1,9 @@
import logging
from datetime import datetime
-from typing import Any, Literal, cast
+from typing import Any, Literal
from flask import request
-from flask_restx import Resource, fields, marshal, marshal_with
+from flask_restx import Resource
from pydantic import AliasChoices, BaseModel, Field, field_validator
from sqlalchemy import select
from sqlalchemy.orm import Session
@@ -19,7 +19,6 @@ from controllers.common.fields import (
from controllers.common.fields import Parameters as ParametersResponse
from controllers.common.fields import Site as SiteResponse
from controllers.common.schema import (
- get_or_create_model,
query_params_from_model,
register_response_schema_models,
register_schema_models,
@@ -58,27 +57,12 @@ from core.errors.error import (
)
from extensions.ext_database import db
from extensions.ext_redis import redis_client
-from fields.app_fields import (
- app_detail_fields_with_site,
- deleted_tool_fields,
- model_config_fields,
- site_fields,
- tag_fields,
-)
from fields.base import ResponseModel
-from fields.dataset_fields import dataset_fields
-from fields.member_fields import simple_account_fields
from fields.message_fields import SuggestedQuestionsResponse
-from fields.workflow_fields import (
- conversation_variable_fields,
- pipeline_variable_fields,
- workflow_fields,
- workflow_partial_fields,
-)
from graphon.graph_engine.manager import GraphEngineManager
from graphon.model_runtime.errors.invoke import InvokeError
from libs import helper
-from libs.helper import to_timestamp, uuid_value
+from libs.helper import dump_response, to_timestamp, uuid_value
from models import Account
from models.account import TenantStatus
from models.model import AppMode, Site
@@ -106,48 +90,6 @@ from services.recommended_app_service import RecommendedAppService
logger = logging.getLogger(__name__)
-model_config_model = get_or_create_model("TrialAppModelConfig", model_config_fields)
-workflow_partial_model = get_or_create_model("TrialWorkflowPartial", workflow_partial_fields)
-deleted_tool_model = get_or_create_model("TrialDeletedTool", deleted_tool_fields)
-tag_model = get_or_create_model("TrialTag", tag_fields)
-site_model = get_or_create_model("TrialSite", site_fields)
-
-app_detail_fields_with_site_copy = app_detail_fields_with_site.copy()
-app_detail_fields_with_site_copy["model_config"] = fields.Nested(
- model_config_model, attribute="app_model_config", allow_null=True
-)
-app_detail_fields_with_site_copy["workflow"] = fields.Nested(workflow_partial_model, allow_null=True)
-app_detail_fields_with_site_copy["deleted_tools"] = fields.List(fields.Nested(deleted_tool_model))
-app_detail_fields_with_site_copy["tags"] = fields.List(fields.Nested(tag_model))
-app_detail_fields_with_site_copy["site"] = fields.Nested(site_model)
-app_detail_with_site_model = get_or_create_model("TrialAppDetailWithSite", app_detail_fields_with_site_copy)
-
-simple_account_model = get_or_create_model("TrialSimpleAccount", simple_account_fields)
-conversation_variable_model = get_or_create_model("TrialConversationVariable", conversation_variable_fields)
-pipeline_variable_model = get_or_create_model("TrialPipelineVariable", pipeline_variable_fields)
-
-workflow_fields_copy = workflow_fields.copy()
-workflow_fields_copy["created_by"] = fields.Nested(simple_account_model, attribute="created_by_account")
-workflow_fields_copy["updated_by"] = fields.Nested(
- simple_account_model, attribute="updated_by_account", allow_null=True
-)
-workflow_fields_copy["conversation_variables"] = fields.List(fields.Nested(conversation_variable_model))
-workflow_fields_copy["rag_pipeline_variables"] = fields.List(fields.Nested(pipeline_variable_model))
-workflow_model = get_or_create_model("TrialWorkflow", workflow_fields_copy)
-
-dataset_model = get_or_create_model("TrialDataset", dataset_fields)
-dataset_list_model = get_or_create_model(
- "TrialDatasetList",
- {
- "data": fields.List(fields.Nested(dataset_model)),
- "has_more": fields.Boolean,
- "limit": fields.Integer,
- "total": fields.Integer,
- "page": fields.Integer,
- },
-)
-
-
class WorkflowRunRequest(BaseModel):
inputs: dict
files: list | None = Field(default=None)
@@ -387,6 +329,11 @@ class TrialDatasetResponse(ResponseModel):
created_at: int | None = None
permission_keys: list[str] = Field(default_factory=list)
+ @field_validator("created_at", mode="before")
+ @classmethod
+ def _normalize_timestamp(cls, value: datetime | int | None) -> int | None:
+ return to_timestamp(value)
+
class TrialDatasetListResponse(ResponseModel):
data: list[TrialDatasetResponse]
@@ -396,7 +343,7 @@ class TrialDatasetListResponse(ResponseModel):
page: int
-class TrialWorkflowAccount(ResponseModel):
+class TrialSimpleAccount(ResponseModel):
id: str
name: str | None = None
email: str | None = None
@@ -410,12 +357,12 @@ class TrialWorkflowResponse(ResponseModel):
version: str | None = None
marked_name: str | None = None
marked_comment: str | None = None
- created_by: TrialWorkflowAccount | None = Field(
+ created_by: TrialSimpleAccount | None = Field(
default=None,
validation_alias=AliasChoices("created_by_account", "created_by"),
)
created_at: int | None = None
- updated_by: TrialWorkflowAccount | None = Field(
+ updated_by: TrialSimpleAccount | None = Field(
default=None,
validation_alias=AliasChoices("updated_by_account", "updated_by"),
)
@@ -453,6 +400,8 @@ register_response_schema_models(
TrialWorkflowResponse,
)
+simple_account_model = console_ns.models[TrialSimpleAccount.__name__]
+
class TrialAppWorkflowRunApi(TrialAppResource):
@trial_feature_enable
@@ -840,27 +789,28 @@ class TrialAppParameterApi(Resource):
class AppApi(Resource):
@console_ns.response(200, "Success", console_ns.models[TrialAppDetailResponse.__name__])
@get_app_model_with_trial(None)
- @marshal_with(app_detail_with_site_model)
def get(self, app_model):
"""Get app detail"""
app_service = AppService()
app_model = app_service.get_app(app_model)
- return app_model
+ return dump_response(TrialAppDetailResponse, app_model)
class AppWorkflowApi(Resource):
@console_ns.response(200, "Success", console_ns.models[TrialWorkflowResponse.__name__])
@get_app_model_with_trial(None)
- @marshal_with(workflow_model)
def get(self, app_model):
"""Get workflow detail"""
if not app_model.workflow_id:
raise AppUnavailableError()
workflow = db.session.get(Workflow, app_model.workflow_id)
- return workflow
+ if workflow is None:
+ raise AppUnavailableError()
+
+ return dump_response(TrialWorkflowResponse, workflow)
class DatasetListApi(Resource):
@@ -878,10 +828,8 @@ class DatasetListApi(Resource):
else:
raise NeedAddIdsError()
- data = cast(list[dict[str, Any]], marshal(datasets, dataset_fields))
-
- response = {"data": data, "has_more": len(datasets) == limit, "limit": limit, "total": total, "page": page}
- return response
+ response = {"data": datasets, "has_more": len(datasets) == limit, "limit": limit, "total": total, "page": page}
+ return dump_response(TrialDatasetListResponse, response)
console_ns.add_resource(TrialChatApi, "/trial-apps/<uuid:app_id>/chat-messages", endpoint="trial_app_chat_completion")
diff --git a/api/controllers/console/explore/workflow.py b/api/controllers/console/explore/workflow.py
index e41e3e18b2c..72c9085921f 100644
--- a/api/controllers/console/explore/workflow.py
+++ b/api/controllers/console/explore/workflow.py
@@ -4,7 +4,7 @@ from sqlalchemy.orm import Session
from werkzeug.exceptions import InternalServerError
from controllers.common.controller_schemas import WorkflowRunPayload
-from controllers.common.fields import GeneratedAppResponse, SimpleResultResponse
+from controllers.common.fields import SimpleResultResponse
from controllers.common.schema import register_response_schema_models, register_schema_model
from controllers.console.app.error import (
CompletionRequestError,
@@ -38,13 +38,13 @@ from .. import console_ns
logger = logging.getLogger(__name__)
register_schema_model(console_ns, WorkflowRunPayload)
-register_response_schema_models(console_ns, GeneratedAppResponse, SimpleResultResponse)
+register_response_schema_models(console_ns, SimpleResultResponse)
@console_ns.route("/installed-apps/<uuid:installed_app_id>/workflows/run")
class InstalledAppWorkflowRunApi(InstalledAppResource):
@console_ns.expect(console_ns.models[WorkflowRunPayload.__name__])
- @console_ns.response(200, "Success", console_ns.models[GeneratedAppResponse.__name__])
+ @console_ns.response(200, "Success")
@with_current_user
@with_session
def post(self, session: Session, current_user: Account, installed_app: InstalledApp):
@@ -70,6 +70,7 @@ class InstalledAppWorkflowRunApi(InstalledAppResource):
streaming=True,
)
+ # response-contract:ignore compact_generate_response
return helper.compact_generate_response(response)
except ProviderTokenNotInitError as ex:
raise ProviderNotInitializeError(ex.description)
@@ -109,4 +110,4 @@ class InstalledAppWorkflowTaskStopApi(InstalledAppResource):
# New graph engine command channel mechanism
GraphEngineManager(redis_client).send_stop_command(task_id)
- return {"result": "success"}
+ return SimpleResultResponse(result="success").model_dump(mode="json")
diff --git a/api/controllers/console/extension.py b/api/controllers/console/extension.py
index ec1e01dc460..4b149b9c08d 100644
--- a/api/controllers/console/extension.py
+++ b/api/controllers/console/extension.py
@@ -4,18 +4,18 @@ from uuid import UUID
from flask import request
from flask_restx import Resource
-from pydantic import BaseModel, Field, TypeAdapter, field_validator
+from pydantic import BaseModel, Field, RootModel, field_validator
from constants import HIDDEN_VALUE
from extensions.ext_database import db
from fields.base import ResponseModel
-from libs.helper import to_timestamp
+from libs.helper import dump_response, to_timestamp
from libs.login import login_required
from models.api_based_extension import APIBasedExtension
from services.api_based_extension_service import APIBasedExtensionService
from services.code_based_extension_service import CodeBasedExtensionService
-from ..common.schema import DEFAULT_REF_TEMPLATE_OPENAPI_3_0, query_params_from_model, register_schema_models
+from ..common.schema import query_params_from_model, register_response_schema_models, register_schema_models
from . import console_ns
from .wraps import account_initialization_required, setup_required, with_current_tenant_id
@@ -61,36 +61,21 @@ class APIBasedExtensionResponse(ResponseModel):
return to_timestamp(value)
+class APIBasedExtensionListResponse(RootModel[list[APIBasedExtensionResponse]]):
+ pass
+
+
register_schema_models(
console_ns,
CodeBasedExtensionQuery,
APIBasedExtensionPayload,
+)
+register_response_schema_models(
+ console_ns,
CodeBasedExtensionResponse,
APIBasedExtensionResponse,
+ APIBasedExtensionListResponse,
)
-console_ns.schema_model(
- "APIBasedExtensionListResponse",
- TypeAdapter(list[APIBasedExtensionResponse]).json_schema(ref_template=DEFAULT_REF_TEMPLATE_OPENAPI_3_0),
-)
-
-
-def _serialize_api_based_extension(extension: APIBasedExtension) -> dict[str, Any]:
- return APIBasedExtensionResponse.model_validate(extension, from_attributes=True).model_dump(mode="json")
-
-
-def _serialize_saved_api_based_extension(extension: APIBasedExtension, api_key: str) -> dict[str, Any]:
- """Serialize a saved extension with the plaintext key used for response masking only.
-
- APIBasedExtensionService.save mutates the ORM object to hold the encrypted token before returning it. The response
- contract, however, should match list/detail responses, where api_key is masked from the decrypted token.
- """
- return APIBasedExtensionResponse(
- id=extension.id,
- name=extension.name,
- api_endpoint=extension.api_endpoint,
- api_key=api_key,
- created_at=to_timestamp(extension.created_at),
- ).model_dump(mode="json")
@console_ns.route("/code-based-extension")
@@ -119,16 +104,16 @@ class CodeBasedExtensionAPI(Resource):
class APIBasedExtensionAPI(Resource):
@console_ns.doc("get_api_based_extensions")
@console_ns.doc(description="Get all API-based extensions for current tenant")
- @console_ns.response(200, "Success", console_ns.models["APIBasedExtensionListResponse"])
+ @console_ns.response(200, "Success", console_ns.models[APIBasedExtensionListResponse.__name__])
@setup_required
@login_required
@account_initialization_required
@with_current_tenant_id
def get(self, current_tenant_id: str):
- return [
- _serialize_api_based_extension(extension)
- for extension in APIBasedExtensionService.get_all_by_tenant_id(db.session(), current_tenant_id)
- ]
+ return dump_response(
+ APIBasedExtensionListResponse,
+ APIBasedExtensionService.get_all_by_tenant_id(db.session(), current_tenant_id),
+ )
@console_ns.doc("create_api_based_extension")
@console_ns.doc(description="Create a new API-based extension")
@@ -148,12 +133,14 @@ class APIBasedExtensionAPI(Resource):
api_key=payload.api_key,
)
- return (
- _serialize_saved_api_based_extension(
- APIBasedExtensionService.save(db.session(), extension_data), payload.api_key
- ),
- 201,
- )
+ extension = APIBasedExtensionService.save(db.session(), extension_data)
+ return APIBasedExtensionResponse(
+ id=extension.id,
+ name=extension.name,
+ api_endpoint=extension.api_endpoint,
+ api_key=payload.api_key,
+ created_at=to_timestamp(extension.created_at),
+ ).model_dump(mode="json"), 201
@console_ns.route("/api-based-extension/<uuid:id>")
@@ -169,8 +156,9 @@ class APIBasedExtensionDetailAPI(Resource):
def get(self, current_tenant_id: str, id: UUID):
api_based_extension_id = str(id)
- return _serialize_api_based_extension(
- APIBasedExtensionService.get_with_tenant_id(db.session(), current_tenant_id, api_based_extension_id)
+ return dump_response(
+ APIBasedExtensionResponse,
+ APIBasedExtensionService.get_with_tenant_id(db.session(), current_tenant_id, api_based_extension_id),
)
@console_ns.doc("update_api_based_extension")
@@ -199,10 +187,14 @@ class APIBasedExtensionDetailAPI(Resource):
extension_data_from_db.api_key = payload.api_key
api_key_for_response = payload.api_key
- return _serialize_saved_api_based_extension(
- APIBasedExtensionService.save(db.session(), extension_data_from_db),
- api_key_for_response,
- )
+ APIBasedExtensionService.save(db.session(), extension_data_from_db)
+ return APIBasedExtensionResponse(
+ id=extension_data_from_db.id,
+ name=extension_data_from_db.name,
+ api_endpoint=extension_data_from_db.api_endpoint,
+ api_key=api_key_for_response,
+ created_at=to_timestamp(extension_data_from_db.created_at),
+ ).model_dump(mode="json")
@console_ns.doc("delete_api_based_extension")
@console_ns.doc(description="Delete API-based extension")
diff --git a/api/controllers/console/tag/tags.py b/api/controllers/console/tag/tags.py
index 8d1f7491f0f..c4ec925c9a3 100644
--- a/api/controllers/console/tag/tags.py
+++ b/api/controllers/console/tag/tags.py
@@ -3,7 +3,7 @@ from uuid import UUID
from flask import request
from flask_restx import Resource
-from pydantic import BaseModel, Field, field_validator
+from pydantic import BaseModel, Field, RootModel, field_validator
from sqlalchemy import select
from werkzeug.exceptions import Forbidden
@@ -23,6 +23,7 @@ from controllers.console.wraps import (
)
from extensions.ext_database import db
from fields.base import ResponseModel
+from libs.helper import dump_response
from libs.login import current_account_with_tenant, login_required
from models import Account
from models.enums import TagType
@@ -85,6 +86,10 @@ class TagResponse(ResponseModel):
return str(value)
+class TagListResponse(RootModel[list[TagResponse]]):
+ pass
+
+
register_schema_models(
console_ns,
TagBasePayload,
@@ -92,9 +97,8 @@ register_schema_models(
TagBindingPayload,
TagBindingRemovePayload,
TagListQueryParam,
- TagResponse,
)
-register_response_schema_models(console_ns, SimpleResultResponse)
+register_response_schema_models(console_ns, SimpleResultResponse, TagResponse, TagListResponse)
def _enforce_snippet_tag_rbac_if_needed(tag_type: TagType | str | None) -> None:
@@ -128,18 +132,14 @@ class TagListApi(Resource):
@login_required
@account_initialization_required
@console_ns.doc(params=query_params_from_model(TagListQueryParam))
- @console_ns.doc(responses={200: ("Success", [console_ns.models[TagResponse.__name__]])})
+ @console_ns.response(200, "Success", console_ns.models[TagListResponse.__name__])
@with_current_tenant_id
def get(self, current_tenant_id: str):
raw_args = request.args.to_dict()
param = TagListQueryParam.model_validate(raw_args)
tags = TagService.get_tags(db.session(), param.type, current_tenant_id, param.keyword)
- serialized_tags = [
- TagResponse.model_validate(tag, from_attributes=True).model_dump(mode="json") for tag in tags
- ]
-
- return serialized_tags, 200
+ return dump_response(TagListResponse, tags), 200
@console_ns.expect(console_ns.models[TagBasePayload.__name__])
@console_ns.response(200, "Success", console_ns.models[TagResponse.__name__])
@@ -156,11 +156,7 @@ class TagListApi(Resource):
_enforce_snippet_tag_rbac_if_needed(payload.type)
tag = TagService.save_tags(SaveTagPayload(name=payload.name, type=payload.type), db.session)
- response = TagResponse.model_validate(
- {"id": tag.id, "name": tag.name, "type": tag.type, "binding_count": 0}
- ).model_dump(mode="json")
-
- return response, 200
+ return dump_response(TagResponse, {"id": tag.id, "name": tag.name, "type": tag.type, "binding_count": 0}), 200
@console_ns.route("/tags/<uuid:tag_id>")
@@ -183,11 +179,13 @@ class TagUpdateDeleteApi(Resource):
binding_count = TagService.get_tag_binding_count(tag_id_str, db.session)
- response = TagResponse.model_validate(
- {"id": tag.id, "name": tag.name, "type": tag.type, "binding_count": binding_count}
- ).model_dump(mode="json")
-
- return response, 200
+ return (
+ dump_response(
+ TagResponse,
+ {"id": tag.id, "name": tag.name, "type": tag.type, "binding_count": binding_count},
+ ),
+ 200,
+ )
@setup_required
@login_required
diff --git a/api/fields/member_fields.py b/api/fields/member_fields.py
index 9bbcbef8429..80b93f0a24b 100644
--- a/api/fields/member_fields.py
+++ b/api/fields/member_fields.py
@@ -15,13 +15,13 @@ simple_account_fields = {
}
-class SimpleAccount(ResponseModel):
+class SimpleAccountResponse(ResponseModel):
id: str
name: str
email: str
-class _AccountAvatar(ResponseModel):
+class _AccountAvatarResponseMixin(ResponseModel):
avatar: str | None = None
@computed_field(return_type=str | None) # type: ignore[prop-decorator]
@@ -30,7 +30,7 @@ class _AccountAvatar(ResponseModel):
return build_avatar_url(self.avatar)
-class Account(_AccountAvatar):
+class AccountResponse(_AccountAvatarResponseMixin):
id: str
name: str
email: str
@@ -48,7 +48,7 @@ class Account(_AccountAvatar):
return to_timestamp(value)
-class AccountWithRole(_AccountAvatar):
+class AccountWithRoleResponse(_AccountAvatarResponseMixin):
id: str
name: str
email: str
@@ -65,5 +65,11 @@ class AccountWithRole(_AccountAvatar):
return to_timestamp(value)
-class AccountWithRoleList(ResponseModel):
- accounts: list[AccountWithRole]
+class AccountWithRoleListResponse(ResponseModel):
+ accounts: list[AccountWithRoleResponse]
+
+
+SimpleAccount = SimpleAccountResponse
+Account = AccountResponse
+AccountWithRole = AccountWithRoleResponse
+AccountWithRoleList = AccountWithRoleListResponse
diff --git a/api/openapi/markdown/console-openapi.md b/api/openapi/markdown/console-openapi.md
index 9b1341526b8..5f4ecad431c 100644
--- a/api/openapi/markdown/console-openapi.md
+++ b/api/openapi/markdown/console-openapi.md
@@ -38,7 +38,7 @@ Get account avatar url
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [Account](#account)<br> |
+| 200 | Success | **application/json**: [AccountResponse](#accountresponse)<br> |
### [POST] /account/change-email
#### Request Body
@@ -77,7 +77,7 @@ Get account avatar url
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [Account](#account)<br> |
+| 200 | Success | **application/json**: [AccountResponse](#accountresponse)<br> |
### [POST] /account/change-email/validity
#### Request Body
@@ -198,7 +198,7 @@ Get account avatar url
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [Account](#account)<br> |
+| 200 | Success | **application/json**: [AccountResponse](#accountresponse)<br> |
### [POST] /account/interface-theme
#### Request Body
@@ -211,7 +211,7 @@ Get account avatar url
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [Account](#account)<br> |
+| 200 | Success | **application/json**: [AccountResponse](#accountresponse)<br> |
### [POST] /account/name
#### Request Body
@@ -224,7 +224,7 @@ Get account avatar url
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [Account](#account)<br> |
+| 200 | Success | **application/json**: [AccountResponse](#accountresponse)<br> |
### [POST] /account/password
#### Request Body
@@ -237,14 +237,14 @@ Get account avatar url
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [Account](#account)<br> |
+| 200 | Success | **application/json**: [AccountResponse](#accountresponse)<br> |
### [GET] /account/profile
#### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [Account](#account)<br> |
+| 200 | Success | **application/json**: [AccountResponse](#accountresponse)<br> |
### [POST] /account/timezone
#### Request Body
@@ -257,7 +257,7 @@ Get account avatar url
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [Account](#account)<br> |
+| 200 | Success | **application/json**: [AccountResponse](#accountresponse)<br> |
### [POST] /activate
Activate account with invitation token
@@ -7067,9 +7067,9 @@ Request body:
#### Responses
-| Code | Description | Schema |
-| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br> |
+| Code | Description |
+| ---- | ----------- |
+| 200 | Success |
### [POST] /installed-apps/{installed_app_id}/chat-messages/{task_id}/stop
#### Parameters
@@ -7100,9 +7100,9 @@ Request body:
#### Responses
-| Code | Description | Schema |
-| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br> |
+| Code | Description |
+| ---- | ----------- |
+| 200 | Success |
### [POST] /installed-apps/{installed_app_id}/completion-messages/{task_id}/stop
#### Parameters
@@ -7243,9 +7243,9 @@ Request body:
#### Responses
-| Code | Description | Schema |
-| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br> |
+| Code | Description |
+| ---- | ----------- |
+| 200 | Success |
### [GET] /installed-apps/{installed_app_id}/messages/{message_id}/suggested-questions
#### Parameters
@@ -7375,9 +7375,9 @@ Request body:
#### Responses
-| Code | Description | Schema |
-| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br> |
+| Code | Description |
+| ---- | ----------- |
+| 200 | Success |
### [POST] /installed-apps/{installed_app_id}/workflows/tasks/{task_id}/stop
**Stop workflow task**
@@ -9327,7 +9327,7 @@ Remove one or more tag bindings from a target.
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [ [TagResponse](#tagresponse) ]<br> |
+| 200 | Success | **application/json**: [TagListResponse](#taglistresponse)<br> |
### [POST] /tags
#### Request Body
@@ -9942,7 +9942,7 @@ Increment snippet use count by 1
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [AccountWithRoleList](#accountwithrolelist)<br> |
+| 200 | Success | **application/json**: [AccountWithRoleListResponse](#accountwithrolelistresponse)<br> |
### [GET] /workspaces/current/default-model
#### Parameters
@@ -10151,7 +10151,7 @@ Update a plugin endpoint
| Code | Description | Schema |
| ---- | ----------- | ------ |
-| 200 | Success | **application/json**: [AccountWithRoleList](#accountwithrolelist)<br> |
+| 200 | Success | **application/json**: [AccountWithRoleListResponse](#accountwithrolelistresponse)<br> |
### [POST] /workspaces/current/members/invite-email
#### Request Body
@@ -12660,23 +12660,6 @@ Default namespace
| role_name | string | | No |
| tenant_id | string | | No |
-#### Account
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| avatar | string | | No |
-| avatar_url | string | | Yes |
-| created_at | integer | | No |
-| email | string | | Yes |
-| id | string | | Yes |
-| interface_language | string | | No |
-| interface_theme | string | | No |
-| is_password_set | boolean | | Yes |
-| last_login_at | integer | | No |
-| last_login_ip | string | | No |
-| name | string | | Yes |
-| timezone | string | | No |
-
#### AccountAvatarPayload
| Name | Type | Description | Required |
@@ -12752,13 +12735,36 @@ Default namespace
| password | string | | No |
| repeat_new_password | string | | Yes |
+#### AccountResponse
+
+| Name | Type | Description | Required |
+| ---- | ---- | ----------- | -------- |
+| avatar | string | | No |
+| avatar_url | string | | Yes |
+| created_at | integer | | No |
+| email | string | | Yes |
+| id | string | | Yes |
+| interface_language | string | | No |
+| interface_theme | string | | No |
+| is_password_set | boolean | | Yes |
+| last_login_at | integer | | No |
+| last_login_ip | string | | No |
+| name | string | | Yes |
+| timezone | string | | No |
+
#### AccountTimezonePayload
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| timezone | string | | Yes |
-#### AccountWithRole
+#### AccountWithRoleListResponse
+
+| Name | Type | Description | Required |
+| ---- | ---- | ----------- | -------- |
+| accounts | [ [AccountWithRoleResponse](#accountwithroleresponse) ] | | Yes |
+
+#### AccountWithRoleResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
@@ -12774,12 +12780,6 @@ Default namespace
| roles | [ object ] | | No |
| status | string | | Yes |
-#### AccountWithRoleList
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| accounts | [ [AccountWithRole](#accountwithrole) ] | | Yes |
-
#### ActivateCheckQuery
| Name | Type | Description | Required |
@@ -12828,7 +12828,7 @@ Default namespace
| ---- | ---- | ----------- | -------- |
| conversation_id | string | | No |
| created_at | integer | | No |
-| created_by_account | [SimpleAccount](#simpleaccount) | | No |
+| created_by_account | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| elapsed_time | number | | No |
| exceptions_count | integer | | No |
| finished_at | integer | | No |
@@ -20609,6 +20609,14 @@ Whitelist scopes accepted by RBAC app and dataset access config APIs.
| id | string | | Yes |
| name | string | | Yes |
+#### SimpleAccountResponse
+
+| Name | Type | Description | Required |
+| ---- | ---- | ----------- | -------- |
+| email | string | | Yes |
+| id | string | | Yes |
+| name | string | | Yes |
+
#### SimpleConversation
| Name | Type | Description | Required |
@@ -20946,7 +20954,7 @@ Query parameters for listing snippet published workflows.
| ---- | ---- | ----------- | -------- |
| conversation_variables | [ [WorkflowConversationVariableResponse](#workflowconversationvariableresponse) ] | | Yes |
| created_at | integer | | Yes |
-| created_by | [SimpleAccount](#simpleaccount) | | No |
+| created_by | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| environment_variables | [ [WorkflowEnvironmentVariableResponse](#workflowenvironmentvariableresponse) ] | | Yes |
| features | object | | Yes |
| graph | object | | Yes |
@@ -20958,7 +20966,7 @@ Query parameters for listing snippet published workflows.
| rag_pipeline_variables | [ [PipelineVariableResponse](#pipelinevariableresponse) ] | | Yes |
| tool_published | boolean | | Yes |
| updated_at | integer | | Yes |
-| updated_by | [SimpleAccount](#simpleaccount) | | No |
+| updated_by | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| version | string | | Yes |
#### StarredAppListQuery
@@ -21180,6 +21188,12 @@ Model class for provider system configuration response.
| keyword | string | Search keyword | No |
| type | string, <br>**Available values:** "", "app", "knowledge", "snippet" | Tag type filter<br>*Enum:* `""`, `"app"`, `"knowledge"`, `"snippet"` | No |
+#### TagListResponse
+
+| Name | Type | Description | Required |
+| ---- | ---- | ----------- | -------- |
+| TagListResponse | array | | |
+
#### TagResponse
| Name | Type | Description | Required |
@@ -21433,35 +21447,6 @@ Enum class for tool provider
| use_icon_as_answer_icon | boolean | | No |
| workflow | [TrialWorkflowPartialResponse](#trialworkflowpartialresponse) | | No |
-#### TrialAppDetailWithSite
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| access_mode | string | | No |
-| api_base_url | string | | No |
-| created_at | long | | No |
-| created_by | string | | No |
-| deleted_tools | [ [TrialDeletedTool](#trialdeletedtool) ] | | No |
-| description | string | | No |
-| enable_api | boolean | | No |
-| enable_site | boolean | | No |
-| icon | string | | No |
-| icon_background | string | | No |
-| icon_type | string | | No |
-| icon_url | string | | No |
-| id | string | | No |
-| max_active_requests | integer | | No |
-| mode | string | | No |
-| model_config | [TrialAppModelConfig](#trialappmodelconfig) | | No |
-| name | string | | No |
-| permission_keys | [ string ] | | No |
-| site | [TrialSite](#trialsite) | | No |
-| tags | [ [TrialTag](#trialtag) ] | | No |
-| updated_at | long | | No |
-| updated_by | string | | No |
-| use_icon_as_answer_icon | boolean | | No |
-| workflow | [TrialWorkflowPartial](#trialworkflowpartial) | | No |
-
#### TrialAppMode
| Name | Type | Description | Required |
@@ -21477,35 +21462,6 @@ Enum class for tool provider
| name | string | | Yes |
| provider | string | | Yes |
-#### TrialAppModelConfig
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| agent_mode | object | | No |
-| annotation_reply | object | | No |
-| chat_prompt_config | object | | No |
-| completion_prompt_config | object | | No |
-| created_at | long | | No |
-| created_by | string | | No |
-| dataset_configs | object | | No |
-| dataset_query_variable | string | | No |
-| external_data_tools | [ object ] | | No |
-| file_upload | object | | No |
-| model | object | | No |
-| more_like_this | object | | No |
-| opening_statement | string | | No |
-| pre_prompt | string | | No |
-| prompt_type | string | | No |
-| retriever_resource | object | | No |
-| sensitive_word_avoidance | object | | No |
-| speech_to_text | object | | No |
-| suggested_questions | [ string ] | | No |
-| suggested_questions_after_answer | object | | No |
-| text_to_speech | object | | No |
-| updated_at | long | | No |
-| updated_by | string | | No |
-| user_input_form | [ object ] | | No |
-
#### TrialAppModelConfigResponse
| Name | Type | Description | Required |
@@ -21535,40 +21491,6 @@ Enum class for tool provider
| updated_by | string | | No |
| user_input_form | [ [JsonObject](#jsonobject) ] | | No |
-#### TrialConversationVariable
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| description | string | | No |
-| id | string | | No |
-| name | string | | No |
-| value | string<br>integer<br>number<br>boolean<br>object<br>[ object ] | | No |
-| value_type | string | | No |
-
-#### TrialDataset
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| created_at | long | | No |
-| created_by | string | | No |
-| data_source_type | string | | No |
-| description | string | | No |
-| id | string | | No |
-| indexing_technique | string | | No |
-| name | string | | No |
-| permission | string | | No |
-| permission_keys | [ string ] | | No |
-
-#### TrialDatasetList
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| data | [ [TrialDataset](#trialdataset) ] | | No |
-| has_more | boolean | | No |
-| limit | integer | | No |
-| page | integer | | No |
-| total | integer | | No |
-
#### TrialDatasetListQuery
| Name | Type | Description | Required |
@@ -21601,14 +21523,6 @@ Enum class for tool provider
| permission | string | | No |
| permission_keys | [ string ] | | No |
-#### TrialDeletedTool
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| provider_id | string | | No |
-| tool_name | string | | No |
-| type | string | | No |
-
#### TrialDeletedToolResponse
| Name | Type | Description | Required |
@@ -21629,62 +21543,14 @@ Enum class for tool provider
| ---- | ---- | ----------- | -------- |
| trial_models | [ string ] | | Yes |
-#### TrialPipelineVariable
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| allow_file_extension | [ string ] | | No |
-| allow_file_upload_methods | [ string ] | | No |
-| allowed_file_types | [ string ] | | No |
-| belong_to_node_id | string | | No |
-| default_value | string<br>integer<br>number<br>boolean<br>object<br>[ object ] | | No |
-| label | string | | No |
-| max_length | integer | | No |
-| options | [ string ] | | No |
-| placeholder | string | | No |
-| required | boolean | | No |
-| tooltips | string | | No |
-| type | string | | No |
-| unit | string | | No |
-| variable | string | | No |
-
#### TrialSimpleAccount
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| email | string | | No |
-| id | string | | No |
+| id | string | | Yes |
| name | string | | No |
-#### TrialSite
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| access_token | string | | No |
-| app_base_url | string | | No |
-| chat_color_theme | string | | No |
-| chat_color_theme_inverted | boolean | | No |
-| code | string | | No |
-| copyright | string | | No |
-| created_at | long | | No |
-| created_by | string | | No |
-| custom_disclaimer | string | | No |
-| customize_domain | string | | No |
-| customize_token_strategy | string | | No |
-| default_language | string | | No |
-| description | string | | No |
-| icon | string | | No |
-| icon_background | string | | No |
-| icon_type | string | | No |
-| icon_url | string | | No |
-| privacy_policy | string | | No |
-| prompt_public | boolean | | No |
-| show_workflow_steps | boolean | | No |
-| title | string | | No |
-| updated_at | long | | No |
-| updated_by | string | | No |
-| use_icon_as_answer_icon | boolean | | No |
-
#### TrialSiteResponse
| Name | Type | Description | Required |
@@ -21715,14 +21581,6 @@ Enum class for tool provider
| updated_by | string | | No |
| use_icon_as_answer_icon | boolean | | No |
-#### TrialTag
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| id | string | | No |
-| name | string | | No |
-| type | string | | No |
-
#### TrialTagResponse
| Name | Type | Description | Required |
@@ -21731,44 +21589,6 @@ Enum class for tool provider
| name | string | | Yes |
| type | string | | Yes |
-#### TrialWorkflow
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| conversation_variables | [ [TrialConversationVariable](#trialconversationvariable) ] | | No |
-| created_at | long | | No |
-| created_by | [TrialSimpleAccount](#trialsimpleaccount) | | No |
-| environment_variables | [ object ] | | No |
-| features | object | | No |
-| graph | object | | No |
-| hash | string | | No |
-| id | string | | No |
-| marked_comment | string | | No |
-| marked_name | string | | No |
-| rag_pipeline_variables | [ [TrialPipelineVariable](#trialpipelinevariable) ] | | No |
-| tool_published | boolean | | No |
-| updated_at | long | | No |
-| updated_by | [TrialSimpleAccount](#trialsimpleaccount) | | No |
-| version | string | | No |
-
-#### TrialWorkflowAccount
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| email | string | | No |
-| id | string | | Yes |
-| name | string | | No |
-
-#### TrialWorkflowPartial
-
-| Name | Type | Description | Required |
-| ---- | ---- | ----------- | -------- |
-| created_at | long | | No |
-| created_by | string | | No |
-| id | string | | No |
-| updated_at | long | | No |
-| updated_by | string | | No |
-
#### TrialWorkflowPartialResponse
| Name | Type | Description | Required |
@@ -21785,7 +21605,7 @@ Enum class for tool provider
| ---- | ---- | ----------- | -------- |
| conversation_variables | [ [JsonObject](#jsonobject) ] | | No |
| created_at | integer | | No |
-| created_by | [TrialWorkflowAccount](#trialworkflowaccount) | | No |
+| created_by | [TrialSimpleAccount](#trialsimpleaccount) | | No |
| environment_variables | [ [JsonObject](#jsonobject) ] | | No |
| features | [JsonObject](#jsonobject) | | No |
| graph | [JsonObject](#jsonobject) | | Yes |
@@ -21796,7 +21616,7 @@ Enum class for tool provider
| rag_pipeline_variables | [ [JsonObject](#jsonobject) ] | | No |
| tool_published | boolean | | No |
| updated_at | integer | | No |
-| updated_by | [TrialWorkflowAccount](#trialworkflowaccount) | | No |
+| updated_by | [TrialSimpleAccount](#trialsimpleaccount) | | No |
| version | string | | No |
#### TriggerCreationMethod
@@ -22215,7 +22035,7 @@ How a workflow node is bound to an Agent.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer | | No |
-| created_by_account | [SimpleAccount](#simpleaccount) | | No |
+| created_by_account | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| created_by_end_user | [SimpleEndUser](#simpleenduser) | | No |
| created_by_role | string | | No |
| created_from | string | | No |
@@ -22252,7 +22072,7 @@ How a workflow node is bound to an Agent.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer | | No |
-| created_by_account | [SimpleAccount](#simpleaccount) | | No |
+| created_by_account | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| created_by_end_user | [SimpleEndUser](#simpleenduser) | | No |
| id | string | | Yes |
| trigger_metadata | | | No |
@@ -22353,7 +22173,7 @@ How a workflow node is bound to an Agent.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
-| users | [ [AccountWithRole](#accountwithrole) ] | | Yes |
+| users | [ [AccountWithRoleResponse](#accountwithroleresponse) ] | | Yes |
#### WorkflowCommentReply
@@ -22776,7 +22596,7 @@ tenant's default model. The underlying generator never raises — an empty
| ---- | ---- | ----------- | -------- |
| conversation_variables | [ [WorkflowConversationVariableResponse](#workflowconversationvariableresponse) ] | | Yes |
| created_at | integer | | Yes |
-| created_by | [SimpleAccount](#simpleaccount) | | No |
+| created_by | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| environment_variables | [ [WorkflowEnvironmentVariableResponse](#workflowenvironmentvariableresponse) ] | | Yes |
| features | object | | Yes |
| graph | object | | Yes |
@@ -22787,7 +22607,7 @@ tenant's default model. The underlying generator never raises — an empty
| rag_pipeline_variables | [ [PipelineVariableResponse](#pipelinevariableresponse) ] | | Yes |
| tool_published | boolean | | Yes |
| updated_at | integer | | Yes |
-| updated_by | [SimpleAccount](#simpleaccount) | | No |
+| updated_by | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| version | string | | Yes |
#### WorkflowRestoreResponse
@@ -22822,7 +22642,7 @@ tenant's default model. The underlying generator never raises — an empty
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer | | No |
-| created_by_account | [SimpleAccount](#simpleaccount) | | No |
+| created_by_account | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| created_by_end_user | [SimpleEndUser](#simpleenduser) | | No |
| created_by_role | string | | No |
| elapsed_time | number | | No |
@@ -22861,7 +22681,7 @@ tenant's default model. The underlying generator never raises — an empty
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer | | No |
-| created_by_account | [SimpleAccount](#simpleaccount) | | No |
+| created_by_account | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| elapsed_time | number | | No |
| exceptions_count | integer | | No |
| finished_at | integer | | No |
@@ -22908,7 +22728,7 @@ tenant's default model. The underlying generator never raises — an empty
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer | | No |
-| created_by_account | [SimpleAccount](#simpleaccount) | | No |
+| created_by_account | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| created_by_end_user | [SimpleEndUser](#simpleenduser) | | No |
| created_by_role | string | | No |
| elapsed_time | number | | No |
diff --git a/api/openapi/markdown/service-openapi.md b/api/openapi/markdown/service-openapi.md
index 1018bde6b3e..dc4ec74c9af 100644
--- a/api/openapi/markdown/service-openapi.md
+++ b/api/openapi/markdown/service-openapi.md
@@ -3937,7 +3937,7 @@ Model class for provider with models response.
| output_variable_name | string | | Yes |
| type | string | | No |
-#### SimpleAccount
+#### SimpleAccountResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
@@ -4148,7 +4148,7 @@ in form definiton, or a variable while the workflow is running.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer | | No |
-| created_by_account | [SimpleAccount](#simpleaccount) | | No |
+| created_by_account | [SimpleAccountResponse](#simpleaccountresponse) | | No |
| created_by_end_user | [SimpleEndUser](#simpleenduser) | | No |
| created_by_role | string | | No |
| created_from | string | | No |
diff --git a/api/tests/unit_tests/commands/test_generate_swagger_specs.py b/api/tests/unit_tests/commands/test_generate_swagger_specs.py
index 2ee60b39ee6..a0caf0263e7 100644
--- a/api/tests/unit_tests/commands/test_generate_swagger_specs.py
+++ b/api/tests/unit_tests/commands/test_generate_swagger_specs.py
@@ -261,7 +261,7 @@ def test_generate_specs_include_console_contract_shapes_for_schema_migration(tmp
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
+ assert schemas["AccountWithRoleResponse"]["properties"]["avatar_url"]["readOnly"] is True
def test_checked_in_agent_v2_knowledge_openapi_and_generated_contracts_are_in_sync():
diff --git a/api/tests/unit_tests/controllers/console/explore/test_trial.py b/api/tests/unit_tests/controllers/console/explore/test_trial.py
index 6c80a93a558..60cd09ebac2 100644
--- a/api/tests/unit_tests/controllers/console/explore/test_trial.py
+++ b/api/tests/unit_tests/controllers/console/explore/test_trial.py
@@ -1,5 +1,7 @@
+from datetime import UTC, datetime
from inspect import unwrap as inspect_unwrap
from io import BytesIO
+from types import SimpleNamespace
from typing import Any
from unittest.mock import MagicMock, patch
from uuid import uuid4
@@ -95,7 +97,59 @@ def valid_parameters() -> dict[str, object]:
def test_trial_workflow_uses_trial_scoped_simple_account_model() -> None:
assert module.simple_account_model.name == "TrialSimpleAccount"
- assert hasattr(module.simple_account_model, "items")
+ assert module.simple_account_model.__schema__["properties"].keys() >= {"id", "name", "email"}
+
+
+def test_trial_dataset_list_preserves_slim_dataset_fields(app: Flask):
+ class DatasetListItem:
+ id = "dataset-1"
+ name = "Dataset"
+ description = "description"
+ permission = "only_me"
+ data_source_type = "upload_file"
+ indexing_technique = "high_quality"
+ created_by = "user-1"
+ created_at = datetime(2024, 1, 1, tzinfo=UTC)
+ permission_keys = ["dataset.acl.readonly"]
+
+ @property
+ def app_count(self):
+ raise AssertionError("trial dataset list should not serialize detail-only computed fields")
+
+ api = module.DatasetListApi()
+ method = unwrap(api.get)
+ app_model = SimpleNamespace(tenant_id="tenant-1")
+
+ with (
+ app.test_request_context("/?page=1&limit=20&ids=dataset-1"),
+ patch.object(
+ module.DatasetService,
+ "get_datasets_by_ids",
+ return_value=([DatasetListItem()], 1),
+ ) as get_datasets,
+ ):
+ result = method(api, app_model)
+
+ get_datasets.assert_called_once_with(["dataset-1"], "tenant-1")
+ assert result == {
+ "data": [
+ {
+ "id": "dataset-1",
+ "name": "Dataset",
+ "description": "description",
+ "permission": "only_me",
+ "data_source_type": "upload_file",
+ "indexing_technique": "high_quality",
+ "created_by": "user-1",
+ "created_at": 1704067200,
+ "permission_keys": ["dataset.acl.readonly"],
+ }
+ ],
+ "has_more": False,
+ "limit": 20,
+ "total": 1,
+ "page": 1,
+ }
class TestTrialAppWorkflowRunApi:
diff --git a/api/tests/unit_tests/factories/test_file_factory.py b/api/tests/unit_tests/factories/test_file_factory.py
index 963612e68a6..d3e90b09f50 100644
--- a/api/tests/unit_tests/factories/test_file_factory.py
+++ b/api/tests/unit_tests/factories/test_file_factory.py
@@ -283,6 +283,7 @@ class TestExtractFilename:
result = extract_filename("http://example.com/path/file%20name%GG.txt?x=1", None)
# %GG is invalid, should be replaced with replacement character
+ assert result is not None
assert "file" in result
assert ".txt" in result
diff --git a/api/tests/unit_tests/fields/test_snippet_fields.py b/api/tests/unit_tests/fields/test_snippet_fields.py
index ad8ee6e8f0b..2d17a9e577a 100644
--- a/api/tests/unit_tests/fields/test_snippet_fields.py
+++ b/api/tests/unit_tests/fields/test_snippet_fields.py
@@ -1,3 +1,4 @@
+from datetime import UTC, datetime
from types import SimpleNamespace
from flask_restx import marshal
@@ -18,9 +19,9 @@ def test_snippet_list_fields_include_author_name() -> None:
tags=[],
created_by="account-1",
author_name="Alice",
- created_at=None,
+ created_at=datetime.fromtimestamp(1704067200, tz=UTC),
updated_by="account-1",
- updated_at=None,
+ updated_at=datetime.fromtimestamp(1704067201, tz=UTC),
)
result = marshal(snippet, snippet_list_fields)
diff --git a/e2e/features/agent-v2/support/preflight/models.ts b/e2e/features/agent-v2/support/preflight/models.ts
index 5c05c4187bf..02f032c4b91 100644
--- a/e2e/features/agent-v2/support/preflight/models.ts
+++ b/e2e/features/agent-v2/support/preflight/models.ts
@@ -1,4 +1,4 @@
-import type { ProviderWithModelsDataResponse } from '@dify/contracts/api/console/workspaces/types.gen'
+import type { ProviderWithModelsResponse } from '@dify/contracts/api/console/workspaces/types.gen'
import type { DifyWorld } from '../../../support/world'
import { createApiContext, expectApiResponseOK } from '../../../../support/api'
import { agentBuilderPreseededResources } from '../agent-builder-resources'
@@ -110,7 +110,7 @@ async function skipMissingAgentBuilderModel(
`/console/api/workspaces/current/models/model-types/${config.type}`,
)
await expectApiResponseOK(response, `Check ${config.resourceName}`)
- const body = (await response.json()) as ProviderWithModelsDataResponse
+ const body = (await response.json()) as { data: ProviderWithModelsResponse[] }
const provider = body.data.find(item => matchesProvider(item.provider, config.provider))
const model = provider?.models.find(
item =>
diff --git a/packages/contracts/generated/api/console/account/types.gen.ts b/packages/contracts/generated/api/console/account/types.gen.ts
index cdd45925fb2..1a7d1644f8f 100644
--- a/packages/contracts/generated/api/console/account/types.gen.ts
+++ b/packages/contracts/generated/api/console/account/types.gen.ts
@@ -12,7 +12,7 @@ export type AccountAvatarPayload = {
avatar: string
}
-export type Account = {
+export type AccountResponse = {
avatar?: string | null
readonly avatar_url: string | null
created_at?: number | null
@@ -140,7 +140,7 @@ export type AccountIntegrateResponse = {
provider: string
}
-export type AccountWritable = {
+export type AccountResponseWritable = {
avatar?: string | null
created_at?: number | null
email: string
@@ -177,7 +177,7 @@ export type PostAccountAvatarData = {
}
export type PostAccountAvatarResponses = {
- 200: Account
+ 200: AccountResponse
}
export type PostAccountAvatarResponse = PostAccountAvatarResponses[keyof PostAccountAvatarResponses]
@@ -218,7 +218,7 @@ export type PostAccountChangeEmailResetData = {
}
export type PostAccountChangeEmailResetResponses = {
- 200: Account
+ 200: AccountResponse
}
export type PostAccountChangeEmailResetResponse
@@ -374,7 +374,7 @@ export type PostAccountInterfaceLanguageData = {
}
export type PostAccountInterfaceLanguageResponses = {
- 200: Account
+ 200: AccountResponse
}
export type PostAccountInterfaceLanguageResponse
@@ -388,7 +388,7 @@ export type PostAccountInterfaceThemeData = {
}
export type PostAccountInterfaceThemeResponses = {
- 200: Account
+ 200: AccountResponse
}
export type PostAccountInterfaceThemeResponse
@@ -402,7 +402,7 @@ export type PostAccountNameData = {
}
export type PostAccountNameResponses = {
- 200: Account
+ 200: AccountResponse
}
export type PostAccountNameResponse = PostAccountNameResponses[keyof PostAccountNameResponses]
@@ -415,7 +415,7 @@ export type PostAccountPasswordData = {
}
export type PostAccountPasswordResponses = {
- 200: Account
+ 200: AccountResponse
}
export type PostAccountPasswordResponse
@@ -429,7 +429,7 @@ export type GetAccountProfileData = {
}
export type GetAccountProfileResponses = {
- 200: Account
+ 200: AccountResponse
}
export type GetAccountProfileResponse = GetAccountProfileResponses[keyof GetAccountProfileResponses]
@@ -442,7 +442,7 @@ export type PostAccountTimezoneData = {
}
export type PostAccountTimezoneResponses = {
- 200: Account
+ 200: AccountResponse
}
export type PostAccountTimezoneResponse
diff --git a/packages/contracts/generated/api/console/account/zod.gen.ts b/packages/contracts/generated/api/console/account/zod.gen.ts
index 9951efc8d9f..cba539b0316 100644
--- a/packages/contracts/generated/api/console/account/zod.gen.ts
+++ b/packages/contracts/generated/api/console/account/zod.gen.ts
@@ -17,9 +17,9 @@ export const zAccountAvatarPayload = z.object({
})
/**
- * Account
+ * AccountResponse
*/
-export const zAccount = z.object({
+export const zAccountResponse = z.object({
avatar: z.string().nullish(),
avatar_url: z.string().nullable(),
created_at: z.int().nullish(),
@@ -212,9 +212,9 @@ export const zAccountIntegrateListResponse = z.object({
})
/**
- * Account
+ * AccountResponse
*/
-export const zAccountWritable = z.object({
+export const zAccountResponseWritable = z.object({
avatar: z.string().nullish(),
created_at: z.int().nullish(),
email: z.string(),
@@ -242,7 +242,7 @@ export const zPostAccountAvatarBody = zAccountAvatarPayload
/**
* Success
*/
-export const zPostAccountAvatarResponse = zAccount
+export const zPostAccountAvatarResponse = zAccountResponse
export const zPostAccountChangeEmailBody = zChangeEmailSendPayload
@@ -263,7 +263,7 @@ export const zPostAccountChangeEmailResetBody = zChangeEmailResetPayload
/**
* Success
*/
-export const zPostAccountChangeEmailResetResponse = zAccount
+export const zPostAccountChangeEmailResetResponse = zAccountResponse
export const zPostAccountChangeEmailValidityBody = zChangeEmailValidityPayload
@@ -336,37 +336,37 @@ export const zPostAccountInterfaceLanguageBody = zAccountInterfaceLanguagePayloa
/**
* Success
*/
-export const zPostAccountInterfaceLanguageResponse = zAccount
+export const zPostAccountInterfaceLanguageResponse = zAccountResponse
export const zPostAccountInterfaceThemeBody = zAccountInterfaceThemePayload
/**
* Success
*/
-export const zPostAccountInterfaceThemeResponse = zAccount
+export const zPostAccountInterfaceThemeResponse = zAccountResponse
export const zPostAccountNameBody = zAccountNamePayload
/**
* Success
*/
-export const zPostAccountNameResponse = zAccount
+export const zPostAccountNameResponse = zAccountResponse
export const zPostAccountPasswordBody = zAccountPasswordPayload
/**
* Success
*/
-export const zPostAccountPasswordResponse = zAccount
+export const zPostAccountPasswordResponse = zAccountResponse
/**
* Success
*/
-export const zGetAccountProfileResponse = zAccount
+export const zGetAccountProfileResponse = zAccountResponse
export const zPostAccountTimezoneBody = zAccountTimezonePayload
/**
* Success
*/
-export const zPostAccountTimezoneResponse = zAccount
+export const zPostAccountTimezoneResponse = zAccountResponse
diff --git a/packages/contracts/generated/api/console/api-based-extension/zod.gen.ts b/packages/contracts/generated/api/console/api-based-extension/zod.gen.ts
index 468e9d09efc..745f6ddb107 100644
--- a/packages/contracts/generated/api/console/api-based-extension/zod.gen.ts
+++ b/packages/contracts/generated/api/console/api-based-extension/zod.gen.ts
@@ -22,6 +22,9 @@ export const zApiBasedExtensionResponse = z.object({
name: z.string(),
})
+/**
+ * APIBasedExtensionListResponse
+ */
export const zApiBasedExtensionListResponse = z.array(zApiBasedExtensionResponse)
/**
diff --git a/packages/contracts/generated/api/console/apps/types.gen.ts b/packages/contracts/generated/api/console/apps/types.gen.ts
index 6c8ab2f2cf2..21473d5bd88 100644
--- a/packages/contracts/generated/api/console/apps/types.gen.ts
+++ b/packages/contracts/generated/api/console/apps/types.gen.ts
@@ -826,7 +826,7 @@ export type WorkflowRunPaginationResponse = {
export type WorkflowRunDetailResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
created_by_role?: string | null
elapsed_time?: number | null
@@ -894,7 +894,7 @@ export type WorkflowCommentCreate = {
}
export type WorkflowCommentMentionUsersPayload = {
- users: Array<AccountWithRole>
+ users: Array<AccountWithRoleResponse>
}
export type WorkflowCommentDetail = {
@@ -982,7 +982,7 @@ export type DefaultBlockConfigResponse = {
export type WorkflowResponse = {
conversation_variables: Array<WorkflowConversationVariableResponse>
created_at: number
- created_by?: SimpleAccount | null
+ created_by?: SimpleAccountResponse | null
environment_variables: Array<WorkflowEnvironmentVariableResponse>
features: {
[key: string]: unknown
@@ -997,7 +997,7 @@ export type WorkflowResponse = {
rag_pipeline_variables: Array<PipelineVariableResponse>
tool_published: boolean
updated_at: number
- updated_by?: SimpleAccount | null
+ updated_by?: SimpleAccountResponse | null
version: string
}
@@ -1124,7 +1124,7 @@ export type AgentComposerValidateResponse = {
export type WorkflowRunNodeExecutionResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
created_by_role?: string | null
elapsed_time?: number | null
@@ -1384,7 +1384,7 @@ export type WorkflowOnlineUsersByApp = {
export type AdvancedChatWorkflowRunForListResponse = {
conversation_id?: string | null
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
elapsed_time?: number | null
exceptions_count?: number | null
finished_at?: number | null
@@ -1755,7 +1755,7 @@ export type TextToSpeechVoiceResponse = {
export type WorkflowAppLogPartialResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
created_by_role?: string | null
created_from?: string | null
@@ -1766,7 +1766,7 @@ export type WorkflowAppLogPartialResponse = {
export type WorkflowArchivedLogPartialResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
id: string
trigger_metadata?: unknown
@@ -1775,7 +1775,7 @@ export type WorkflowArchivedLogPartialResponse = {
export type WorkflowRunForListResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
elapsed_time?: number | null
exceptions_count?: number | null
finished_at?: number | null
@@ -1787,7 +1787,7 @@ export type WorkflowRunForListResponse = {
version?: string | null
}
-export type SimpleAccount = {
+export type SimpleAccountResponse = {
email: string
id: string
name: string
@@ -1830,7 +1830,7 @@ export type WorkflowCommentBasic = {
updated_at?: number | null
}
-export type AccountWithRole = {
+export type AccountWithRoleResponse = {
avatar?: string | null
readonly avatar_url: string | null
created_at?: number | null
@@ -2256,6 +2256,12 @@ export type SimpleMessageDetail = {
query: string
}
+export type SimpleAccount = {
+ email: string
+ id: string
+ name: string
+}
+
export type HumanInputFormDefinition = {
actions?: Array<UserActionConfig>
display_in_ui?: boolean
@@ -3049,7 +3055,7 @@ export type WorkflowCommentBasicListWritable = {
}
export type WorkflowCommentMentionUsersPayloadWritable = {
- users: Array<AccountWithRoleWritable>
+ users: Array<AccountWithRoleResponseWritable>
}
export type WorkflowCommentDetailWritable = {
@@ -3142,7 +3148,7 @@ export type WorkflowCommentBasicWritable = {
updated_at?: number | null
}
-export type AccountWithRoleWritable = {
+export type AccountWithRoleResponseWritable = {
avatar?: string | null
created_at?: number | null
email: string
diff --git a/packages/contracts/generated/api/console/apps/zod.gen.ts b/packages/contracts/generated/api/console/apps/zod.gen.ts
index dfa767fd22e..9a928ee68e4 100644
--- a/packages/contracts/generated/api/console/apps/zod.gen.ts
+++ b/packages/contracts/generated/api/console/apps/zod.gen.ts
@@ -1525,9 +1525,9 @@ export const zTextToSpeechVoiceResponse = z.object({
export const zTextToSpeechVoiceListResponse = z.array(zTextToSpeechVoiceResponse)
/**
- * SimpleAccount
+ * SimpleAccountResponse
*/
-export const zSimpleAccount = z.object({
+export const zSimpleAccountResponse = z.object({
email: z.string(),
id: z.string(),
name: z.string(),
@@ -1539,7 +1539,7 @@ export const zSimpleAccount = z.object({
export const zAdvancedChatWorkflowRunForListResponse = z.object({
conversation_id: z.string().nullish(),
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
elapsed_time: z.number().nullish(),
exceptions_count: z.int().nullish(),
finished_at: z.int().nullish(),
@@ -1561,72 +1561,12 @@ export const zAdvancedChatWorkflowRunPaginationResponse = z.object({
limit: z.int(),
})
-/**
- * ConversationAnnotation
- */
-export const zConversationAnnotation = z.object({
- account: zSimpleAccount.nullish(),
- content: z.string(),
- created_at: z.int().nullish(),
- id: z.string(),
- question: z.string().nullish(),
-})
-
-/**
- * ConversationAnnotationHitHistory
- */
-export const zConversationAnnotationHitHistory = z.object({
- annotation_create_account: zSimpleAccount.nullish(),
- annotation_id: z.string(),
- created_at: z.int().nullish(),
-})
-
-/**
- * Feedback
- */
-export const zFeedback = z.object({
- content: z.string().nullish(),
- from_account: zSimpleAccount.nullish(),
- from_end_user_id: z.string().nullish(),
- from_source: z.string(),
- rating: z.string(),
-})
-
-/**
- * MessageDetail
- */
-export const zMessageDetail = z.object({
- agent_thoughts: z.array(zAgentThought),
- annotation: zConversationAnnotation.nullish(),
- annotation_hit_history: zConversationAnnotationHitHistory.nullish(),
- answer: z.string(),
- answer_tokens: z.int(),
- conversation_id: z.string(),
- created_at: z.int().nullish(),
- error: z.string().nullish(),
- feedbacks: z.array(zFeedback),
- from_account_id: z.string().nullish(),
- from_end_user_id: z.string().nullish(),
- from_source: z.string(),
- id: z.string(),
- inputs: z.record(z.string(), zJsonValue),
- message: zJsonValue,
- message_files: z.array(zMessageFile),
- message_tokens: z.int(),
- metadata: zJsonValue,
- parent_message_id: z.string().nullish(),
- provider_response_latency: z.number(),
- query: z.string(),
- status: z.string(),
- workflow_run_id: z.string().nullish(),
-})
-
/**
* WorkflowRunForListResponse
*/
export const zWorkflowRunForListResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
elapsed_time: z.number().nullish(),
exceptions_count: z.int().nullish(),
finished_at: z.int().nullish(),
@@ -1662,7 +1602,7 @@ export const zSimpleEndUser = z.object({
*/
export const zWorkflowRunDetailResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
created_by_role: z.string().nullish(),
elapsed_time: z.number().nullish(),
@@ -1684,7 +1624,7 @@ export const zWorkflowRunDetailResponse = z.object({
*/
export const zWorkflowRunNodeExecutionResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
created_by_role: z.string().nullish(),
elapsed_time: z.number().nullish(),
@@ -1750,9 +1690,9 @@ export const zSandboxUploadResponse = z.object({
})
/**
- * AccountWithRole
+ * AccountWithRoleResponse
*/
-export const zAccountWithRole = z.object({
+export const zAccountWithRoleResponse = z.object({
avatar: z.string().nullish(),
avatar_url: z.string().nullable(),
created_at: z.int().nullish(),
@@ -1770,7 +1710,7 @@ export const zAccountWithRole = z.object({
* WorkflowCommentMentionUsersPayload
*/
export const zWorkflowCommentMentionUsersPayload = z.object({
- users: z.array(zAccountWithRole),
+ users: z.array(zAccountWithRoleResponse),
})
/**
@@ -1959,7 +1899,7 @@ export const zPipelineVariableResponse = z.object({
export const zWorkflowResponse = z.object({
conversation_variables: z.array(zWorkflowConversationVariableResponse),
created_at: z.int(),
- created_by: zSimpleAccount.nullish(),
+ created_by: zSimpleAccountResponse.nullish(),
environment_variables: z.array(zWorkflowEnvironmentVariableResponse),
features: z.record(z.string(), z.unknown()),
graph: z.record(z.string(), z.unknown()),
@@ -1970,7 +1910,7 @@ export const zWorkflowResponse = z.object({
rag_pipeline_variables: z.array(zPipelineVariableResponse),
tool_published: z.boolean(),
updated_at: z.int(),
- updated_by: zSimpleAccount.nullish(),
+ updated_by: zSimpleAccountResponse.nullish(),
version: z.string(),
})
@@ -2395,20 +2335,6 @@ export const zConversationDetail = z.object({
user_feedback_stats: zFeedbackStat.nullish(),
})
-/**
- * ConversationMessageDetail
- */
-export const zConversationMessageDetail = z.object({
- created_at: z.int().nullish(),
- from_account_id: z.string().nullish(),
- from_end_user_id: z.string().nullish(),
- from_source: z.string(),
- id: z.string(),
- message: zMessageDetail.nullish(),
- model_config: zModelConfig.nullish(),
- status: z.string(),
-})
-
/**
* Type
*/
@@ -2609,6 +2535,26 @@ export const zSimpleMessageDetail = z.object({
query: z.string(),
})
+/**
+ * SimpleAccount
+ */
+export const zSimpleAccount = z.object({
+ email: z.string(),
+ id: z.string(),
+ name: z.string(),
+})
+
+/**
+ * ConversationAnnotation
+ */
+export const zConversationAnnotation = z.object({
+ account: zSimpleAccount.nullish(),
+ content: z.string(),
+ created_at: z.int().nullish(),
+ id: z.string(),
+ question: z.string().nullish(),
+})
+
/**
* Conversation
*/
@@ -2641,6 +2587,69 @@ export const zConversationPagination = z.object({
total: z.int(),
})
+/**
+ * ConversationAnnotationHitHistory
+ */
+export const zConversationAnnotationHitHistory = z.object({
+ annotation_create_account: zSimpleAccount.nullish(),
+ annotation_id: z.string(),
+ created_at: z.int().nullish(),
+})
+
+/**
+ * Feedback
+ */
+export const zFeedback = z.object({
+ content: z.string().nullish(),
+ from_account: zSimpleAccount.nullish(),
+ from_end_user_id: z.string().nullish(),
+ from_source: z.string(),
+ rating: z.string(),
+})
+
+/**
+ * MessageDetail
+ */
+export const zMessageDetail = z.object({
+ agent_thoughts: z.array(zAgentThought),
+ annotation: zConversationAnnotation.nullish(),
+ annotation_hit_history: zConversationAnnotationHitHistory.nullish(),
+ answer: z.string(),
+ answer_tokens: z.int(),
+ conversation_id: z.string(),
+ created_at: z.int().nullish(),
+ error: z.string().nullish(),
+ feedbacks: z.array(zFeedback),
+ from_account_id: z.string().nullish(),
+ from_end_user_id: z.string().nullish(),
+ from_source: z.string(),
+ id: z.string(),
+ inputs: z.record(z.string(), zJsonValue),
+ message: zJsonValue,
+ message_files: z.array(zMessageFile),
+ message_tokens: z.int(),
+ metadata: zJsonValue,
+ parent_message_id: z.string().nullish(),
+ provider_response_latency: z.number(),
+ query: z.string(),
+ status: z.string(),
+ workflow_run_id: z.string().nullish(),
+})
+
+/**
+ * ConversationMessageDetail
+ */
+export const zConversationMessageDetail = z.object({
+ created_at: z.int().nullish(),
+ from_account_id: z.string().nullish(),
+ from_end_user_id: z.string().nullish(),
+ from_source: z.string(),
+ id: z.string(),
+ message: zMessageDetail.nullish(),
+ model_config: zModelConfig.nullish(),
+ status: z.string(),
+})
+
/**
* ExecutionContentType
*/
@@ -2668,7 +2677,7 @@ export const zWorkflowRunForLogResponse = z.object({
*/
export const zWorkflowAppLogPartialResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
created_by_role: z.string().nullish(),
created_from: z.string().nullish(),
@@ -2704,7 +2713,7 @@ export const zWorkflowRunForArchivedLogResponse = z.object({
*/
export const zWorkflowArchivedLogPartialResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
id: z.string(),
trigger_metadata: z.unknown().optional(),
@@ -4185,9 +4194,9 @@ export const zAppDetailWithSiteWritable = z.object({
})
/**
- * AccountWithRole
+ * AccountWithRoleResponse
*/
-export const zAccountWithRoleWritable = z.object({
+export const zAccountWithRoleResponseWritable = z.object({
avatar: z.string().nullish(),
created_at: z.int().nullish(),
email: z.string(),
@@ -4204,7 +4213,7 @@ export const zAccountWithRoleWritable = z.object({
* WorkflowCommentMentionUsersPayload
*/
export const zWorkflowCommentMentionUsersPayloadWritable = z.object({
- users: z.array(zAccountWithRoleWritable),
+ users: z.array(zAccountWithRoleResponseWritable),
})
/**
diff --git a/packages/contracts/generated/api/console/installed-apps/types.gen.ts b/packages/contracts/generated/api/console/installed-apps/types.gen.ts
index 52c7c5da525..4692d77db63 100644
--- a/packages/contracts/generated/api/console/installed-apps/types.gen.ts
+++ b/packages/contracts/generated/api/console/installed-apps/types.gen.ts
@@ -45,8 +45,6 @@ export type ChatMessagePayload = {
retriever_from?: string
}
-export type GeneratedAppResponse = JsonValue
-
export type SimpleResultResponse = {
result: string
}
@@ -411,8 +409,6 @@ export type InstalledAppListResponseWritable = {
installed_apps: Array<InstalledAppResponseWritable>
}
-export type GeneratedAppResponseWritable = JsonValue
-
export type InstalledAppResponseWritable = {
app: InstalledAppInfoResponseWritable
app_owner_tenant_id: string
@@ -520,7 +516,9 @@ export type PostInstalledAppsByInstalledAppIdChatMessagesData = {
}
export type PostInstalledAppsByInstalledAppIdChatMessagesResponses = {
- 200: GeneratedAppResponse
+ 200: {
+ [key: string]: unknown
+ }
}
export type PostInstalledAppsByInstalledAppIdChatMessagesResponse
@@ -553,7 +551,9 @@ export type PostInstalledAppsByInstalledAppIdCompletionMessagesData = {
}
export type PostInstalledAppsByInstalledAppIdCompletionMessagesResponses = {
- 200: GeneratedAppResponse
+ 200: {
+ [key: string]: unknown
+ }
}
export type PostInstalledAppsByInstalledAppIdCompletionMessagesResponse
@@ -714,7 +714,9 @@ export type GetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisData
}
export type GetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponses = {
- 200: GeneratedAppResponse
+ 200: {
+ [key: string]: unknown
+ }
}
export type GetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponse
@@ -847,7 +849,9 @@ export type PostInstalledAppsByInstalledAppIdWorkflowsRunData = {
}
export type PostInstalledAppsByInstalledAppIdWorkflowsRunResponses = {
- 200: GeneratedAppResponse
+ 200: {
+ [key: string]: unknown
+ }
}
export type PostInstalledAppsByInstalledAppIdWorkflowsRunResponse
diff --git a/packages/contracts/generated/api/console/installed-apps/zod.gen.ts b/packages/contracts/generated/api/console/installed-apps/zod.gen.ts
index 1450cdce1e2..6e5680ab1b8 100644
--- a/packages/contracts/generated/api/console/installed-apps/zod.gen.ts
+++ b/packages/contracts/generated/api/console/installed-apps/zod.gen.ts
@@ -174,11 +174,6 @@ export const zJsonValue = z
])
.nullable()
-/**
- * GeneratedAppResponse
- */
-export const zGeneratedAppResponse = zJsonValue
-
/**
* SimpleConversation
*/
@@ -540,11 +535,6 @@ export const zExploreMessageInfiniteScrollPagination = z.object({
limit: z.int(),
})
-/**
- * GeneratedAppResponse
- */
-export const zGeneratedAppResponseWritable = zJsonValue
-
/**
* InstalledAppInfoResponse
*/
@@ -633,7 +623,10 @@ export const zPostInstalledAppsByInstalledAppIdChatMessagesPath = z.object({
/**
* Success
*/
-export const zPostInstalledAppsByInstalledAppIdChatMessagesResponse = zGeneratedAppResponse
+export const zPostInstalledAppsByInstalledAppIdChatMessagesResponse = z.record(
+ z.string(),
+ z.unknown(),
+)
export const zPostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopPath = z.object({
installed_app_id: z.uuid(),
@@ -656,7 +649,10 @@ export const zPostInstalledAppsByInstalledAppIdCompletionMessagesPath = z.object
/**
* Success
*/
-export const zPostInstalledAppsByInstalledAppIdCompletionMessagesResponse = zGeneratedAppResponse
+export const zPostInstalledAppsByInstalledAppIdCompletionMessagesResponse = z.record(
+ z.string(),
+ z.unknown(),
+)
export const zPostInstalledAppsByInstalledAppIdCompletionMessagesByTaskIdStopPath = z.object({
installed_app_id: z.uuid(),
@@ -770,8 +766,10 @@ export const zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisQue
/**
* Success
*/
-export const zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponse
- = zGeneratedAppResponse
+export const zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponse = z.record(
+ z.string(),
+ z.unknown(),
+)
export const zGetInstalledAppsByInstalledAppIdMessagesByMessageIdSuggestedQuestionsPath = z.object({
installed_app_id: z.uuid(),
@@ -858,7 +856,10 @@ export const zPostInstalledAppsByInstalledAppIdWorkflowsRunPath = z.object({
/**
* Success
*/
-export const zPostInstalledAppsByInstalledAppIdWorkflowsRunResponse = zGeneratedAppResponse
+export const zPostInstalledAppsByInstalledAppIdWorkflowsRunResponse = z.record(
+ z.string(),
+ z.unknown(),
+)
export const zPostInstalledAppsByInstalledAppIdWorkflowsTasksByTaskIdStopPath = z.object({
installed_app_id: z.uuid(),
diff --git a/packages/contracts/generated/api/console/rag/types.gen.ts b/packages/contracts/generated/api/console/rag/types.gen.ts
index b9862a8d1e8..5a6c903c383 100644
--- a/packages/contracts/generated/api/console/rag/types.gen.ts
+++ b/packages/contracts/generated/api/console/rag/types.gen.ts
@@ -119,7 +119,7 @@ export type SimpleResultResponse = {
export type WorkflowRunDetailResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
created_by_role?: string | null
elapsed_time?: number | null
@@ -158,7 +158,7 @@ export type DefaultBlockConfigResponse = {
export type WorkflowResponse = {
conversation_variables: Array<WorkflowConversationVariableResponse>
created_at: number
- created_by?: SimpleAccount | null
+ created_by?: SimpleAccountResponse | null
environment_variables: Array<WorkflowEnvironmentVariableResponse>
features: {
[key: string]: unknown
@@ -173,7 +173,7 @@ export type WorkflowResponse = {
rag_pipeline_variables: Array<PipelineVariableResponse>
tool_published: boolean
updated_at: number
- updated_by?: SimpleAccount | null
+ updated_by?: SimpleAccountResponse | null
version: string
}
@@ -221,7 +221,7 @@ export type DatasourceVariablesPayload = {
export type WorkflowRunNodeExecutionResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
created_by_role?: string | null
elapsed_time?: number | null
@@ -421,7 +421,7 @@ export type PluginDependency = {
export type WorkflowRunForListResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
elapsed_time?: number | null
exceptions_count?: number | null
finished_at?: number | null
@@ -433,7 +433,7 @@ export type WorkflowRunForListResponse = {
version?: string | null
}
-export type SimpleAccount = {
+export type SimpleAccountResponse = {
email: string
id: string
name: string
diff --git a/packages/contracts/generated/api/console/rag/zod.gen.ts b/packages/contracts/generated/api/console/rag/zod.gen.ts
index 717db30baa7..5edc412926a 100644
--- a/packages/contracts/generated/api/console/rag/zod.gen.ts
+++ b/packages/contracts/generated/api/console/rag/zod.gen.ts
@@ -322,9 +322,9 @@ export const zPipelineTemplateListResponse = z.object({
})
/**
- * SimpleAccount
+ * SimpleAccountResponse
*/
-export const zSimpleAccount = z.object({
+export const zSimpleAccountResponse = z.object({
email: z.string(),
id: z.string(),
name: z.string(),
@@ -335,7 +335,7 @@ export const zSimpleAccount = z.object({
*/
export const zWorkflowRunForListResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
elapsed_time: z.number().nullish(),
exceptions_count: z.int().nullish(),
finished_at: z.int().nullish(),
@@ -371,7 +371,7 @@ export const zSimpleEndUser = z.object({
*/
export const zWorkflowRunDetailResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
created_by_role: z.string().nullish(),
elapsed_time: z.number().nullish(),
@@ -393,7 +393,7 @@ export const zWorkflowRunDetailResponse = z.object({
*/
export const zWorkflowRunNodeExecutionResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
created_by_role: z.string().nullish(),
elapsed_time: z.number().nullish(),
@@ -471,7 +471,7 @@ export const zPipelineVariableResponse = z.object({
export const zWorkflowResponse = z.object({
conversation_variables: z.array(zWorkflowConversationVariableResponse),
created_at: z.int(),
- created_by: zSimpleAccount.nullish(),
+ created_by: zSimpleAccountResponse.nullish(),
environment_variables: z.array(zWorkflowEnvironmentVariableResponse),
features: z.record(z.string(), z.unknown()),
graph: z.record(z.string(), z.unknown()),
@@ -482,7 +482,7 @@ export const zWorkflowResponse = z.object({
rag_pipeline_variables: z.array(zPipelineVariableResponse),
tool_published: z.boolean(),
updated_at: z.int(),
- updated_by: zSimpleAccount.nullish(),
+ updated_by: zSimpleAccountResponse.nullish(),
version: z.string(),
})
diff --git a/packages/contracts/generated/api/console/snippets/types.gen.ts b/packages/contracts/generated/api/console/snippets/types.gen.ts
index 8e4279acb23..4bc9db22ee9 100644
--- a/packages/contracts/generated/api/console/snippets/types.gen.ts
+++ b/packages/contracts/generated/api/console/snippets/types.gen.ts
@@ -16,7 +16,7 @@ export type SimpleResultResponse = {
export type WorkflowRunDetailResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
created_by_role?: string | null
elapsed_time?: number | null
@@ -51,7 +51,7 @@ export type DefaultBlockConfigsResponse = Array<{
export type SnippetWorkflowResponse = {
conversation_variables: Array<WorkflowConversationVariableResponse>
created_at: number
- created_by?: SimpleAccount | null
+ created_by?: SimpleAccountResponse | null
environment_variables: Array<WorkflowEnvironmentVariableResponse>
features: {
[key: string]: unknown
@@ -69,7 +69,7 @@ export type SnippetWorkflowResponse = {
rag_pipeline_variables: Array<PipelineVariableResponse>
tool_published: boolean
updated_at: number
- updated_by?: SimpleAccount | null
+ updated_by?: SimpleAccountResponse | null
version: string
}
@@ -120,7 +120,7 @@ export type SnippetLoopNodeRunPayload = {
export type WorkflowRunNodeExecutionResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
created_by_role?: string | null
elapsed_time?: number | null
@@ -215,7 +215,7 @@ export type WorkflowUpdatePayload = {
export type WorkflowRunForListResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
elapsed_time?: number | null
exceptions_count?: number | null
finished_at?: number | null
@@ -227,7 +227,7 @@ export type WorkflowRunForListResponse = {
version?: string | null
}
-export type SimpleAccount = {
+export type SimpleAccountResponse = {
email: string
id: string
name: string
diff --git a/packages/contracts/generated/api/console/snippets/zod.gen.ts b/packages/contracts/generated/api/console/snippets/zod.gen.ts
index b8386c8a03b..5909bc5f332 100644
--- a/packages/contracts/generated/api/console/snippets/zod.gen.ts
+++ b/packages/contracts/generated/api/console/snippets/zod.gen.ts
@@ -142,9 +142,9 @@ export const zWorkflowUpdatePayload = z.object({
})
/**
- * SimpleAccount
+ * SimpleAccountResponse
*/
-export const zSimpleAccount = z.object({
+export const zSimpleAccountResponse = z.object({
email: z.string(),
id: z.string(),
name: z.string(),
@@ -155,7 +155,7 @@ export const zSimpleAccount = z.object({
*/
export const zWorkflowRunForListResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
elapsed_time: z.number().nullish(),
exceptions_count: z.int().nullish(),
finished_at: z.int().nullish(),
@@ -191,7 +191,7 @@ export const zSimpleEndUser = z.object({
*/
export const zWorkflowRunDetailResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
created_by_role: z.string().nullish(),
elapsed_time: z.number().nullish(),
@@ -213,7 +213,7 @@ export const zWorkflowRunDetailResponse = z.object({
*/
export const zWorkflowRunNodeExecutionResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
created_by_role: z.string().nullish(),
elapsed_time: z.number().nullish(),
@@ -291,7 +291,7 @@ export const zPipelineVariableResponse = z.object({
export const zSnippetWorkflowResponse = z.object({
conversation_variables: z.array(zWorkflowConversationVariableResponse),
created_at: z.int(),
- created_by: zSimpleAccount.nullish(),
+ created_by: zSimpleAccountResponse.nullish(),
environment_variables: z.array(zWorkflowEnvironmentVariableResponse),
features: z.record(z.string(), z.unknown()),
graph: z.record(z.string(), z.unknown()),
@@ -303,7 +303,7 @@ export const zSnippetWorkflowResponse = z.object({
rag_pipeline_variables: z.array(zPipelineVariableResponse),
tool_published: z.boolean(),
updated_at: z.int(),
- updated_by: zSimpleAccount.nullish(),
+ updated_by: zSimpleAccountResponse.nullish(),
version: z.string(),
})
diff --git a/packages/contracts/generated/api/console/tags/types.gen.ts b/packages/contracts/generated/api/console/tags/types.gen.ts
index 33b39716e6e..14c7c9c722b 100644
--- a/packages/contracts/generated/api/console/tags/types.gen.ts
+++ b/packages/contracts/generated/api/console/tags/types.gen.ts
@@ -4,6 +4,13 @@ export type ClientOptions = {
baseUrl: `${string}://${string}/console/api` | (string & {})
}
+export type TagListResponse = Array<TagResponse>
+
+export type TagBasePayload = {
+ name: string
+ type: TagType
+}
+
export type TagResponse = {
binding_count?: string | null
id: string
@@ -11,11 +18,6 @@ export type TagResponse = {
type?: string | null
}
-export type TagBasePayload = {
- name: string
- type: TagType
-}
-
export type TagUpdateRequestPayload = {
name: string
}
@@ -33,7 +35,7 @@ export type GetTagsData = {
}
export type GetTagsResponses = {
- 200: Array<TagResponse>
+ 200: TagListResponse
}
export type GetTagsResponse = GetTagsResponses[keyof GetTagsResponses]
diff --git a/packages/contracts/generated/api/console/tags/zod.gen.ts b/packages/contracts/generated/api/console/tags/zod.gen.ts
index 20f28eaa059..7cab6b4df9e 100644
--- a/packages/contracts/generated/api/console/tags/zod.gen.ts
+++ b/packages/contracts/generated/api/console/tags/zod.gen.ts
@@ -12,6 +12,11 @@ export const zTagResponse = z.object({
type: z.string().nullish(),
})
+/**
+ * TagListResponse
+ */
+export const zTagListResponse = z.array(zTagResponse)
+
/**
* TagUpdateRequestPayload
*/
@@ -42,7 +47,7 @@ export const zGetTagsQuery = z.object({
/**
* Success
*/
-export const zGetTagsResponse = z.array(zTagResponse)
+export const zGetTagsResponse = zTagListResponse
export const zPostTagsBody = zTagBasePayload
diff --git a/packages/contracts/generated/api/console/trial-apps/types.gen.ts b/packages/contracts/generated/api/console/trial-apps/types.gen.ts
index 9e8f01540be..7a5f4f9f755 100644
--- a/packages/contracts/generated/api/console/trial-apps/types.gen.ts
+++ b/packages/contracts/generated/api/console/trial-apps/types.gen.ts
@@ -115,7 +115,7 @@ export type AudioBinaryResponse = Blob | File
export type TrialWorkflowResponse = {
conversation_variables?: Array<JsonObject2>
created_at?: number | null
- created_by?: TrialWorkflowAccount | null
+ created_by?: TrialSimpleAccount | null
environment_variables?: Array<JsonObject2>
features?: JsonObject2
graph: JsonObject2
@@ -126,7 +126,7 @@ export type TrialWorkflowResponse = {
rag_pipeline_variables?: Array<JsonObject2>
tool_published?: boolean | null
updated_at?: number | null
- updated_by?: TrialWorkflowAccount | null
+ updated_by?: TrialSimpleAccount | null
version?: string | null
}
@@ -259,7 +259,7 @@ export type JsonObject2 = {
[key: string]: unknown
}
-export type TrialWorkflowAccount = {
+export type TrialSimpleAccount = {
email?: string | null
id: string
name?: string | null
diff --git a/packages/contracts/generated/api/console/trial-apps/zod.gen.ts b/packages/contracts/generated/api/console/trial-apps/zod.gen.ts
index 0a7be25c6e3..5570ab88640 100644
--- a/packages/contracts/generated/api/console/trial-apps/zod.gen.ts
+++ b/packages/contracts/generated/api/console/trial-apps/zod.gen.ts
@@ -236,9 +236,9 @@ export const zParameters = z.object({
export const zJsonObject2 = z.record(z.string(), z.unknown())
/**
- * TrialWorkflowAccount
+ * TrialSimpleAccount
*/
-export const zTrialWorkflowAccount = z.object({
+export const zTrialSimpleAccount = z.object({
email: z.string().nullish(),
id: z.string(),
name: z.string().nullish(),
@@ -250,7 +250,7 @@ export const zTrialWorkflowAccount = z.object({
export const zTrialWorkflowResponse = z.object({
conversation_variables: z.array(zJsonObject2).optional(),
created_at: z.int().nullish(),
- created_by: zTrialWorkflowAccount.nullish(),
+ created_by: zTrialSimpleAccount.nullish(),
environment_variables: z.array(zJsonObject2).optional(),
features: zJsonObject2.optional(),
graph: zJsonObject2,
@@ -261,7 +261,7 @@ export const zTrialWorkflowResponse = z.object({
rag_pipeline_variables: z.array(zJsonObject2).optional(),
tool_published: z.boolean().nullish(),
updated_at: z.int().nullish(),
- updated_by: zTrialWorkflowAccount.nullish(),
+ updated_by: zTrialSimpleAccount.nullish(),
version: z.string().nullish(),
})
diff --git a/packages/contracts/generated/api/console/workspaces/types.gen.ts b/packages/contracts/generated/api/console/workspaces/types.gen.ts
index de5199273f9..3861b005a03 100644
--- a/packages/contracts/generated/api/console/workspaces/types.gen.ts
+++ b/packages/contracts/generated/api/console/workspaces/types.gen.ts
@@ -109,8 +109,8 @@ export type SnippetUseCountResponse = {
use_count: number
}
-export type AccountWithRoleList = {
- accounts: Array<AccountWithRole>
+export type AccountWithRoleListResponse = {
+ accounts: Array<AccountWithRoleResponse>
}
export type DefaultModelDataResponse = {
@@ -1009,7 +1009,7 @@ export type PluginDependency = {
value: Github | Marketplace | Package
}
-export type AccountWithRole = {
+export type AccountWithRoleResponse = {
avatar?: string | null
readonly avatar_url: string | null
created_at?: number | null
@@ -1823,11 +1823,11 @@ export type RestrictModel = {
export type CorePluginEntitiesParametersPluginParameterAutoGenerateType = 'prompt_instruction'
-export type AccountWithRoleListWritable = {
- accounts: Array<AccountWithRoleWritable>
+export type AccountWithRoleListResponseWritable = {
+ accounts: Array<AccountWithRoleResponseWritable>
}
-export type AccountWithRoleWritable = {
+export type AccountWithRoleResponseWritable = {
avatar?: string | null
created_at?: number | null
email: string
@@ -2108,7 +2108,7 @@ export type GetWorkspacesCurrentDatasetOperatorsData = {
}
export type GetWorkspacesCurrentDatasetOperatorsResponses = {
- 200: AccountWithRoleList
+ 200: AccountWithRoleListResponse
}
export type GetWorkspacesCurrentDatasetOperatorsResponse
@@ -2335,7 +2335,7 @@ export type GetWorkspacesCurrentMembersData = {
}
export type GetWorkspacesCurrentMembersResponses = {
- 200: AccountWithRoleList
+ 200: AccountWithRoleListResponse
}
export type GetWorkspacesCurrentMembersResponse
diff --git a/packages/contracts/generated/api/console/workspaces/zod.gen.ts b/packages/contracts/generated/api/console/workspaces/zod.gen.ts
index be04fa4e526..b27187dfddd 100644
--- a/packages/contracts/generated/api/console/workspaces/zod.gen.ts
+++ b/packages/contracts/generated/api/console/workspaces/zod.gen.ts
@@ -887,9 +887,9 @@ export const zSnippetImportResponse = z.object({
})
/**
- * AccountWithRole
+ * AccountWithRoleResponse
*/
-export const zAccountWithRole = z.object({
+export const zAccountWithRoleResponse = z.object({
avatar: z.string().nullish(),
avatar_url: z.string().nullable(),
created_at: z.int().nullish(),
@@ -904,10 +904,10 @@ export const zAccountWithRole = z.object({
})
/**
- * AccountWithRoleList
+ * AccountWithRoleListResponse
*/
-export const zAccountWithRoleList = z.object({
- accounts: z.array(zAccountWithRole),
+export const zAccountWithRoleListResponse = z.object({
+ accounts: z.array(zAccountWithRoleResponse),
})
/**
@@ -2576,9 +2576,9 @@ export const zTriggerProviderApiEntity = z.object({
export const zTriggerProviderListResponse = z.array(zTriggerProviderApiEntity)
/**
- * AccountWithRole
+ * AccountWithRoleResponse
*/
-export const zAccountWithRoleWritable = z.object({
+export const zAccountWithRoleResponseWritable = z.object({
avatar: z.string().nullish(),
created_at: z.int().nullish(),
email: z.string(),
@@ -2592,10 +2592,10 @@ export const zAccountWithRoleWritable = z.object({
})
/**
- * AccountWithRoleList
+ * AccountWithRoleListResponse
*/
-export const zAccountWithRoleListWritable = z.object({
- accounts: z.array(zAccountWithRoleWritable),
+export const zAccountWithRoleListResponseWritable = z.object({
+ accounts: z.array(zAccountWithRoleResponseWritable),
})
/**
@@ -2725,7 +2725,7 @@ export const zPostWorkspacesCurrentCustomizedSnippetsBySnippetIdUseCountIncremen
/**
* Success
*/
-export const zGetWorkspacesCurrentDatasetOperatorsResponse = zAccountWithRoleList
+export const zGetWorkspacesCurrentDatasetOperatorsResponse = zAccountWithRoleListResponse
export const zGetWorkspacesCurrentDefaultModelQuery = z.object({
model_type: z.enum(['llm', 'moderation', 'rerank', 'speech2text', 'text-embedding', 'tts']),
@@ -2829,7 +2829,7 @@ export const zPatchWorkspacesCurrentEndpointsByIdResponse = zEndpointUpdateRespo
/**
* Success
*/
-export const zGetWorkspacesCurrentMembersResponse = zAccountWithRoleList
+export const zGetWorkspacesCurrentMembersResponse = zAccountWithRoleListResponse
export const zPostWorkspacesCurrentMembersInviteEmailBody = zMemberInvitePayload
diff --git a/packages/contracts/generated/api/service/types.gen.ts b/packages/contracts/generated/api/service/types.gen.ts
index 8ab35c133e3..0e5e589acbc 100644
--- a/packages/contracts/generated/api/service/types.gen.ts
+++ b/packages/contracts/generated/api/service/types.gen.ts
@@ -1414,7 +1414,7 @@ export type SelectInputConfig = {
type?: 'select'
}
-export type SimpleAccount = {
+export type SimpleAccountResponse = {
email: string
id: string
name: string
@@ -1573,7 +1573,7 @@ export type WorkflowAppLogPaginationResponse = {
export type WorkflowAppLogPartialResponse = {
created_at?: number | null
- created_by_account?: SimpleAccount | null
+ created_by_account?: SimpleAccountResponse | null
created_by_end_user?: SimpleEndUser | null
created_by_role?: string | null
created_from?: string | null
diff --git a/packages/contracts/generated/api/service/zod.gen.ts b/packages/contracts/generated/api/service/zod.gen.ts
index 00edc06ef95..0b5c859f214 100644
--- a/packages/contracts/generated/api/service/zod.gen.ts
+++ b/packages/contracts/generated/api/service/zod.gen.ts
@@ -1676,9 +1676,9 @@ export const zProcessRule = z.object({
})
/**
- * SimpleAccount
+ * SimpleAccountResponse
*/
-export const zSimpleAccount = z.object({
+export const zSimpleAccountResponse = z.object({
email: z.string(),
id: z.string(),
name: z.string(),
@@ -2197,7 +2197,7 @@ export const zWorkflowRunForLogResponse = z.object({
*/
export const zWorkflowAppLogPartialResponse = z.object({
created_at: z.int().nullish(),
- created_by_account: zSimpleAccount.nullish(),
+ created_by_account: zSimpleAccountResponse.nullish(),
created_by_end_user: zSimpleEndUser.nullish(),
created_by_role: z.string().nullish(),
created_from: z.string().nullish(),
diff --git a/scripts/check_no_new_getattr.py b/scripts/check_no_new_getattr.py
index 102593487e3..098084fc1dd 100644
--- a/scripts/check_no_new_getattr.py
+++ b/scripts/check_no_new_getattr.py
@@ -86,16 +86,21 @@ def git_output(*args: str, allow_missing: bool = False) -> str:
raise RuntimeError(completed.stderr.strip() or completed.stdout.strip() or "git command failed")
+def resolve_ci_base(merge_target: str) -> str:
+ merge_base = git_output("merge-base", merge_target, "HEAD", allow_missing=True).strip()
+ return merge_base or merge_target
+
+
def collect_diff_text(args: argparse.Namespace) -> str:
if args.mode == "pre-commit":
return git_output("diff", "--cached", "--unified=0", "--diff-filter=AM", "--no-ext-diff")
- merge_base = git_output("merge-base", args.merge_target, "HEAD").strip()
+ compare_base = resolve_ci_base(args.merge_target)
return git_output(
"diff",
"--unified=0",
"--diff-filter=AM",
"--no-ext-diff",
- f"{merge_base}..HEAD",
+ f"{compare_base}..HEAD",
)
@@ -146,9 +151,9 @@ def load_file_versions(path: str, args: argparse.Namespace) -> tuple[str, str]:
git_output("show", f":{path}"),
)
- merge_base = git_output("merge-base", args.merge_target, "HEAD").strip()
+ compare_base = resolve_ci_base(args.merge_target)
return (
- git_output("show", f"{merge_base}:{path}", allow_missing=True),
+ git_output("show", f"{compare_base}:{path}", allow_missing=True),
git_output("show", f"HEAD:{path}"),
)
diff --git a/web/app/components/workflow/comment/types.ts b/web/app/components/workflow/comment/types.ts
index 05a641708aa..a196cba1d20 100644
--- a/web/app/components/workflow/comment/types.ts
+++ b/web/app/components/workflow/comment/types.ts
@@ -1,11 +1,11 @@
import type {
- AccountWithRole,
+ AccountWithRoleResponse,
WorkflowCommentDetail as GeneratedWorkflowCommentDetail,
WorkflowCommentBasic,
WorkflowCommentReply,
} from '@dify/contracts/api/console/apps/types.gen'
-export type UserProfile = Pick<AccountWithRole, 'id' | 'name' | 'email' | 'avatar_url'> & {
+export type UserProfile = Pick<AccountWithRoleResponse, 'id' | 'name' | 'email' | 'avatar_url'> & {
avatar_url?: string | null
}