mirror of
https://github.com/langgenius/dify.git
synced 2026-06-26 14:51:13 +08:00
Merge c7274677f4 into a246dc8b17
This commit is contained in:
commit
45d4974f3d
@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, RootModel, computed_field
|
||||
|
||||
@ -8,7 +8,6 @@ from fields.base import ResponseModel
|
||||
from graphon.file import helpers as file_helpers
|
||||
from models.model import IconType
|
||||
|
||||
type JSONValue = str | int | float | bool | None | dict[str, Any] | list[Any]
|
||||
type JSONObject = dict[str, Any]
|
||||
|
||||
|
||||
@ -24,10 +23,6 @@ class SimpleResultResponse(ResponseModel):
|
||||
result: str
|
||||
|
||||
|
||||
class GeneratedAppResponse(RootModel[JSONValue]):
|
||||
root: JSONValue
|
||||
|
||||
|
||||
class EventStreamResponse(RootModel[str]):
|
||||
root: str
|
||||
|
||||
@ -52,6 +47,11 @@ class AudioTranscriptResponse(ResponseModel):
|
||||
text: str
|
||||
|
||||
|
||||
class ValidationResultResponse(ResponseModel):
|
||||
result: Literal["success", "error"]
|
||||
error: str | None = None
|
||||
|
||||
|
||||
class SimpleResultMessageResponse(ResponseModel):
|
||||
result: str
|
||||
message: str
|
||||
|
||||
@ -8,7 +8,7 @@ from pydantic import BaseModel, Field, field_validator
|
||||
from werkzeug.exceptions import BadRequest, 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 import console_ns
|
||||
from controllers.console.agent.app_helpers import resolve_agent_app_model
|
||||
@ -103,7 +103,7 @@ class ChatMessagePayload(BaseMessagePayload):
|
||||
|
||||
|
||||
register_schema_models(console_ns, CompletionMessagePayload, ChatMessagePayload)
|
||||
register_response_schema_models(console_ns, GeneratedAppResponse, SimpleResultResponse)
|
||||
register_response_schema_models(console_ns, SimpleResultResponse)
|
||||
|
||||
|
||||
# define completion message api for user
|
||||
@ -113,7 +113,7 @@ class CompletionMessageApi(Resource):
|
||||
@console_ns.doc(description="Generate completion message for debugging")
|
||||
@console_ns.doc(params={"app_id": "Application ID"})
|
||||
@console_ns.expect(console_ns.models[CompletionMessagePayload.__name__])
|
||||
@console_ns.response(200, "Completion generated successfully", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@console_ns.response(200, "Completion generated successfully")
|
||||
@console_ns.response(400, "Invalid request parameters")
|
||||
@console_ns.response(404, "App not found")
|
||||
@setup_required
|
||||
@ -134,6 +134,7 @@ class CompletionMessageApi(Resource):
|
||||
app_model=app_model, user=current_user, args=args, invoke_from=InvokeFrom.DEBUGGER, streaming=streaming
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -177,7 +178,7 @@ class CompletionMessageStopApi(Resource):
|
||||
app_mode=AppMode.value_of(app_model.mode),
|
||||
)
|
||||
|
||||
return {"result": "success"}, 200
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json"), 200
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/chat-messages")
|
||||
@ -186,7 +187,7 @@ class ChatMessageApi(Resource):
|
||||
@console_ns.doc(description="Generate chat message for debugging")
|
||||
@console_ns.doc(params={"app_id": "Application ID"})
|
||||
@console_ns.expect(console_ns.models[ChatMessagePayload.__name__])
|
||||
@console_ns.response(200, "Chat message generated successfully", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@console_ns.response(200, "Chat message generated successfully")
|
||||
@console_ns.response(400, "Invalid request parameters")
|
||||
@console_ns.response(404, "App or conversation not found")
|
||||
@setup_required
|
||||
@ -207,7 +208,7 @@ class AgentChatMessageApi(Resource):
|
||||
@console_ns.doc(description="Generate an Agent App chat message for debugging")
|
||||
@console_ns.doc(params={"agent_id": "Agent ID"})
|
||||
@console_ns.expect(console_ns.models[ChatMessagePayload.__name__])
|
||||
@console_ns.response(200, "Chat message generated successfully", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@console_ns.response(200, "Chat message generated successfully")
|
||||
@console_ns.response(400, "Invalid request parameters")
|
||||
@console_ns.response(404, "Agent or conversation not found")
|
||||
@setup_required
|
||||
@ -315,6 +316,7 @@ def _create_chat_message(
|
||||
app_model=app_model, user=current_user, args=args, invoke_from=InvokeFrom.DEBUGGER, streaming=streaming
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -348,4 +350,4 @@ def _stop_chat_message(*, current_user_id: str, app_model: App, task_id: str):
|
||||
app_mode=AppMode.value_of(app_model.mode),
|
||||
)
|
||||
|
||||
return {"result": "success"}, 200
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json"), 200
|
||||
|
||||
@ -167,12 +167,16 @@ register_schema_models(
|
||||
ChatMessagesQuery,
|
||||
MessageFeedbackPayload,
|
||||
FeedbackExportQuery,
|
||||
)
|
||||
register_response_schema_models(
|
||||
console_ns,
|
||||
AnnotationCountResponse,
|
||||
SuggestedQuestionsResponse,
|
||||
MessageDetailResponse,
|
||||
MessageInfiniteScrollPaginationResponse,
|
||||
SimpleResultResponse,
|
||||
TextFileResponse,
|
||||
)
|
||||
register_response_schema_models(console_ns, SimpleResultResponse, TextFileResponse)
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/chat-messages")
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Sequence
|
||||
from collections.abc import Mapping, Sequence
|
||||
from datetime import datetime
|
||||
from typing import Any, NotRequired, TypedDict, cast
|
||||
from typing import Any, Literal, NotRequired, TypedDict, cast
|
||||
|
||||
from flask import abort, request
|
||||
from flask_restx import Resource, fields
|
||||
from pydantic import AliasChoices, BaseModel, Field, RootModel, ValidationError, field_validator
|
||||
from flask_restx import Resource
|
||||
from pydantic import AliasChoices, BaseModel, Field, ValidationError, field_validator
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
from werkzeug.exceptions import BadRequest, Forbidden, InternalServerError, NotFound
|
||||
|
||||
import services
|
||||
from controllers.common.controller_schemas import DefaultBlockConfigQuery, WorkflowListQuery, WorkflowUpdatePayload
|
||||
from controllers.common.errors import InvalidArgumentError
|
||||
from controllers.common.fields import GeneratedAppResponse, NewAppResponse, SimpleResultResponse
|
||||
from controllers.common.fields import NewAppResponse, SimpleResultResponse
|
||||
from controllers.common.schema import (
|
||||
query_params_from_model,
|
||||
register_response_schema_model,
|
||||
@ -21,11 +21,7 @@ from controllers.common.schema import (
|
||||
register_schema_models,
|
||||
)
|
||||
from controllers.console import console_ns
|
||||
from controllers.console.app.error import (
|
||||
ConversationCompletedError,
|
||||
DraftWorkflowNotExist,
|
||||
DraftWorkflowNotSync,
|
||||
)
|
||||
from controllers.console.app.error import ConversationCompletedError, DraftWorkflowNotExist, DraftWorkflowNotSync
|
||||
from controllers.console.app.permission_keys import get_app_permission_keys
|
||||
from controllers.console.app.wraps import get_app_model
|
||||
from controllers.console.wraps import (
|
||||
@ -58,7 +54,7 @@ from extensions.ext_database import db
|
||||
from extensions.ext_redis import redis_client
|
||||
from factories import file_factory, variable_factory
|
||||
from fields.base import ResponseModel
|
||||
from fields.member_fields import SimpleAccount
|
||||
from fields.member_fields import SimpleAccountResponse
|
||||
from fields.workflow_run_fields import WorkflowRunNodeExecutionResponse
|
||||
from graphon.enums import NodeType
|
||||
from graphon.file import File
|
||||
@ -69,7 +65,7 @@ from graphon.variables import SecretVariable, SegmentType, VariableBase
|
||||
from graphon.variables.exc import VariableError
|
||||
from libs import helper
|
||||
from libs.datetime_utils import naive_utc_now
|
||||
from libs.helper import TimestampField, dump_response, to_timestamp, uuid_value
|
||||
from libs.helper import dump_response, to_timestamp, uuid_value
|
||||
from libs.login import login_required
|
||||
from models import Account, App
|
||||
from models.model import AppMode
|
||||
@ -103,20 +99,16 @@ class SyncDraftWorkflowPayload(BaseModel):
|
||||
graph: dict[str, Any]
|
||||
features: dict[str, Any]
|
||||
hash: str | None = None
|
||||
environment_variables: list[dict[str, Any]] = Field(
|
||||
default_factory=list,
|
||||
)
|
||||
conversation_variables: list[dict[str, Any]] = Field(
|
||||
default_factory=list,
|
||||
)
|
||||
environment_variables: list[dict[str, Any]] = Field(default_factory=list)
|
||||
conversation_variables: list[dict[str, Any]] = Field(default_factory=list)
|
||||
|
||||
|
||||
class BaseWorkflowRunPayload(BaseModel):
|
||||
files: list[dict[str, Any]] | None = Field(default=None)
|
||||
files: list[dict[str, Any]] | None = None
|
||||
|
||||
|
||||
class AdvancedChatWorkflowRunPayload(BaseWorkflowRunPayload):
|
||||
inputs: dict[str, Any] | None = Field(default=None)
|
||||
inputs: dict[str, Any] | None = None
|
||||
query: str = ""
|
||||
conversation_id: str | None = None
|
||||
parent_message_id: str | None = None
|
||||
@ -130,11 +122,11 @@ class AdvancedChatWorkflowRunPayload(BaseWorkflowRunPayload):
|
||||
|
||||
|
||||
class IterationNodeRunPayload(BaseModel):
|
||||
inputs: dict[str, Any] | None = Field(default=None)
|
||||
inputs: dict[str, Any] | None = None
|
||||
|
||||
|
||||
class LoopNodeRunPayload(BaseModel):
|
||||
inputs: dict[str, Any] | None = Field(default=None)
|
||||
inputs: dict[str, Any] | None = None
|
||||
|
||||
|
||||
class DraftWorkflowRunPayload(BaseWorkflowRunPayload):
|
||||
@ -159,10 +151,7 @@ class ConvertToWorkflowPayload(BaseModel):
|
||||
|
||||
|
||||
class WorkflowFeaturesPayload(BaseModel):
|
||||
features: dict[str, Any] = Field(
|
||||
...,
|
||||
description="Workflow feature configuration",
|
||||
)
|
||||
features: dict[str, Any] = Field(..., description="Workflow feature configuration")
|
||||
|
||||
|
||||
class WorkflowOnlineUsersPayload(BaseModel):
|
||||
@ -197,7 +186,7 @@ class PipelineVariableResponse(ResponseModel):
|
||||
max_length: int | None = None
|
||||
required: bool
|
||||
unit: str | None = None
|
||||
default_value: Any = Field(default=None)
|
||||
default_value: Any = None
|
||||
options: list[str] | None = None
|
||||
placeholder: str | None = None
|
||||
tooltips: str | None = None
|
||||
@ -220,21 +209,17 @@ class WorkflowEnvironmentVariableResponse(ResponseModel):
|
||||
|
||||
class WorkflowResponse(ResponseModel):
|
||||
id: str
|
||||
graph: dict[str, Any] = Field(
|
||||
validation_alias=AliasChoices("graph_dict", "graph"),
|
||||
)
|
||||
features: dict[str, Any] = Field(
|
||||
validation_alias=AliasChoices("features_dict", "features"),
|
||||
)
|
||||
graph: dict[str, Any] = Field(validation_alias=AliasChoices("graph_dict", "graph"))
|
||||
features: dict[str, Any] = Field(validation_alias=AliasChoices("features_dict", "features"))
|
||||
hash: str = Field(validation_alias=AliasChoices("unique_hash", "hash"))
|
||||
version: str
|
||||
marked_name: str
|
||||
marked_comment: str
|
||||
created_by: SimpleAccount | None = Field(
|
||||
created_by: SimpleAccountResponse | None = Field(
|
||||
default=None, validation_alias=AliasChoices("created_by_account", "created_by")
|
||||
)
|
||||
created_at: int
|
||||
updated_by: SimpleAccount | None = Field(
|
||||
updated_by: SimpleAccountResponse | None = Field(
|
||||
default=None, validation_alias=AliasChoices("updated_by_account", "updated_by")
|
||||
)
|
||||
updated_at: int
|
||||
@ -267,6 +252,53 @@ class WorkflowPaginationResponse(ResponseModel):
|
||||
has_more: bool
|
||||
|
||||
|
||||
class SyncDraftWorkflowResponse(ResponseModel):
|
||||
result: str
|
||||
hash: str
|
||||
updated_at: int
|
||||
|
||||
|
||||
class PublishWorkflowResponse(ResponseModel):
|
||||
result: str
|
||||
created_at: int
|
||||
|
||||
|
||||
class HumanInputUserActionResponse(ResponseModel):
|
||||
id: str
|
||||
title: str
|
||||
button_style: str = "default"
|
||||
|
||||
|
||||
class HumanInputFormPreviewResponse(ResponseModel):
|
||||
# Draft previews are shape-compatible with live human_input_required events,
|
||||
# but they do not persist a form or mint recipient tokens (no expiration_time)
|
||||
type_: Literal["human_input_required"] = Field(default="human_input_required", alias="TYPE")
|
||||
form_id: str
|
||||
form_content: str
|
||||
inputs: list[Mapping[str, Any]] = Field(default_factory=list)
|
||||
actions: list[HumanInputUserActionResponse] = Field(default_factory=list)
|
||||
node_id: str
|
||||
node_title: str
|
||||
resolved_default_values: Mapping[str, Any] = Field(default_factory=dict)
|
||||
display_in_ui: bool = Field(default=False, description="Always false for draft preview responses.")
|
||||
form_token: str | None = Field(default=None, description="Always null for draft preview responses.")
|
||||
expiration_time: int | None = Field(default=None, description="Always null for draft preview responses.")
|
||||
|
||||
|
||||
class HumanInputDeliveryTestResponse(ResponseModel):
|
||||
pass
|
||||
|
||||
|
||||
class TriggerDebugWaitingResponse(ResponseModel):
|
||||
status: Literal["waiting"]
|
||||
retry_in: int
|
||||
|
||||
|
||||
class TriggerDebugErrorResponse(ResponseModel):
|
||||
status: Literal["error"]
|
||||
error: str | None = None
|
||||
|
||||
|
||||
class WorkflowOnlineUser(ResponseModel):
|
||||
user_id: str
|
||||
username: str
|
||||
@ -282,46 +314,6 @@ class WorkflowOnlineUsersResponse(ResponseModel):
|
||||
data: list[WorkflowOnlineUsersByApp]
|
||||
|
||||
|
||||
class WorkflowPublishResponse(ResponseModel):
|
||||
result: str
|
||||
created_at: int
|
||||
|
||||
|
||||
class WorkflowRestoreResponse(ResponseModel):
|
||||
result: str
|
||||
hash: str
|
||||
updated_at: int
|
||||
|
||||
|
||||
class DefaultBlockConfigsResponse(RootModel[list[dict[str, Any]]]):
|
||||
root: list[dict[str, Any]]
|
||||
|
||||
|
||||
class DefaultBlockConfigResponse(RootModel[dict[str, Any]]):
|
||||
root: dict[str, Any]
|
||||
|
||||
|
||||
class HumanInputFormPreviewResponse(ResponseModel):
|
||||
form_id: str
|
||||
node_id: str
|
||||
node_title: str
|
||||
form_content: str
|
||||
inputs: list[dict[str, Any]] = Field(default_factory=list)
|
||||
actions: list[dict[str, Any]] = Field(default_factory=list)
|
||||
display_in_ui: bool | None = None
|
||||
form_token: str | None = None
|
||||
resolved_default_values: dict[str, Any] = Field(default_factory=dict)
|
||||
expiration_time: int | None = None
|
||||
|
||||
|
||||
class HumanInputFormSubmitResponse(RootModel[dict[str, Any]]):
|
||||
root: dict[str, Any]
|
||||
|
||||
|
||||
class EmptyObjectResponse(RootModel[dict[str, Any]]):
|
||||
root: dict[str, Any]
|
||||
|
||||
|
||||
class DraftWorkflowTriggerRunPayload(BaseModel):
|
||||
node_id: str
|
||||
|
||||
@ -356,19 +348,19 @@ register_response_schema_models(
|
||||
WorkflowEnvironmentVariableResponse,
|
||||
WorkflowResponse,
|
||||
WorkflowPaginationResponse,
|
||||
SyncDraftWorkflowResponse,
|
||||
PublishWorkflowResponse,
|
||||
HumanInputUserActionResponse,
|
||||
HumanInputFormPreviewResponse,
|
||||
HumanInputDeliveryTestResponse,
|
||||
TriggerDebugWaitingResponse,
|
||||
TriggerDebugErrorResponse,
|
||||
WorkflowOnlineUser,
|
||||
WorkflowOnlineUsersByApp,
|
||||
WorkflowOnlineUsersResponse,
|
||||
WorkflowPublishResponse,
|
||||
WorkflowRestoreResponse,
|
||||
DefaultBlockConfigsResponse,
|
||||
DefaultBlockConfigResponse,
|
||||
HumanInputFormPreviewResponse,
|
||||
HumanInputFormSubmitResponse,
|
||||
EmptyObjectResponse,
|
||||
GeneratedAppResponse,
|
||||
NewAppResponse,
|
||||
SimpleResultResponse,
|
||||
WorkflowRunNodeExecutionResponse,
|
||||
)
|
||||
|
||||
|
||||
@ -426,6 +418,14 @@ def _serialize_environment_variable(value: Any) -> EnvironmentVariableResponseDi
|
||||
return value
|
||||
|
||||
|
||||
def _trigger_debug_waiting_response() -> dict[str, int | str]:
|
||||
return TriggerDebugWaitingResponse(status="waiting", retry_in=LISTENING_RETRY_IN).model_dump(mode="json")
|
||||
|
||||
|
||||
def _trigger_debug_error_response(error: str | None = None) -> dict[str, str]:
|
||||
return TriggerDebugErrorResponse(status="error", error=error).model_dump(mode="json", exclude_none=True)
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows/draft")
|
||||
class DraftWorkflowApi(Resource):
|
||||
@console_ns.doc("get_draft_workflow")
|
||||
@ -475,14 +475,7 @@ class DraftWorkflowApi(Resource):
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Draft workflow synced successfully",
|
||||
console_ns.model(
|
||||
"SyncDraftWorkflowResponse",
|
||||
{
|
||||
"result": fields.String,
|
||||
"hash": fields.String,
|
||||
"updated_at": fields.String,
|
||||
},
|
||||
),
|
||||
console_ns.models[SyncDraftWorkflowResponse.__name__],
|
||||
)
|
||||
@console_ns.response(400, "Invalid workflow configuration")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@ -535,11 +528,11 @@ class DraftWorkflowApi(Resource):
|
||||
except VariableError as e:
|
||||
raise InvalidArgumentError(description=str(e))
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"hash": workflow.unique_hash,
|
||||
"updated_at": TimestampField().format(workflow.updated_at or workflow.created_at),
|
||||
}
|
||||
return SyncDraftWorkflowResponse(
|
||||
result="success",
|
||||
hash=workflow.unique_hash,
|
||||
updated_at=to_timestamp(workflow.updated_at or workflow.created_at),
|
||||
).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/advanced-chat/workflows/draft/run")
|
||||
@ -548,7 +541,7 @@ class AdvancedChatDraftWorkflowRunApi(Resource):
|
||||
@console_ns.doc(description="Run draft workflow for advanced chat application")
|
||||
@console_ns.doc(params={"app_id": "Application ID"})
|
||||
@console_ns.expect(console_ns.models[AdvancedChatWorkflowRunPayload.__name__])
|
||||
@console_ns.response(200, "Workflow run started successfully", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@console_ns.response(200, "Workflow run started successfully")
|
||||
@console_ns.response(400, "Invalid request parameters")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@setup_required
|
||||
@ -574,6 +567,7 @@ class AdvancedChatDraftWorkflowRunApi(Resource):
|
||||
app_model=app_model, user=current_user, args=args, invoke_from=InvokeFrom.DEBUGGER, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -594,11 +588,7 @@ class AdvancedChatDraftRunIterationNodeApi(Resource):
|
||||
@console_ns.doc(description="Run draft workflow iteration node for advanced chat")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
|
||||
@console_ns.expect(console_ns.models[IterationNodeRunPayload.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Iteration node run started successfully",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@console_ns.response(200, "Iteration node run started successfully")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@console_ns.response(404, "Node not found")
|
||||
@setup_required
|
||||
@ -619,6 +609,7 @@ class AdvancedChatDraftRunIterationNodeApi(Resource):
|
||||
app_model=app_model, user=current_user, node_id=node_id, args=args, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -637,11 +628,7 @@ class WorkflowDraftRunIterationNodeApi(Resource):
|
||||
@console_ns.doc(description="Run draft workflow iteration node")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
|
||||
@console_ns.expect(console_ns.models[IterationNodeRunPayload.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Workflow iteration node run started successfully",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@console_ns.response(200, "Workflow iteration node run started successfully")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@console_ns.response(404, "Node not found")
|
||||
@setup_required
|
||||
@ -662,6 +649,7 @@ class WorkflowDraftRunIterationNodeApi(Resource):
|
||||
app_model=app_model, user=current_user, node_id=node_id, args=args, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -680,7 +668,7 @@ class AdvancedChatDraftRunLoopNodeApi(Resource):
|
||||
@console_ns.doc(description="Run draft workflow loop node for advanced chat")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
|
||||
@console_ns.expect(console_ns.models[LoopNodeRunPayload.__name__])
|
||||
@console_ns.response(200, "Loop node run started successfully", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@console_ns.response(200, "Loop node run started successfully")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@console_ns.response(404, "Node not found")
|
||||
@setup_required
|
||||
@ -701,6 +689,7 @@ class AdvancedChatDraftRunLoopNodeApi(Resource):
|
||||
app_model=app_model, user=current_user, node_id=node_id, args=args, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -719,11 +708,7 @@ class WorkflowDraftRunLoopNodeApi(Resource):
|
||||
@console_ns.doc(description="Run draft workflow loop node")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
|
||||
@console_ns.expect(console_ns.models[LoopNodeRunPayload.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Workflow loop node run started successfully",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@console_ns.response(200, "Workflow loop node run started successfully")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@console_ns.response(404, "Node not found")
|
||||
@setup_required
|
||||
@ -744,6 +729,7 @@ class WorkflowDraftRunLoopNodeApi(Resource):
|
||||
app_model=app_model, user=current_user, node_id=node_id, args=args, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -764,10 +750,7 @@ class HumanInputFormPreviewPayload(BaseModel):
|
||||
|
||||
|
||||
class HumanInputFormSubmitPayload(BaseModel):
|
||||
form_inputs: dict[str, Any] = Field(
|
||||
...,
|
||||
description="Values the user provides for the form's own fields",
|
||||
)
|
||||
form_inputs: dict[str, Any] = Field(..., description="Values the user provides for the form's own fields")
|
||||
inputs: dict[str, Any] = Field(
|
||||
...,
|
||||
description="Values used to fill missing upstream variables referenced in form_content",
|
||||
@ -797,7 +780,11 @@ class AdvancedChatDraftHumanInputFormPreviewApi(Resource):
|
||||
@console_ns.doc(description="Get human input form preview for advanced chat workflow")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
|
||||
@console_ns.expect(console_ns.models[HumanInputFormPreviewPayload.__name__])
|
||||
@console_ns.response(200, "Human input form preview", console_ns.models[HumanInputFormPreviewResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Human input form preview retrieved",
|
||||
console_ns.models[HumanInputFormPreviewResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -819,7 +806,7 @@ class AdvancedChatDraftHumanInputFormPreviewApi(Resource):
|
||||
node_id=node_id,
|
||||
inputs=inputs,
|
||||
)
|
||||
return jsonable_encoder(preview)
|
||||
return dump_response(HumanInputFormPreviewResponse, preview)
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/advanced-chat/workflows/draft/human-input/nodes/<string:node_id>/form/run")
|
||||
@ -830,8 +817,7 @@ class AdvancedChatDraftHumanInputFormRunApi(Resource):
|
||||
@console_ns.expect(console_ns.models[HumanInputFormSubmitPayload.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Human input form submission result",
|
||||
console_ns.models[HumanInputFormSubmitResponse.__name__],
|
||||
"Human input form submitted",
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@ -854,6 +840,7 @@ class AdvancedChatDraftHumanInputFormRunApi(Resource):
|
||||
inputs=args.inputs,
|
||||
action=args.action,
|
||||
)
|
||||
# TODO: typing here for result
|
||||
return jsonable_encoder(result)
|
||||
|
||||
|
||||
@ -863,7 +850,11 @@ class WorkflowDraftHumanInputFormPreviewApi(Resource):
|
||||
@console_ns.doc(description="Get human input form preview for workflow")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
|
||||
@console_ns.expect(console_ns.models[HumanInputFormPreviewPayload.__name__])
|
||||
@console_ns.response(200, "Human input form preview", console_ns.models[HumanInputFormPreviewResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Human input form preview retrieved",
|
||||
console_ns.models[HumanInputFormPreviewResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -885,7 +876,7 @@ class WorkflowDraftHumanInputFormPreviewApi(Resource):
|
||||
node_id=node_id,
|
||||
inputs=inputs,
|
||||
)
|
||||
return jsonable_encoder(preview)
|
||||
return dump_response(HumanInputFormPreviewResponse, preview)
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows/draft/human-input/nodes/<string:node_id>/form/run")
|
||||
@ -896,8 +887,7 @@ class WorkflowDraftHumanInputFormRunApi(Resource):
|
||||
@console_ns.expect(console_ns.models[HumanInputFormSubmitPayload.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Human input form submission result",
|
||||
console_ns.models[HumanInputFormSubmitResponse.__name__],
|
||||
"Human input form submitted",
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@ -920,6 +910,7 @@ class WorkflowDraftHumanInputFormRunApi(Resource):
|
||||
inputs=args.inputs,
|
||||
action=args.action,
|
||||
)
|
||||
# TODO: typing here
|
||||
return jsonable_encoder(result)
|
||||
|
||||
|
||||
@ -929,7 +920,11 @@ class WorkflowDraftHumanInputDeliveryTestApi(Resource):
|
||||
@console_ns.doc(description="Test human input delivery for workflow")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
|
||||
@console_ns.expect(console_ns.models[HumanInputDeliveryTestPayload.__name__])
|
||||
@console_ns.response(200, "Human input delivery test result", console_ns.models[EmptyObjectResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Human input delivery tested",
|
||||
console_ns.models[HumanInputDeliveryTestResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -950,7 +945,7 @@ class WorkflowDraftHumanInputDeliveryTestApi(Resource):
|
||||
delivery_method_id=args.delivery_method_id,
|
||||
inputs=args.inputs,
|
||||
)
|
||||
return jsonable_encoder({})
|
||||
return HumanInputDeliveryTestResponse().model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows/draft/run")
|
||||
@ -959,11 +954,7 @@ class DraftWorkflowRunApi(Resource):
|
||||
@console_ns.doc(description="Run draft workflow")
|
||||
@console_ns.doc(params={"app_id": "Application ID"})
|
||||
@console_ns.expect(console_ns.models[DraftWorkflowRunPayload.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Draft workflow run started successfully",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@console_ns.response(200, "Draft workflow run started successfully")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@setup_required
|
||||
@login_required
|
||||
@ -991,6 +982,7 @@ class DraftWorkflowRunApi(Resource):
|
||||
streaming=True,
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except InvokeRateLimitError as ex:
|
||||
raise InvokeRateLimitHttpError(ex.description)
|
||||
@ -1021,7 +1013,7 @@ class WorkflowTaskStopApi(Resource):
|
||||
# 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")
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows/draft/nodes/<string:node_id>/run")
|
||||
@ -1109,7 +1101,7 @@ class PublishedWorkflowApi(Resource):
|
||||
return dump_response(WorkflowResponse, workflow)
|
||||
|
||||
@console_ns.expect(console_ns.models[PublishWorkflowPayload.__name__])
|
||||
@console_ns.response(200, "Workflow published successfully", console_ns.models[WorkflowPublishResponse.__name__])
|
||||
@console_ns.response(200, "Workflow published successfully", console_ns.models[PublishWorkflowResponse.__name__])
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -1141,12 +1133,9 @@ class PublishedWorkflowApi(Resource):
|
||||
app_model_in_session.updated_by = current_user.id
|
||||
app_model_in_session.updated_at = naive_utc_now()
|
||||
|
||||
workflow_created_at = TimestampField().format(workflow.created_at)
|
||||
workflow_created_at = to_timestamp(workflow.created_at)
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"created_at": workflow_created_at,
|
||||
}
|
||||
return PublishWorkflowResponse(result="success", created_at=workflow_created_at).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows/default-workflow-block-configs")
|
||||
@ -1157,7 +1146,6 @@ class DefaultBlockConfigsApi(Resource):
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Default block configurations retrieved successfully",
|
||||
console_ns.models[DefaultBlockConfigsResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@ -1179,13 +1167,12 @@ class DefaultBlockConfigApi(Resource):
|
||||
@console_ns.doc("get_default_block_config")
|
||||
@console_ns.doc(description="Get default block configuration by type")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "block_type": "Block type"})
|
||||
@console_ns.doc(params=query_params_from_model(DefaultBlockConfigQuery))
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Default block configuration retrieved successfully",
|
||||
console_ns.models[DefaultBlockConfigResponse.__name__],
|
||||
)
|
||||
@console_ns.response(404, "Block type not found")
|
||||
@console_ns.doc(params=query_params_from_model(DefaultBlockConfigQuery))
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -1279,15 +1266,14 @@ class WorkflowFeaturesApi(Resource):
|
||||
workflow_service = WorkflowService()
|
||||
workflow_service.update_draft_workflow_features(app_model=app_model, features=features, account=current_user)
|
||||
|
||||
return {"result": "success"}
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows")
|
||||
class PublishedAllWorkflowApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(WorkflowListQuery))
|
||||
@console_ns.doc("get_all_published_workflows")
|
||||
@console_ns.doc(description="Get all published workflows for an application")
|
||||
@console_ns.doc(params={"app_id": "Application ID"})
|
||||
@console_ns.doc(params={"app_id": "Application ID", **query_params_from_model(WorkflowListQuery)})
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Published workflows retrieved successfully",
|
||||
@ -1340,7 +1326,11 @@ class DraftWorkflowRestoreApi(Resource):
|
||||
@console_ns.doc("restore_workflow_to_draft")
|
||||
@console_ns.doc(description="Restore a published workflow version into the draft workflow")
|
||||
@console_ns.doc(params={"app_id": "Application ID", "workflow_id": "Published workflow ID"})
|
||||
@console_ns.response(200, "Workflow restored successfully", console_ns.models[WorkflowRestoreResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Workflow restored successfully",
|
||||
console_ns.models[SyncDraftWorkflowResponse.__name__],
|
||||
)
|
||||
@console_ns.response(400, "Source workflow must be published")
|
||||
@console_ns.response(404, "Workflow not found")
|
||||
@setup_required
|
||||
@ -1366,11 +1356,11 @@ class DraftWorkflowRestoreApi(Resource):
|
||||
except ValueError as exc:
|
||||
raise BadRequest(str(exc)) from exc
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"hash": workflow.unique_hash,
|
||||
"updated_at": TimestampField().format(workflow.updated_at or workflow.created_at),
|
||||
}
|
||||
return SyncDraftWorkflowResponse(
|
||||
result="success",
|
||||
hash=workflow.unique_hash,
|
||||
updated_at=to_timestamp(workflow.updated_at or workflow.created_at),
|
||||
).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows/<string:workflow_id>")
|
||||
@ -1422,6 +1412,7 @@ class WorkflowByIdApi(Resource):
|
||||
|
||||
return dump_response(WorkflowResponse, workflow)
|
||||
|
||||
@console_ns.response(204, "Workflow deleted successfully")
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -1480,7 +1471,7 @@ class DraftWorkflowNodeLastRunApi(Resource):
|
||||
)
|
||||
if node_exec is None:
|
||||
raise NotFound("last run not found")
|
||||
return WorkflowRunNodeExecutionResponse.model_validate(node_exec, from_attributes=True).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunNodeExecutionResponse, node_exec)
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows/draft/trigger/run")
|
||||
@ -1493,19 +1484,8 @@ class DraftWorkflowTriggerRunApi(Resource):
|
||||
@console_ns.doc("poll_draft_workflow_trigger_run")
|
||||
@console_ns.doc(description="Poll for trigger events and execute full workflow when event arrives")
|
||||
@console_ns.doc(params={"app_id": "Application ID"})
|
||||
@console_ns.expect(
|
||||
console_ns.model(
|
||||
"DraftWorkflowTriggerRunRequest",
|
||||
{
|
||||
"node_id": fields.String(required=True, description="Node ID"),
|
||||
},
|
||||
)
|
||||
)
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Trigger event received and workflow executed successfully",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@console_ns.expect(console_ns.models[DraftWorkflowTriggerRunPayload.__name__])
|
||||
@console_ns.response(200, "Trigger event received and workflow executed successfully")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@console_ns.response(500, "Internal server error")
|
||||
@setup_required
|
||||
@ -1537,10 +1517,11 @@ class DraftWorkflowTriggerRunApi(Resource):
|
||||
try:
|
||||
event = poller.poll()
|
||||
if not event:
|
||||
return jsonable_encoder({"status": "waiting", "retry_in": LISTENING_RETRY_IN})
|
||||
return _trigger_debug_waiting_response()
|
||||
workflow_args = dict(event.workflow_args)
|
||||
|
||||
workflow_args[SKIP_PREPARE_USER_INPUTS_KEY] = True
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(
|
||||
AppGenerateService.generate(
|
||||
app_model=app_model,
|
||||
@ -1554,7 +1535,7 @@ class DraftWorkflowTriggerRunApi(Resource):
|
||||
except InvokeRateLimitError as ex:
|
||||
raise InvokeRateLimitHttpError(ex.description)
|
||||
except PluginInvokeError as e:
|
||||
return jsonable_encoder({"status": "error", "error": e.to_user_friendly_error()}), 400
|
||||
return _trigger_debug_error_response(e.to_user_friendly_error()), 400
|
||||
except Exception as e:
|
||||
logger.exception("Error polling trigger debug event")
|
||||
raise e
|
||||
@ -1573,7 +1554,7 @@ class DraftWorkflowTriggerNodeApi(Resource):
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Trigger event received and node executed successfully",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
console_ns.models[WorkflowRunNodeExecutionResponse.__name__],
|
||||
)
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@console_ns.response(500, "Internal server error")
|
||||
@ -1617,12 +1598,12 @@ class DraftWorkflowTriggerNodeApi(Resource):
|
||||
)
|
||||
event = poller.poll()
|
||||
except PluginInvokeError as e:
|
||||
return jsonable_encoder({"status": "error", "error": e.to_user_friendly_error()}), 400
|
||||
return _trigger_debug_error_response(e.to_user_friendly_error()), 400
|
||||
except Exception as e:
|
||||
logger.exception("Error polling trigger debug event")
|
||||
raise e
|
||||
if not event:
|
||||
return jsonable_encoder({"status": "waiting", "retry_in": LISTENING_RETRY_IN})
|
||||
return _trigger_debug_waiting_response()
|
||||
|
||||
raw_files = event.workflow_args.get("files")
|
||||
files = _parse_file(draft_workflow, raw_files if isinstance(raw_files, list) else None)
|
||||
@ -1636,12 +1617,10 @@ class DraftWorkflowTriggerNodeApi(Resource):
|
||||
query="",
|
||||
files=files,
|
||||
)
|
||||
return jsonable_encoder(node_execution)
|
||||
return dump_response(WorkflowRunNodeExecutionResponse, node_execution)
|
||||
except Exception as e:
|
||||
logger.exception("Error running draft workflow trigger node")
|
||||
return jsonable_encoder(
|
||||
{"status": "error", "error": "An unexpected error occurred while running the node."}
|
||||
), 400
|
||||
return _trigger_debug_error_response("An unexpected error occurred while running the node."), 400
|
||||
|
||||
|
||||
@console_ns.route("/apps/<uuid:app_id>/workflows/draft/trigger/run-all")
|
||||
@ -1655,7 +1634,7 @@ class DraftWorkflowTriggerRunAllApi(Resource):
|
||||
@console_ns.doc(description="Full workflow debug when the start node is a trigger")
|
||||
@console_ns.doc(params={"app_id": "Application ID"})
|
||||
@console_ns.expect(console_ns.models[DraftWorkflowTriggerRunAllPayload.__name__])
|
||||
@console_ns.response(200, "Workflow executed successfully", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@console_ns.response(200, "Workflow executed successfully")
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@console_ns.response(500, "Internal server error")
|
||||
@setup_required
|
||||
@ -1685,12 +1664,12 @@ class DraftWorkflowTriggerRunAllApi(Resource):
|
||||
node_ids=node_ids,
|
||||
)
|
||||
except PluginInvokeError as e:
|
||||
return jsonable_encoder({"status": "error", "error": e.to_user_friendly_error()}), 400
|
||||
return _trigger_debug_error_response(e.to_user_friendly_error()), 400
|
||||
except Exception as e:
|
||||
logger.exception("Error polling trigger debug event")
|
||||
raise e
|
||||
if trigger_debug_event is None:
|
||||
return jsonable_encoder({"status": "waiting", "retry_in": LISTENING_RETRY_IN})
|
||||
return _trigger_debug_waiting_response()
|
||||
|
||||
try:
|
||||
workflow_args = dict(trigger_debug_event.workflow_args)
|
||||
@ -1704,16 +1683,13 @@ class DraftWorkflowTriggerRunAllApi(Resource):
|
||||
streaming=True,
|
||||
root_node_id=trigger_debug_event.node_id,
|
||||
)
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except InvokeRateLimitError as ex:
|
||||
raise InvokeRateLimitHttpError(ex.description)
|
||||
except Exception:
|
||||
logger.exception("Error running draft workflow trigger run-all")
|
||||
return jsonable_encoder(
|
||||
{
|
||||
"status": "error",
|
||||
}
|
||||
), 400
|
||||
return _trigger_debug_error_response(), 400
|
||||
|
||||
|
||||
@console_ns.route("/apps/workflows/online-users")
|
||||
@ -1738,7 +1714,7 @@ class WorkflowOnlineUsersApi(Resource):
|
||||
raise BadRequest(f"Maximum {MAX_WORKFLOW_ONLINE_USERS_REQUEST_IDS} app_ids are allowed per request.")
|
||||
|
||||
if not app_ids:
|
||||
return {"data": []}
|
||||
return WorkflowOnlineUsersResponse(data=[]).model_dump(mode="json")
|
||||
|
||||
workflow_service = WorkflowService()
|
||||
accessible_app_ids = workflow_service.get_accessible_app_ids(app_ids, current_tenant_id)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal, cast
|
||||
from uuid import UUID
|
||||
|
||||
@ -21,8 +22,6 @@ from controllers.console.app.error import (
|
||||
)
|
||||
from controllers.console.app.workflow import (
|
||||
RESTORE_SOURCE_WORKFLOW_MUST_BE_PUBLISHED_MESSAGE,
|
||||
DefaultBlockConfigResponse,
|
||||
DefaultBlockConfigsResponse,
|
||||
WorkflowPaginationResponse,
|
||||
WorkflowResponse,
|
||||
)
|
||||
@ -41,6 +40,7 @@ from controllers.web.error import InvokeRateLimitError as InvokeRateLimitHttpErr
|
||||
from core.app.apps.base_app_queue_manager import AppQueueManager
|
||||
from core.app.apps.pipeline.pipeline_generator import PipelineGenerator
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from core.plugin.entities.plugin_daemon import PluginDatasourceProviderEntity
|
||||
from extensions.ext_database import db
|
||||
from factories import variable_factory
|
||||
from fields.base import ResponseModel
|
||||
@ -50,9 +50,8 @@ from fields.workflow_run_fields import (
|
||||
WorkflowRunNodeExecutionResponse,
|
||||
WorkflowRunPaginationResponse,
|
||||
)
|
||||
from graphon.model_runtime.utils.encoders import jsonable_encoder
|
||||
from libs import helper
|
||||
from libs.helper import TimestampField, UUIDStrOrEmpty, dump_response
|
||||
from libs.helper import UUIDStrOrEmpty, dump_response, to_timestamp
|
||||
from libs.login import login_required
|
||||
from models import Account
|
||||
from models.dataset import Pipeline
|
||||
@ -72,14 +71,14 @@ logger = logging.getLogger(__name__)
|
||||
class DraftWorkflowSyncPayload(BaseModel):
|
||||
graph: dict[str, Any]
|
||||
hash: str | None = None
|
||||
environment_variables: list[dict[str, Any]] | None = Field(default=None)
|
||||
conversation_variables: list[dict[str, Any]] | None = Field(default=None)
|
||||
rag_pipeline_variables: list[dict[str, Any]] | None = Field(default=None)
|
||||
features: dict[str, Any] | None = Field(default=None)
|
||||
environment_variables: list[dict[str, Any]] | None = None
|
||||
conversation_variables: list[dict[str, Any]] | None = None
|
||||
rag_pipeline_variables: list[dict[str, Any]] | None = None
|
||||
features: dict[str, Any] | None = None
|
||||
|
||||
|
||||
class NodeRunPayload(BaseModel):
|
||||
inputs: dict[str, Any] | None = Field(default=None)
|
||||
inputs: dict[str, Any] | None = None
|
||||
|
||||
|
||||
class NodeRunRequiredPayload(BaseModel):
|
||||
@ -136,14 +135,30 @@ class RagPipelineWorkflowPublishResponse(ResponseModel):
|
||||
created_at: int
|
||||
|
||||
|
||||
class RagPipelineOpaqueResponse(RootModel[Any]):
|
||||
root: Any
|
||||
|
||||
|
||||
class RagPipelineStepParametersResponse(ResponseModel):
|
||||
class RagPipelineVariablesResponse(ResponseModel):
|
||||
# TODO: Replace Any with a response model that mirrors graphon.variables.variables.RAGPipelineVariable.
|
||||
variables: Any
|
||||
|
||||
|
||||
class DatasourcePluginListResponse(RootModel[list[PluginDatasourceProviderEntity]]):
|
||||
pass
|
||||
|
||||
|
||||
class RagPipelineRecommendedPluginResponse(ResponseModel):
|
||||
installed_recommended_plugins: list[Mapping[str, object]] = Field(
|
||||
description="Installed tool provider payloads. Shape follows the tool provider serializer."
|
||||
)
|
||||
uninstalled_recommended_plugins: list[Mapping[str, object]] = Field(
|
||||
description="Marketplace plugin manifest payloads returned by the marketplace service."
|
||||
)
|
||||
|
||||
|
||||
class RagPipelineTransformResponse(ResponseModel):
|
||||
pipeline_id: str
|
||||
dataset_id: str
|
||||
status: str
|
||||
|
||||
|
||||
register_schema_models(
|
||||
console_ns,
|
||||
DraftWorkflowSyncPayload,
|
||||
@ -162,10 +177,10 @@ register_schema_models(
|
||||
)
|
||||
register_response_schema_models(
|
||||
console_ns,
|
||||
DefaultBlockConfigResponse,
|
||||
DefaultBlockConfigsResponse,
|
||||
RagPipelineOpaqueResponse,
|
||||
RagPipelineStepParametersResponse,
|
||||
DatasourcePluginListResponse,
|
||||
RagPipelineRecommendedPluginResponse,
|
||||
RagPipelineTransformResponse,
|
||||
RagPipelineVariablesResponse,
|
||||
RagPipelineWorkflowPublishResponse,
|
||||
RagPipelineWorkflowSyncResponse,
|
||||
SimpleResultResponse,
|
||||
@ -254,17 +269,16 @@ class DraftRagPipelineApi(Resource):
|
||||
except WorkflowHashNotEqualError:
|
||||
raise DraftWorkflowNotSync()
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"hash": workflow.unique_hash,
|
||||
"updated_at": TimestampField().format(workflow.updated_at or workflow.created_at),
|
||||
}
|
||||
return RagPipelineWorkflowSyncResponse(
|
||||
result="success",
|
||||
hash=workflow.unique_hash,
|
||||
updated_at=to_timestamp(workflow.updated_at or workflow.created_at),
|
||||
).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/iteration/nodes/<string:node_id>/run")
|
||||
class RagPipelineDraftRunIterationNodeApi(Resource):
|
||||
@console_ns.expect(console_ns.models[NodeRunPayload.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -284,6 +298,7 @@ class RagPipelineDraftRunIterationNodeApi(Resource):
|
||||
pipeline=pipeline, user=current_user, node_id=node_id, args=args, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -299,7 +314,6 @@ class RagPipelineDraftRunIterationNodeApi(Resource):
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/loop/nodes/<string:node_id>/run")
|
||||
class RagPipelineDraftRunLoopNodeApi(Resource):
|
||||
@console_ns.expect(console_ns.models[NodeRunPayload.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -319,6 +333,7 @@ class RagPipelineDraftRunLoopNodeApi(Resource):
|
||||
pipeline=pipeline, user=current_user, node_id=node_id, args=args, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -334,7 +349,6 @@ class RagPipelineDraftRunLoopNodeApi(Resource):
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/run")
|
||||
class DraftRagPipelineRunApi(Resource):
|
||||
@console_ns.expect(console_ns.models[DraftWorkflowRunPayload.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -358,6 +372,7 @@ class DraftRagPipelineRunApi(Resource):
|
||||
streaming=True,
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except InvokeRateLimitError as ex:
|
||||
raise InvokeRateLimitHttpError(ex.description)
|
||||
@ -366,7 +381,6 @@ class DraftRagPipelineRunApi(Resource):
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/published/run")
|
||||
class PublishedRagPipelineRunApi(Resource):
|
||||
@console_ns.expect(console_ns.models[PublishedWorkflowRunPayload.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -391,6 +405,7 @@ class PublishedRagPipelineRunApi(Resource):
|
||||
streaming=streaming,
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except InvokeRateLimitError as ex:
|
||||
raise InvokeRateLimitHttpError(ex.description)
|
||||
@ -399,7 +414,6 @@ class PublishedRagPipelineRunApi(Resource):
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/published/datasource/nodes/<string:node_id>/run")
|
||||
class RagPipelinePublishedDatasourceNodeRunApi(Resource):
|
||||
@console_ns.expect(console_ns.models[DatasourceNodeRunPayload.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -414,6 +428,7 @@ class RagPipelinePublishedDatasourceNodeRunApi(Resource):
|
||||
payload = DatasourceNodeRunPayload.model_validate(console_ns.payload or {})
|
||||
|
||||
rag_pipeline_service = RagPipelineService()
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(
|
||||
PipelineGenerator.convert_to_event_stream(
|
||||
rag_pipeline_service.run_datasource_workflow_node(
|
||||
@ -432,7 +447,6 @@ class RagPipelinePublishedDatasourceNodeRunApi(Resource):
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/datasource/nodes/<string:node_id>/run")
|
||||
class RagPipelineDraftDatasourceNodeRunApi(Resource):
|
||||
@console_ns.expect(console_ns.models[DatasourceNodeRunPayload.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@setup_required
|
||||
@login_required
|
||||
@edit_permission_required
|
||||
@ -447,6 +461,7 @@ class RagPipelineDraftDatasourceNodeRunApi(Resource):
|
||||
payload = DatasourceNodeRunPayload.model_validate(console_ns.payload or {})
|
||||
|
||||
rag_pipeline_service = RagPipelineService()
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(
|
||||
PipelineGenerator.convert_to_event_stream(
|
||||
rag_pipeline_service.run_datasource_workflow_node(
|
||||
@ -492,9 +507,7 @@ class RagPipelineDraftNodeRunApi(Resource):
|
||||
if workflow_node_execution is None:
|
||||
raise ValueError("Workflow node execution not found")
|
||||
|
||||
return WorkflowRunNodeExecutionResponse.model_validate(
|
||||
workflow_node_execution, from_attributes=True
|
||||
).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunNodeExecutionResponse, workflow_node_execution)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflow-runs/tasks/<string:task_id>/stop")
|
||||
@ -513,7 +526,7 @@ class RagPipelineTaskStopApi(Resource):
|
||||
"""
|
||||
AppQueueManager.set_stop_flag(task_id, InvokeFrom.DEBUGGER, current_user.id)
|
||||
|
||||
return {"result": "success"}
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/publish")
|
||||
@ -567,20 +580,18 @@ class PublishedRagPipelineApi(Resource):
|
||||
pipeline.is_published = True
|
||||
pipeline.workflow_id = workflow.id
|
||||
db.session.commit()
|
||||
workflow_created_at = TimestampField().format(workflow.created_at)
|
||||
workflow_created_at = to_timestamp(workflow.created_at)
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"created_at": workflow_created_at,
|
||||
}
|
||||
return RagPipelineWorkflowPublishResponse(result="success", created_at=workflow_created_at).model_dump(
|
||||
mode="json"
|
||||
)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/default-workflow-block-configs")
|
||||
class DefaultRagPipelineBlockConfigsApi(Resource):
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Default block configs retrieved successfully",
|
||||
console_ns.models[DefaultBlockConfigsResponse.__name__],
|
||||
"Default workflow block configurations retrieved successfully",
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@ -602,8 +613,7 @@ class DefaultRagPipelineBlockConfigApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(DefaultBlockConfigQuery))
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Default block config retrieved successfully",
|
||||
console_ns.models[DefaultBlockConfigResponse.__name__],
|
||||
"Default workflow block configuration retrieved successfully",
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@ -631,13 +641,13 @@ class DefaultRagPipelineBlockConfigApi(Resource):
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows")
|
||||
class PublishedAllRagPipelineApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(WorkflowListQuery))
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Published workflows retrieved successfully",
|
||||
console_ns.models[WorkflowPaginationResponse.__name__],
|
||||
)
|
||||
@console_ns.response(403, "Permission denied")
|
||||
@console_ns.doc(params=query_params_from_model(WorkflowListQuery))
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -671,14 +681,15 @@ class PublishedAllRagPipelineApi(Resource):
|
||||
named_only=named_only,
|
||||
)
|
||||
|
||||
return WorkflowPaginationResponse.model_validate(
|
||||
return dump_response(
|
||||
WorkflowPaginationResponse,
|
||||
{
|
||||
"items": workflows,
|
||||
"page": page,
|
||||
"limit": limit,
|
||||
"has_more": has_more,
|
||||
}
|
||||
).model_dump(mode="json")
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/<string:workflow_id>/restore")
|
||||
@ -706,11 +717,11 @@ class RagPipelineDraftWorkflowRestoreApi(Resource):
|
||||
except WorkflowNotFoundError as exc:
|
||||
raise NotFound(str(exc)) from exc
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"hash": workflow.unique_hash,
|
||||
"updated_at": TimestampField().format(workflow.updated_at or workflow.created_at),
|
||||
}
|
||||
return RagPipelineWorkflowSyncResponse(
|
||||
result="success",
|
||||
hash=workflow.unique_hash,
|
||||
updated_at=to_timestamp(workflow.updated_at or workflow.created_at),
|
||||
).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/<string:workflow_id>")
|
||||
@ -784,13 +795,17 @@ class RagPipelineByIdApi(Resource):
|
||||
except ValueError as e:
|
||||
raise NotFound(str(e))
|
||||
|
||||
return None, 204
|
||||
return "", 204
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/published/processing/parameters")
|
||||
class PublishedRagPipelineSecondStepApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(NodeIdQuery))
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineStepParametersResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Second step parameters retrieved successfully",
|
||||
console_ns.models[RagPipelineVariablesResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -805,15 +820,17 @@ class PublishedRagPipelineSecondStepApi(Resource):
|
||||
node_id = query.node_id
|
||||
rag_pipeline_service = RagPipelineService()
|
||||
variables = rag_pipeline_service.get_second_step_parameters(pipeline=pipeline, node_id=node_id, is_draft=False)
|
||||
return {
|
||||
"variables": variables,
|
||||
}
|
||||
return dump_response(RagPipelineVariablesResponse, {"variables": variables})
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/published/pre-processing/parameters")
|
||||
class PublishedRagPipelineFirstStepApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(NodeIdQuery))
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineStepParametersResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"First step parameters retrieved successfully",
|
||||
console_ns.models[RagPipelineVariablesResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -828,15 +845,17 @@ class PublishedRagPipelineFirstStepApi(Resource):
|
||||
node_id = query.node_id
|
||||
rag_pipeline_service = RagPipelineService()
|
||||
variables = rag_pipeline_service.get_first_step_parameters(pipeline=pipeline, node_id=node_id, is_draft=False)
|
||||
return {
|
||||
"variables": variables,
|
||||
}
|
||||
return dump_response(RagPipelineVariablesResponse, {"variables": variables})
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/pre-processing/parameters")
|
||||
class DraftRagPipelineFirstStepApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(NodeIdQuery))
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineStepParametersResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"First step parameters retrieved successfully",
|
||||
console_ns.models[RagPipelineVariablesResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -851,15 +870,17 @@ class DraftRagPipelineFirstStepApi(Resource):
|
||||
node_id = query.node_id
|
||||
rag_pipeline_service = RagPipelineService()
|
||||
variables = rag_pipeline_service.get_first_step_parameters(pipeline=pipeline, node_id=node_id, is_draft=True)
|
||||
return {
|
||||
"variables": variables,
|
||||
}
|
||||
return dump_response(RagPipelineVariablesResponse, {"variables": variables})
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/processing/parameters")
|
||||
class DraftRagPipelineSecondStepApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(NodeIdQuery))
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineStepParametersResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Second step parameters retrieved successfully",
|
||||
console_ns.models[RagPipelineVariablesResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -875,9 +896,7 @@ class DraftRagPipelineSecondStepApi(Resource):
|
||||
|
||||
rag_pipeline_service = RagPipelineService()
|
||||
variables = rag_pipeline_service.get_second_step_parameters(pipeline=pipeline, node_id=node_id, is_draft=True)
|
||||
return {
|
||||
"variables": variables,
|
||||
}
|
||||
return dump_response(RagPipelineVariablesResponse, {"variables": variables})
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflow-runs")
|
||||
@ -910,7 +929,7 @@ class RagPipelineWorkflowRunListApi(Resource):
|
||||
rag_pipeline_service = RagPipelineService()
|
||||
result = rag_pipeline_service.get_rag_pipeline_paginate_workflow_runs(pipeline=pipeline, args=args)
|
||||
|
||||
return WorkflowRunPaginationResponse.model_validate(result, from_attributes=True).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunPaginationResponse, result)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflow-runs/<uuid:run_id>")
|
||||
@ -935,7 +954,7 @@ class RagPipelineWorkflowRunDetailApi(Resource):
|
||||
if workflow_run is None:
|
||||
raise NotFound("Workflow run not found")
|
||||
|
||||
return WorkflowRunDetailResponse.model_validate(workflow_run, from_attributes=True).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunDetailResponse, workflow_run)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflow-runs/<uuid:run_id>/node-executions")
|
||||
@ -964,20 +983,25 @@ class RagPipelineWorkflowRunNodeExecutionListApi(Resource):
|
||||
user=user,
|
||||
)
|
||||
|
||||
return WorkflowRunNodeExecutionListResponse.model_validate(
|
||||
{"data": node_executions}, from_attributes=True
|
||||
).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunNodeExecutionListResponse, {"data": node_executions})
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/datasource-plugins")
|
||||
class DatasourceListApi(Resource):
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Datasource plugins retrieved successfully",
|
||||
console_ns.models[DatasourcePluginListResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@with_current_tenant_id
|
||||
def get(self, current_tenant_id: str):
|
||||
return jsonable_encoder(RagPipelineManageService.list_rag_pipeline_datasources(current_tenant_id))
|
||||
return dump_response(
|
||||
DatasourcePluginListResponse,
|
||||
RagPipelineManageService.list_rag_pipeline_datasources(current_tenant_id),
|
||||
)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/nodes/<string:node_id>/last-run")
|
||||
@ -1003,12 +1027,16 @@ class RagPipelineWorkflowLastRunApi(Resource):
|
||||
)
|
||||
if node_exec is None:
|
||||
raise NotFound("last run not found")
|
||||
return WorkflowRunNodeExecutionResponse.model_validate(node_exec, from_attributes=True).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunNodeExecutionResponse, node_exec)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/transform/datasets/<uuid:dataset_id>")
|
||||
class RagPipelineTransformApi(Resource):
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Dataset transformed successfully",
|
||||
console_ns.models[RagPipelineTransformResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -1020,7 +1048,7 @@ class RagPipelineTransformApi(Resource):
|
||||
dataset_id_str = str(dataset_id)
|
||||
rag_pipeline_transform_service = RagPipelineTransformService()
|
||||
result = rag_pipeline_transform_service.transform_dataset(dataset_id_str, db.session)
|
||||
return result
|
||||
return dump_response(RagPipelineTransformResponse, result)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/datasource/variables-inspect")
|
||||
@ -1050,15 +1078,17 @@ class RagPipelineDatasourceVariableApi(Resource):
|
||||
args=args,
|
||||
current_user=current_user,
|
||||
)
|
||||
return WorkflowRunNodeExecutionResponse.model_validate(
|
||||
workflow_node_execution, from_attributes=True
|
||||
).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunNodeExecutionResponse, workflow_node_execution)
|
||||
|
||||
|
||||
@console_ns.route("/rag/pipelines/recommended-plugins")
|
||||
class RagPipelineRecommendedPluginApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(RagPipelineRecommendedPluginQuery))
|
||||
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Recommended plugins retrieved successfully",
|
||||
console_ns.models[RagPipelineRecommendedPluginResponse.__name__],
|
||||
)
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -1069,4 +1099,4 @@ class RagPipelineRecommendedPluginApi(Resource):
|
||||
|
||||
rag_pipeline_service = RagPipelineService()
|
||||
recommended_plugins = rag_pipeline_service.get_recommended_plugins(query.type, current_user, current_tenant_id)
|
||||
return recommended_plugins
|
||||
return dump_response(RagPipelineRecommendedPluginResponse, recommended_plugins)
|
||||
|
||||
@ -6,7 +6,7 @@ from pydantic import BaseModel, Field, field_validator
|
||||
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,
|
||||
@ -73,7 +73,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
|
||||
@ -83,7 +83,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
|
||||
def post(self, current_user: Account, installed_app: InstalledApp):
|
||||
app_model = installed_app.app
|
||||
@ -106,6 +106,7 @@ class CompletionApi(InstalledAppResource):
|
||||
app_model=app_model, user=current_user, args=args, invoke_from=InvokeFrom.EXPLORE, streaming=streaming
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -150,7 +151,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(
|
||||
@ -159,7 +160,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
|
||||
def post(self, current_user: Account, installed_app: InstalledApp):
|
||||
app_model = installed_app.app
|
||||
@ -182,6 +183,7 @@ class ChatApi(InstalledAppResource):
|
||||
app_model=app_model, user=current_user, args=args, invoke_from=InvokeFrom.EXPLORE, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -229,4 +231,4 @@ class ChatStopApi(InstalledAppResource):
|
||||
app_mode=app_mode,
|
||||
)
|
||||
|
||||
return {"result": "success"}, 200
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json"), 200
|
||||
|
||||
@ -7,7 +7,6 @@ from pydantic import BaseModel, TypeAdapter
|
||||
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,
|
||||
@ -59,7 +58,6 @@ class MoreLikeThisQuery(BaseModel):
|
||||
register_schema_models(console_ns, MessageListQuery, MessageFeedbackPayload, MoreLikeThisQuery)
|
||||
register_response_schema_models(
|
||||
console_ns,
|
||||
GeneratedAppResponse,
|
||||
ExploreMessageInfiniteScrollPagination,
|
||||
ResultResponse,
|
||||
SuggestedQuestionsResponse,
|
||||
@ -142,7 +140,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
|
||||
def get(self, current_user: Account, installed_app: InstalledApp, message_id: UUID):
|
||||
app_model = installed_app.app
|
||||
@ -165,6 +163,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.")
|
||||
|
||||
@ -1,28 +1,24 @@
|
||||
import logging
|
||||
from typing import Any, Literal, cast
|
||||
from typing import Literal
|
||||
|
||||
from flask import request
|
||||
from flask_restx import Resource, fields, marshal, marshal_with
|
||||
from flask_restx import Resource
|
||||
from pydantic import BaseModel, Field
|
||||
from sqlalchemy import select
|
||||
from werkzeug.exceptions import Forbidden, InternalServerError, NotFound
|
||||
|
||||
import services
|
||||
from controllers.common.fields import (
|
||||
AudioBinaryResponse,
|
||||
AudioTranscriptResponse,
|
||||
GeneratedAppResponse,
|
||||
SimpleResultResponse,
|
||||
)
|
||||
from controllers.common.fields import AudioBinaryResponse, AudioTranscriptResponse, SimpleResultResponse
|
||||
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,
|
||||
query_params_from_request,
|
||||
register_response_schema_models,
|
||||
register_schema_models,
|
||||
)
|
||||
from controllers.console import console_ns
|
||||
from controllers.console.app.app import AppDetailWithSite
|
||||
from controllers.console.app.error import (
|
||||
AppUnavailableError,
|
||||
AudioTooLargeError,
|
||||
@ -36,6 +32,7 @@ from controllers.console.app.error import (
|
||||
ProviderQuotaExceededError,
|
||||
UnsupportedAudioTypeError,
|
||||
)
|
||||
from controllers.console.app.workflow import WorkflowResponse
|
||||
from controllers.console.app.wraps import get_app_model_with_trial
|
||||
from controllers.console.explore.error import (
|
||||
AppSuggestedQuestionsAfterAnswerDisabledError,
|
||||
@ -56,26 +53,13 @@ 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.dataset_fields import dataset_fields
|
||||
from fields.member_fields import simple_account_fields
|
||||
from fields.base import ResponseModel
|
||||
from fields.dataset_fields import DatasetDetailResponse
|
||||
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 uuid_value
|
||||
from libs.helper import dump_response, uuid_value
|
||||
from models import Account
|
||||
from models.account import TenantStatus
|
||||
from models.model import AppMode, Site
|
||||
@ -102,57 +86,42 @@ 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)
|
||||
class TrialDatasetListItemResponse(DatasetDetailResponse):
|
||||
pass
|
||||
|
||||
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)
|
||||
class TrialDatasetListResponse(ResponseModel):
|
||||
data: list[TrialDatasetListItemResponse]
|
||||
has_more: bool
|
||||
limit: int
|
||||
total: int
|
||||
page: int
|
||||
|
||||
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,
|
||||
},
|
||||
register_response_schema_models(
|
||||
console_ns,
|
||||
ParametersResponse,
|
||||
AppDetailWithSite,
|
||||
AudioBinaryResponse,
|
||||
AudioTranscriptResponse,
|
||||
SimpleResultResponse,
|
||||
SiteResponse,
|
||||
SuggestedQuestionsResponse,
|
||||
TrialDatasetListItemResponse,
|
||||
TrialDatasetListResponse,
|
||||
WorkflowResponse,
|
||||
)
|
||||
|
||||
|
||||
class WorkflowRunRequest(BaseModel):
|
||||
inputs: dict
|
||||
files: list | None = Field(default=None)
|
||||
files: list | None = None
|
||||
|
||||
|
||||
class ChatRequest(BaseModel):
|
||||
inputs: dict
|
||||
query: str
|
||||
files: list | None = Field(default=None)
|
||||
files: list | None = None
|
||||
conversation_id: str | None = None
|
||||
parent_message_id: str | None = None
|
||||
retriever_from: str = "explore_app"
|
||||
@ -168,7 +137,7 @@ class TextToSpeechRequest(BaseModel):
|
||||
class CompletionRequest(BaseModel):
|
||||
inputs: dict
|
||||
query: str = ""
|
||||
files: list | None = Field(default=None)
|
||||
files: list | None = None
|
||||
response_mode: Literal["blocking", "streaming"] | None = None
|
||||
retriever_from: str = "explore_app"
|
||||
|
||||
@ -187,23 +156,13 @@ register_schema_models(
|
||||
CompletionRequest,
|
||||
TrialDatasetListQuery,
|
||||
)
|
||||
register_response_schema_models(
|
||||
console_ns,
|
||||
ParametersResponse,
|
||||
AudioBinaryResponse,
|
||||
AudioTranscriptResponse,
|
||||
GeneratedAppResponse,
|
||||
SimpleResultResponse,
|
||||
SiteResponse,
|
||||
SuggestedQuestionsResponse,
|
||||
)
|
||||
|
||||
|
||||
class TrialAppWorkflowRunApi(TrialAppResource):
|
||||
@trial_feature_enable
|
||||
@console_ns.expect(console_ns.models[WorkflowRunRequest.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@with_current_user
|
||||
@console_ns.expect(console_ns.models[WorkflowRunRequest.__name__])
|
||||
@console_ns.response(200, "Success")
|
||||
def post(self, current_user: Account, trial_app):
|
||||
"""
|
||||
Run workflow
|
||||
@ -224,6 +183,7 @@ class TrialAppWorkflowRunApi(TrialAppResource):
|
||||
app_model=app_model, user=current_user, args=args, invoke_from=InvokeFrom.EXPLORE, streaming=True
|
||||
)
|
||||
RecommendedAppService.add_trial_app_record(db.session, app_id, user_id)
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except ProviderTokenNotInitError as ex:
|
||||
raise ProviderNotInitializeError(ex.description)
|
||||
@ -263,12 +223,12 @@ class TrialAppWorkflowTaskStopApi(TrialAppResource):
|
||||
# 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")
|
||||
|
||||
|
||||
class TrialChatApi(TrialAppResource):
|
||||
@console_ns.expect(console_ns.models[ChatRequest.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@console_ns.response(200, "Success")
|
||||
@trial_feature_enable
|
||||
@with_current_user
|
||||
def post(self, current_user: Account, trial_app):
|
||||
@ -297,6 +257,7 @@ class TrialChatApi(TrialAppResource):
|
||||
app_model=app_model, user=current_user, args=args, invoke_from=InvokeFrom.EXPLORE, streaming=True
|
||||
)
|
||||
RecommendedAppService.add_trial_app_record(db.session, app_id, user_id)
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -355,7 +316,7 @@ class TrialMessageSuggestedQuestionApi(TrialAppResource):
|
||||
logger.exception("internal server error.")
|
||||
raise InternalServerError()
|
||||
|
||||
return {"data": questions}
|
||||
return dump_response(SuggestedQuestionsResponse, {"data": questions})
|
||||
|
||||
|
||||
class TrialChatAudioApi(TrialAppResource):
|
||||
@ -374,7 +335,7 @@ class TrialChatAudioApi(TrialAppResource):
|
||||
|
||||
response = AudioService.transcript_asr(app_model=app_model, file=file, end_user=None)
|
||||
RecommendedAppService.add_trial_app_record(db.session, app_id, user_id)
|
||||
return response
|
||||
return dump_response(AudioTranscriptResponse, response)
|
||||
except services.errors.app_model_config.AppModelConfigBrokenError:
|
||||
logger.exception("App model config broken.")
|
||||
raise AppUnavailableError()
|
||||
@ -427,6 +388,7 @@ class TrialChatTextApi(TrialAppResource):
|
||||
message_id=message_id,
|
||||
)
|
||||
RecommendedAppService.add_trial_app_record(db.session, app_id, user_id)
|
||||
# response-contract:ignore binary response
|
||||
return response
|
||||
except services.errors.app_model_config.AppModelConfigBrokenError:
|
||||
logger.exception("App model config broken.")
|
||||
@ -456,7 +418,7 @@ class TrialChatTextApi(TrialAppResource):
|
||||
|
||||
class TrialCompletionApi(TrialAppResource):
|
||||
@console_ns.expect(console_ns.models[CompletionRequest.__name__])
|
||||
@console_ns.response(200, "Success", console_ns.models[GeneratedAppResponse.__name__])
|
||||
@console_ns.response(200, "Success")
|
||||
@trial_feature_enable
|
||||
@with_current_user
|
||||
def post(self, current_user: Account, trial_app):
|
||||
@ -480,6 +442,7 @@ class TrialCompletionApi(TrialAppResource):
|
||||
)
|
||||
|
||||
RecommendedAppService.add_trial_app_record(db.session, app_id, user_id)
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -557,50 +520,49 @@ class TrialAppParameterApi(Resource):
|
||||
|
||||
|
||||
class AppApi(Resource):
|
||||
@console_ns.response(200, "Success", app_detail_with_site_model)
|
||||
@get_app_model_with_trial(None)
|
||||
@marshal_with(app_detail_with_site_model)
|
||||
@console_ns.response(200, "App detail retrieved successfully", console_ns.models[AppDetailWithSite.__name__])
|
||||
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(AppDetailWithSite, app_model)
|
||||
|
||||
|
||||
class AppWorkflowApi(Resource):
|
||||
@console_ns.response(200, "Success", workflow_model)
|
||||
@get_app_model_with_trial(None)
|
||||
@marshal_with(workflow_model)
|
||||
@console_ns.response(200, "Workflow detail retrieved successfully", console_ns.models[WorkflowResponse.__name__])
|
||||
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
|
||||
return dump_response(WorkflowResponse, workflow)
|
||||
|
||||
|
||||
class DatasetListApi(Resource):
|
||||
@console_ns.doc(params=query_params_from_model(TrialDatasetListQuery))
|
||||
@console_ns.response(200, "Success", dataset_list_model)
|
||||
@console_ns.response(200, "Success", console_ns.models[TrialDatasetListResponse.__name__])
|
||||
@get_app_model_with_trial(None)
|
||||
def get(self, app_model):
|
||||
page = request.args.get("page", default=1, type=int)
|
||||
limit = request.args.get("limit", default=20, type=int)
|
||||
ids = request.args.getlist("ids")
|
||||
query = query_params_from_request(
|
||||
TrialDatasetListQuery,
|
||||
list_fields=("ids",),
|
||||
use_defaults_for_malformed_ints=True,
|
||||
)
|
||||
|
||||
tenant_id = app_model.tenant_id
|
||||
if ids:
|
||||
datasets, total = DatasetService.get_datasets_by_ids(ids, tenant_id)
|
||||
if query.ids:
|
||||
datasets, total = DatasetService.get_datasets_by_ids(query.ids, tenant_id)
|
||||
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
|
||||
return TrialDatasetListResponse(
|
||||
data=datasets, has_more=len(datasets) == query.limit, limit=query.limit, total=total or 0, page=query.page
|
||||
).model_dump(mode="json")
|
||||
|
||||
|
||||
console_ns.add_resource(TrialChatApi, "/trial-apps/<uuid:app_id>/chat-messages", endpoint="trial_app_chat_completion")
|
||||
|
||||
@ -3,7 +3,7 @@ import logging
|
||||
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,
|
||||
@ -36,13 +36,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
|
||||
def post(self, current_user: Account, installed_app: InstalledApp):
|
||||
"""
|
||||
@ -62,6 +62,7 @@ class InstalledAppWorkflowRunApi(InstalledAppResource):
|
||||
app_model=app_model, user=current_user, args=args, invoke_from=InvokeFrom.EXPLORE, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except ProviderTokenNotInitError as ex:
|
||||
raise ProviderNotInitializeError(ex.description)
|
||||
@ -101,4 +102,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")
|
||||
|
||||
@ -8,20 +8,18 @@ from pydantic import BaseModel, Field
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
from werkzeug.exceptions import BadRequest, InternalServerError, NotFound
|
||||
|
||||
from controllers.common.fields import GeneratedAppResponse, SimpleResultResponse
|
||||
from controllers.common.fields import EventStreamResponse, SimpleResultResponse
|
||||
from controllers.common.schema import query_params_from_model, register_response_schema_models, register_schema_models
|
||||
from controllers.console import console_ns
|
||||
from controllers.console.app.error import DraftWorkflowNotExist, DraftWorkflowNotSync
|
||||
from controllers.console.app.workflow import (
|
||||
RESTORE_SOURCE_WORKFLOW_MUST_BE_PUBLISHED_MESSAGE,
|
||||
DefaultBlockConfigsResponse,
|
||||
PublishWorkflowResponse,
|
||||
SyncDraftWorkflowResponse,
|
||||
WorkflowPaginationResponse,
|
||||
WorkflowPublishResponse,
|
||||
WorkflowResponse,
|
||||
WorkflowRestoreResponse,
|
||||
)
|
||||
from controllers.console.snippets.payloads import (
|
||||
PublishWorkflowPayload,
|
||||
SnippetDraftNodeRunPayload,
|
||||
SnippetDraftRunPayload,
|
||||
SnippetDraftSyncPayload,
|
||||
@ -43,6 +41,7 @@ from core.app.apps.base_app_queue_manager import AppQueueManager
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from extensions.ext_database import db
|
||||
from extensions.ext_redis import redis_client
|
||||
from fields.base import ResponseModel
|
||||
from fields.workflow_run_fields import (
|
||||
WorkflowRunDetailResponse,
|
||||
WorkflowRunNodeExecutionListResponse,
|
||||
@ -51,7 +50,7 @@ from fields.workflow_run_fields import (
|
||||
)
|
||||
from graphon.graph_engine.manager import GraphEngineManager
|
||||
from libs import helper
|
||||
from libs.helper import TimestampField
|
||||
from libs.helper import dump_response, to_timestamp
|
||||
from libs.login import current_account_with_tenant, login_required
|
||||
from models import Account
|
||||
from models.snippet import CustomizedSnippet
|
||||
@ -76,7 +75,7 @@ class SnippetWorkflowResponse(WorkflowResponse):
|
||||
input_fields: list[dict] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SnippetDraftConfigResponse(BaseModel):
|
||||
class SnippetDraftConfigResponse(ResponseModel):
|
||||
parallel_depth_limit: int
|
||||
|
||||
|
||||
@ -96,19 +95,17 @@ register_schema_models(
|
||||
SnippetLoopNodeRunPayload,
|
||||
SnippetWorkflowListQuery,
|
||||
WorkflowRunQuery,
|
||||
PublishWorkflowPayload,
|
||||
)
|
||||
register_response_schema_models(
|
||||
console_ns,
|
||||
DefaultBlockConfigsResponse,
|
||||
GeneratedAppResponse,
|
||||
EventStreamResponse,
|
||||
SimpleResultResponse,
|
||||
SnippetDraftConfigResponse,
|
||||
SnippetWorkflowResponse,
|
||||
SnippetWorkflowPaginationResponse,
|
||||
WorkflowPublishResponse,
|
||||
PublishWorkflowResponse,
|
||||
WorkflowPaginationResponse,
|
||||
WorkflowRestoreResponse,
|
||||
SyncDraftWorkflowResponse,
|
||||
WorkflowRunPaginationResponse,
|
||||
WorkflowRunDetailResponse,
|
||||
WorkflowRunNodeExecutionListResponse,
|
||||
@ -175,7 +172,7 @@ class SnippetDraftWorkflowApi(Resource):
|
||||
raise DraftWorkflowNotExist()
|
||||
|
||||
workflow.conversation_variables = []
|
||||
response = SnippetWorkflowResponse.model_validate(workflow, from_attributes=True).model_dump(mode="json")
|
||||
response = dump_response(SnippetWorkflowResponse, workflow)
|
||||
response["input_fields"] = snippet.input_fields_list
|
||||
return response
|
||||
|
||||
@ -184,7 +181,7 @@ class SnippetDraftWorkflowApi(Resource):
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Draft workflow synced successfully",
|
||||
console_ns.models[WorkflowRestoreResponse.__name__],
|
||||
console_ns.models[SyncDraftWorkflowResponse.__name__],
|
||||
)
|
||||
@console_ns.response(400, "Hash mismatch")
|
||||
@setup_required
|
||||
@ -214,11 +211,11 @@ class SnippetDraftWorkflowApi(Resource):
|
||||
except ValueError as e:
|
||||
return {"message": str(e)}, 400
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"hash": workflow.unique_hash,
|
||||
"updated_at": TimestampField().format(workflow.updated_at or workflow.created_at),
|
||||
}
|
||||
return SyncDraftWorkflowResponse(
|
||||
result="success",
|
||||
hash=workflow.unique_hash,
|
||||
updated_at=to_timestamp(workflow.updated_at or workflow.created_at),
|
||||
).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflows/draft/config")
|
||||
@ -237,9 +234,7 @@ class SnippetDraftConfigApi(Resource):
|
||||
@rbac_permission_required(RBACResourceScope.WORKSPACE, RBACPermission.SNIPPETS_MANAGE, resource_required=False)
|
||||
def get(self, snippet: CustomizedSnippet):
|
||||
"""Get snippet draft workflow configuration limits."""
|
||||
return {
|
||||
"parallel_depth_limit": 3,
|
||||
}
|
||||
return SnippetDraftConfigResponse(parallel_depth_limit=3).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflows/publish")
|
||||
@ -268,13 +263,12 @@ class SnippetPublishedWorkflowApi(Resource):
|
||||
if not workflow:
|
||||
return None
|
||||
|
||||
response = SnippetWorkflowResponse.model_validate(workflow, from_attributes=True).model_dump(mode="json")
|
||||
response = dump_response(SnippetWorkflowResponse, workflow)
|
||||
response["input_fields"] = snippet.input_fields_list
|
||||
return response
|
||||
|
||||
@console_ns.doc("publish_snippet_workflow")
|
||||
@console_ns.expect(console_ns.models.get(PublishWorkflowPayload.__name__))
|
||||
@console_ns.response(200, "Workflow published successfully", console_ns.models[WorkflowPublishResponse.__name__])
|
||||
@console_ns.response(200, "Workflow published successfully", console_ns.models[PublishWorkflowResponse.__name__])
|
||||
@console_ns.response(400, "No draft workflow found")
|
||||
@setup_required
|
||||
@login_required
|
||||
@ -297,25 +291,18 @@ class SnippetPublishedWorkflowApi(Resource):
|
||||
snippet=snippet,
|
||||
account=current_user,
|
||||
)
|
||||
workflow_created_at = TimestampField().format(workflow.created_at)
|
||||
workflow_created_at = to_timestamp(workflow.created_at)
|
||||
session.commit()
|
||||
except ValueError as e:
|
||||
return {"message": str(e)}, 400
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"created_at": workflow_created_at,
|
||||
}
|
||||
return PublishWorkflowResponse(result="success", created_at=workflow_created_at).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflows/default-workflow-block-configs")
|
||||
class SnippetDefaultBlockConfigsApi(Resource):
|
||||
@console_ns.doc("get_snippet_default_block_configs")
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Default block configs retrieved successfully",
|
||||
console_ns.models[DefaultBlockConfigsResponse.__name__],
|
||||
)
|
||||
@console_ns.response(200, "Default block configs retrieved successfully")
|
||||
@setup_required
|
||||
@login_required
|
||||
@account_initialization_required
|
||||
@ -377,7 +364,7 @@ class SnippetDraftWorkflowRestoreApi(Resource):
|
||||
@console_ns.doc("restore_snippet_workflow_to_draft")
|
||||
@console_ns.doc(description="Restore a published snippet workflow version into the draft workflow")
|
||||
@console_ns.doc(params={"snippet_id": "Snippet ID", "workflow_id": "Published workflow ID"})
|
||||
@console_ns.response(200, "Workflow restored successfully", console_ns.models[WorkflowRestoreResponse.__name__])
|
||||
@console_ns.response(200, "Workflow restored successfully", console_ns.models[SyncDraftWorkflowResponse.__name__])
|
||||
@console_ns.response(400, "Source workflow must be published")
|
||||
@console_ns.response(404, "Workflow not found")
|
||||
@setup_required
|
||||
@ -406,11 +393,11 @@ class SnippetDraftWorkflowRestoreApi(Resource):
|
||||
except ValueError as exc:
|
||||
raise BadRequest(str(exc)) from exc
|
||||
|
||||
return {
|
||||
"result": "success",
|
||||
"hash": workflow.unique_hash,
|
||||
"updated_at": TimestampField().format(workflow.updated_at or workflow.created_at),
|
||||
}
|
||||
return SyncDraftWorkflowResponse(
|
||||
result="success",
|
||||
hash=workflow.unique_hash,
|
||||
updated_at=to_timestamp(workflow.updated_at or workflow.created_at),
|
||||
).model_dump(mode="json")
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflow-runs")
|
||||
@ -442,7 +429,7 @@ class SnippetWorkflowRunsApi(Resource):
|
||||
snippet_service = _snippet_service()
|
||||
result = snippet_service.get_snippet_workflow_runs(snippet=snippet, args=args)
|
||||
|
||||
return WorkflowRunPaginationResponse.model_validate(result, from_attributes=True).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunPaginationResponse, result)
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflow-runs/<uuid:run_id>")
|
||||
@ -468,7 +455,7 @@ class SnippetWorkflowRunDetailApi(Resource):
|
||||
if not workflow_run:
|
||||
raise NotFound("Workflow run not found")
|
||||
|
||||
return WorkflowRunDetailResponse.model_validate(workflow_run, from_attributes=True).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunDetailResponse, workflow_run)
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflow-runs/<uuid:run_id>/node-executions")
|
||||
@ -493,9 +480,7 @@ class SnippetWorkflowRunNodeExecutionsApi(Resource):
|
||||
run_id=run_id,
|
||||
)
|
||||
|
||||
return WorkflowRunNodeExecutionListResponse.model_validate(
|
||||
{"data": node_executions}, from_attributes=True
|
||||
).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunNodeExecutionListResponse, {"data": node_executions})
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflows/draft/nodes/<string:node_id>/run")
|
||||
@ -546,9 +531,7 @@ class SnippetDraftNodeRunApi(Resource):
|
||||
session_maker=_snippet_session_maker(),
|
||||
)
|
||||
|
||||
return WorkflowRunNodeExecutionResponse.model_validate(
|
||||
workflow_node_execution, from_attributes=True
|
||||
).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunNodeExecutionResponse, workflow_node_execution)
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflows/draft/nodes/<string:node_id>/last-run")
|
||||
@ -584,7 +567,7 @@ class SnippetDraftNodeLastRunApi(Resource):
|
||||
if node_exec is None:
|
||||
raise NotFound("Node last run not found")
|
||||
|
||||
return WorkflowRunNodeExecutionResponse.model_validate(node_exec, from_attributes=True).model_dump(mode="json")
|
||||
return dump_response(WorkflowRunNodeExecutionResponse, node_exec)
|
||||
|
||||
|
||||
@console_ns.route("/snippets/<uuid:snippet_id>/workflows/draft/iteration/nodes/<string:node_id>/run")
|
||||
@ -596,7 +579,7 @@ class SnippetDraftRunIterationNodeApi(Resource):
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Iteration node run started successfully (SSE stream)",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
console_ns.models[EventStreamResponse.__name__],
|
||||
)
|
||||
@console_ns.response(404, "Snippet or draft workflow not found")
|
||||
@setup_required
|
||||
@ -627,6 +610,7 @@ class SnippetDraftRunIterationNodeApi(Resource):
|
||||
session_maker=_snippet_session_maker(),
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except ValueError as e:
|
||||
raise e
|
||||
@ -644,7 +628,7 @@ class SnippetDraftRunLoopNodeApi(Resource):
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Loop node run started successfully (SSE stream)",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
console_ns.models[EventStreamResponse.__name__],
|
||||
)
|
||||
@console_ns.response(404, "Snippet or draft workflow not found")
|
||||
@setup_required
|
||||
@ -675,6 +659,7 @@ class SnippetDraftRunLoopNodeApi(Resource):
|
||||
session_maker=_snippet_session_maker(),
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except ValueError as e:
|
||||
raise e
|
||||
@ -690,7 +675,7 @@ class SnippetDraftWorkflowRunApi(Resource):
|
||||
@console_ns.response(
|
||||
200,
|
||||
"Draft workflow run started successfully (SSE stream)",
|
||||
console_ns.models[GeneratedAppResponse.__name__],
|
||||
console_ns.models[EventStreamResponse.__name__],
|
||||
)
|
||||
@console_ns.response(404, "Snippet or draft workflow not found")
|
||||
@setup_required
|
||||
@ -722,6 +707,7 @@ class SnippetDraftWorkflowRunApi(Resource):
|
||||
session_maker=_snippet_session_maker(),
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except ValueError as e:
|
||||
raise e
|
||||
@ -757,4 +743,4 @@ class SnippetWorkflowTaskStopApi(Resource):
|
||||
# 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")
|
||||
|
||||
@ -9,7 +9,7 @@ from pydantic.json_schema import SkipJsonSchema
|
||||
from werkzeug.exceptions import BadRequest, 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.service_api import service_api_ns
|
||||
from controllers.service_api.app.error import (
|
||||
@ -154,7 +154,7 @@ class ChatRequestPayload(BaseModel):
|
||||
|
||||
|
||||
register_schema_models(service_api_ns, CompletionRequestPayload, ChatRequestPayload)
|
||||
register_response_schema_models(service_api_ns, GeneratedAppResponse, SimpleResultResponse)
|
||||
register_response_schema_models(service_api_ns, SimpleResultResponse)
|
||||
|
||||
|
||||
@service_api_ns.route("/completion-messages")
|
||||
@ -197,11 +197,7 @@ class CompletionApi(Resource):
|
||||
500: "Internal server error",
|
||||
}
|
||||
)
|
||||
@service_api_ns.response(
|
||||
200,
|
||||
"Completion created successfully",
|
||||
service_api_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@service_api_ns.response(200, "Completion created successfully")
|
||||
@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True))
|
||||
def post(self, app_model: App, end_user: EndUser):
|
||||
"""Create a completion for the given prompt.
|
||||
@ -236,6 +232,7 @@ class CompletionApi(Resource):
|
||||
streaming=streaming,
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -296,7 +293,7 @@ class CompletionStopApi(Resource):
|
||||
app_mode=AppMode.value_of(app_model.mode),
|
||||
)
|
||||
|
||||
return {"result": "success"}, 200
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json"), 200
|
||||
|
||||
|
||||
@service_api_ns.route("/chat-messages")
|
||||
@ -346,11 +343,7 @@ class ChatApi(Resource):
|
||||
500: "Internal server error",
|
||||
}
|
||||
)
|
||||
@service_api_ns.response(
|
||||
200,
|
||||
"Message sent successfully",
|
||||
service_api_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@service_api_ns.response(200, "Message sent successfully")
|
||||
@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True))
|
||||
def post(self, app_model: App, end_user: EndUser):
|
||||
"""Send a message in a chat conversation.
|
||||
@ -379,6 +372,7 @@ class ChatApi(Resource):
|
||||
app_model=app_model, user=end_user, args=args, invoke_from=InvokeFrom.SERVICE_API, streaming=streaming
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except WorkflowNotFoundError as ex:
|
||||
raise NotFound(str(ex))
|
||||
@ -448,4 +442,4 @@ class ChatStopApi(Resource):
|
||||
app_mode=app_mode,
|
||||
)
|
||||
|
||||
return {"result": "success"}, 200
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json"), 200
|
||||
|
||||
@ -1,19 +1,24 @@
|
||||
import logging
|
||||
from collections.abc import Mapping
|
||||
from datetime import datetime
|
||||
from typing import Literal, override
|
||||
from typing import Literal
|
||||
|
||||
from dateutil.parser import isoparse
|
||||
from flask import request
|
||||
from flask_restx import Resource, fields
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from flask_restx import Resource
|
||||
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||
from pydantic.json_schema import SkipJsonSchema
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from werkzeug.exceptions import BadRequest, InternalServerError, NotFound
|
||||
|
||||
from controllers.common.controller_schemas import WorkflowRunPayload as WorkflowRunPayloadBase
|
||||
from controllers.common.fields import GeneratedAppResponse, SimpleResultResponse
|
||||
from controllers.common.schema import query_params_from_model, register_response_schema_models, register_schema_models
|
||||
from controllers.common.fields import SimpleResultResponse
|
||||
from controllers.common.schema import (
|
||||
query_params_from_model,
|
||||
query_params_from_request,
|
||||
register_response_schema_models,
|
||||
register_schema_models,
|
||||
)
|
||||
from controllers.service_api import service_api_ns
|
||||
from controllers.service_api.app.error import (
|
||||
CompletionRequestError,
|
||||
@ -41,14 +46,13 @@ from extensions.ext_database import db
|
||||
from extensions.ext_redis import redis_client
|
||||
from fields.base import ResponseModel
|
||||
from fields.end_user_fields import SimpleEndUser
|
||||
from fields.member_fields import SimpleAccount
|
||||
from fields.member_fields import SimpleAccountResponse
|
||||
from graphon.enums import WorkflowExecutionStatus
|
||||
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
|
||||
from libs.helper import dump_response, to_timestamp
|
||||
from models.model import App, AppMode, EndUser
|
||||
from models.workflow import WorkflowRun
|
||||
from repositories.factory import DifyAPIRepositoryFactory
|
||||
from services.app_generate_service import AppGenerateService
|
||||
from services.errors.app import IsDraftWorkflowError, WorkflowIdFormatError, WorkflowNotFoundError
|
||||
@ -97,36 +101,19 @@ class WorkflowLogQuery(BaseModel):
|
||||
|
||||
|
||||
register_schema_models(service_api_ns, WorkflowRunPayload, WorkflowLogQuery)
|
||||
register_response_schema_models(service_api_ns, GeneratedAppResponse, SimpleResultResponse)
|
||||
register_response_schema_models(service_api_ns, SimpleResultResponse)
|
||||
|
||||
|
||||
def _enum_value(value):
|
||||
return getattr(value, "value", value)
|
||||
|
||||
|
||||
class WorkflowRunStatusField(fields.Raw):
|
||||
@override
|
||||
def output(self, key, obj: WorkflowRun, **kwargs):
|
||||
return _enum_value(obj.status)
|
||||
|
||||
|
||||
class WorkflowRunOutputsField(fields.Raw):
|
||||
@override
|
||||
def output(self, key, obj: WorkflowRun, **kwargs):
|
||||
status = _enum_value(obj.status)
|
||||
if status == WorkflowExecutionStatus.PAUSED.value:
|
||||
return {}
|
||||
|
||||
outputs = obj.outputs_dict
|
||||
return outputs or {}
|
||||
|
||||
|
||||
class WorkflowRunResponse(ResponseModel):
|
||||
id: str
|
||||
workflow_id: str
|
||||
status: str
|
||||
inputs: dict | list | str | int | float | bool | None = Field(default=None)
|
||||
outputs: dict = Field(default_factory=dict)
|
||||
outputs: dict = Field(default_factory=dict, validation_alias="outputs_dict")
|
||||
error: str | None = None
|
||||
total_steps: int | None = None
|
||||
total_tokens: int | None = None
|
||||
@ -134,11 +121,33 @@ class WorkflowRunResponse(ResponseModel):
|
||||
finished_at: int | None = None
|
||||
elapsed_time: float | int | None = None
|
||||
|
||||
@field_validator("status", mode="before")
|
||||
@classmethod
|
||||
def _normalize_enum(cls, value):
|
||||
return _enum_value(value)
|
||||
|
||||
@field_validator("outputs", mode="before")
|
||||
@classmethod
|
||||
def _normalize_outputs(cls, value):
|
||||
if value is None:
|
||||
return {}
|
||||
if isinstance(value, dict):
|
||||
return value
|
||||
if isinstance(value, Mapping):
|
||||
return dict(value)
|
||||
return {}
|
||||
|
||||
@field_validator("created_at", "finished_at", mode="before")
|
||||
@classmethod
|
||||
def _normalize_timestamp(cls, value: datetime | int | None) -> int | None:
|
||||
return to_timestamp(value)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def _clear_paused_outputs(self):
|
||||
if self.status == WorkflowExecutionStatus.PAUSED.value:
|
||||
self.outputs = {}
|
||||
return self
|
||||
|
||||
|
||||
class WorkflowRunForLogResponse(ResponseModel):
|
||||
id: str
|
||||
@ -170,7 +179,7 @@ class WorkflowAppLogPartialResponse(ResponseModel):
|
||||
details: dict | list | str | int | float | bool | None = Field(default=None)
|
||||
created_from: str | None = None
|
||||
created_by_role: str | None = None
|
||||
created_by_account: SimpleAccount | None = None
|
||||
created_by_account: SimpleAccountResponse | None = None
|
||||
created_by_end_user: SimpleEndUser | None = None
|
||||
created_at: int | None = None
|
||||
|
||||
@ -202,39 +211,6 @@ register_response_schema_models(
|
||||
)
|
||||
|
||||
|
||||
def _serialize_workflow_run(workflow_run: WorkflowRun) -> dict:
|
||||
status = _enum_value(workflow_run.status)
|
||||
raw_outputs = workflow_run.outputs_dict
|
||||
match raw_outputs:
|
||||
case _ if status == WorkflowExecutionStatus.PAUSED.value or raw_outputs is None:
|
||||
outputs: dict = {}
|
||||
case dict():
|
||||
outputs = raw_outputs
|
||||
case _ if isinstance(raw_outputs, Mapping):
|
||||
outputs = dict(raw_outputs)
|
||||
case _:
|
||||
outputs = {}
|
||||
return WorkflowRunResponse.model_validate(
|
||||
{
|
||||
"id": workflow_run.id,
|
||||
"workflow_id": workflow_run.workflow_id,
|
||||
"status": status,
|
||||
"inputs": workflow_run.inputs,
|
||||
"outputs": outputs,
|
||||
"error": workflow_run.error,
|
||||
"total_steps": workflow_run.total_steps,
|
||||
"total_tokens": workflow_run.total_tokens,
|
||||
"created_at": workflow_run.created_at,
|
||||
"finished_at": workflow_run.finished_at,
|
||||
"elapsed_time": workflow_run.elapsed_time,
|
||||
}
|
||||
).model_dump(mode="json")
|
||||
|
||||
|
||||
def _serialize_workflow_log_pagination(pagination) -> dict:
|
||||
return WorkflowAppLogPaginationResponse.model_validate(pagination, from_attributes=True).model_dump(mode="json")
|
||||
|
||||
|
||||
@service_api_ns.route("/workflows/run/<string:workflow_run_id>")
|
||||
class WorkflowRunDetailApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
@ -287,7 +263,7 @@ class WorkflowRunDetailApi(Resource):
|
||||
)
|
||||
if not workflow_run:
|
||||
raise NotFound("Workflow run not found.")
|
||||
return _serialize_workflow_run(workflow_run)
|
||||
return dump_response(WorkflowRunResponse, workflow_run)
|
||||
|
||||
|
||||
@service_api_ns.route("/workflows/run")
|
||||
@ -338,7 +314,6 @@ class WorkflowRunApi(Resource):
|
||||
@service_api_ns.response(
|
||||
200,
|
||||
"Workflow executed successfully",
|
||||
service_api_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True))
|
||||
def post(self, app_model: App, end_user: EndUser):
|
||||
@ -366,6 +341,7 @@ class WorkflowRunApi(Resource):
|
||||
app_model=app_model, user=end_user, args=args, invoke_from=InvokeFrom.SERVICE_API, streaming=streaming
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except ProviderTokenNotInitError as ex:
|
||||
raise ProviderNotInitializeError(ex.description)
|
||||
@ -445,7 +421,6 @@ class WorkflowRunByIdApi(Resource):
|
||||
@service_api_ns.response(
|
||||
200,
|
||||
"Workflow executed successfully",
|
||||
service_api_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True))
|
||||
def post(self, app_model: App, end_user: EndUser, workflow_id: str):
|
||||
@ -476,6 +451,7 @@ class WorkflowRunByIdApi(Resource):
|
||||
app_model=app_model, user=end_user, args=args, invoke_from=InvokeFrom.SERVICE_API, streaming=streaming
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except WorkflowNotFoundError as ex:
|
||||
raise NotFound(str(ex))
|
||||
@ -541,7 +517,7 @@ class WorkflowTaskStopApi(Resource):
|
||||
# New graph engine command channel mechanism
|
||||
GraphEngineManager(redis_client).send_stop_command(task_id)
|
||||
|
||||
return {"result": "success"}
|
||||
return SimpleResultResponse(result="success").model_dump()
|
||||
|
||||
|
||||
@service_api_ns.route("/workflows/logs")
|
||||
@ -574,7 +550,7 @@ class WorkflowAppLogApi(Resource):
|
||||
|
||||
Returns paginated workflow execution logs with filtering options.
|
||||
"""
|
||||
args = WorkflowLogQuery.model_validate(request.args.to_dict())
|
||||
args = query_params_from_request(WorkflowLogQuery)
|
||||
|
||||
status = WorkflowExecutionStatus(args.status) if args.status else None
|
||||
created_at_before = isoparse(args.created_at__before) if args.created_at__before else None
|
||||
@ -596,4 +572,4 @@ class WorkflowAppLogApi(Resource):
|
||||
created_by_account=args.created_by_account,
|
||||
)
|
||||
|
||||
return _serialize_workflow_log_pagination(workflow_app_log_pagination)
|
||||
return dump_response(WorkflowAppLogPaginationResponse, workflow_app_log_pagination)
|
||||
|
||||
@ -1,34 +1,30 @@
|
||||
from collections.abc import Generator
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from flask import request
|
||||
from pydantic import BaseModel, Field, RootModel
|
||||
from pydantic import BaseModel, Field, RootModel, field_validator
|
||||
from sqlalchemy import select
|
||||
from werkzeug.exceptions import Forbidden, NotFound
|
||||
|
||||
import services
|
||||
from controllers.common.errors import FilenameNotExistsError, NoFileUploadedError, TooManyFilesError
|
||||
from controllers.common.fields import GeneratedAppResponse
|
||||
from controllers.common.schema import (
|
||||
query_params_from_model,
|
||||
query_params_from_request,
|
||||
register_response_schema_models,
|
||||
register_schema_model,
|
||||
register_schema_models,
|
||||
)
|
||||
from controllers.service_api import service_api_ns
|
||||
from controllers.service_api.dataset.error import PipelineRunError
|
||||
from controllers.service_api.dataset.rag_pipeline.serializers import serialize_upload_file
|
||||
from controllers.service_api.schema import (
|
||||
event_stream_response,
|
||||
json_or_event_stream_response,
|
||||
multipart_file_params,
|
||||
)
|
||||
from controllers.service_api.schema import event_stream_response, json_or_event_stream_response, multipart_file_params
|
||||
from controllers.service_api.wraps import DatasetApiResource
|
||||
from core.app.apps.pipeline.pipeline_generator import PipelineGenerator
|
||||
from core.app.entities.app_invoke_entities import InvokeFrom
|
||||
from fields.base import ResponseModel
|
||||
from libs import helper
|
||||
from libs.helper import dump_response
|
||||
from libs.login import current_user
|
||||
from models import Account
|
||||
from models.dataset import Dataset, Pipeline
|
||||
@ -82,7 +78,7 @@ class DatasourcePluginResponse(ResponseModel):
|
||||
datasource_type: str | None = None
|
||||
title: str | None = None
|
||||
user_input_variables: list[dict[str, Any]] = Field(default_factory=list)
|
||||
credentials: list[DatasourceCredentialInfoResponse]
|
||||
credentials: list[DatasourceCredentialInfoResponse] = Field(default_factory=list)
|
||||
|
||||
|
||||
class DatasourcePluginListResponse(RootModel[list[DatasourcePluginResponse]]):
|
||||
@ -98,14 +94,22 @@ class PipelineUploadFileResponse(ResponseModel):
|
||||
created_by: str
|
||||
created_at: str | None = None
|
||||
|
||||
@field_validator("created_at", mode="before")
|
||||
@classmethod
|
||||
def _normalize_created_at(cls, value: datetime | str | None) -> str | None:
|
||||
if isinstance(value, datetime):
|
||||
return value.isoformat()
|
||||
return value
|
||||
|
||||
|
||||
register_schema_model(service_api_ns, DatasourceNodeRunPayload)
|
||||
register_schema_model(service_api_ns, DatasourcePluginsQuery)
|
||||
register_schema_model(service_api_ns, PipelineRunApiEntity)
|
||||
register_schema_models(service_api_ns, DatasourcePluginsQuery)
|
||||
register_response_schema_models(
|
||||
service_api_ns,
|
||||
DatasourceCredentialInfoResponse,
|
||||
DatasourcePluginResponse,
|
||||
DatasourcePluginListResponse,
|
||||
GeneratedAppResponse,
|
||||
PipelineUploadFileResponse,
|
||||
)
|
||||
|
||||
@ -117,8 +121,8 @@ class DatasourcePluginsApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="List Datasource Plugins",
|
||||
description=(
|
||||
"List the datasource nodes configured in the knowledge pipeline. Each node includes the "
|
||||
"plugin it uses plus the metadata needed to run it."
|
||||
"List the datasource nodes configured in the knowledge pipeline. Each node includes the plugin it uses "
|
||||
"plus the metadata needed to run it."
|
||||
),
|
||||
tags=["Knowledge Pipeline"],
|
||||
responses={
|
||||
@ -150,14 +154,13 @@ class DatasourcePluginsApi(DatasetApiResource):
|
||||
if not dataset:
|
||||
raise NotFound("Dataset not found.")
|
||||
|
||||
# Get query parameter to determine published or draft
|
||||
is_published: bool = request.args.get("is_published", default=True, type=bool)
|
||||
query = query_params_from_request(DatasourcePluginsQuery)
|
||||
|
||||
rag_pipeline_service: RagPipelineService = RagPipelineService()
|
||||
datasource_plugins: list[dict[Any, Any]] = rag_pipeline_service.get_datasource_plugins(
|
||||
tenant_id=tenant_id, dataset_id=dataset_id_str, is_published=is_published
|
||||
tenant_id=tenant_id, dataset_id=dataset_id_str, is_published=query.is_published
|
||||
)
|
||||
return datasource_plugins, 200
|
||||
return dump_response(DatasourcePluginListResponse, datasource_plugins), 200
|
||||
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/pipeline/datasource/nodes/<string:node_id>/run")
|
||||
@ -167,8 +170,8 @@ class DatasourceNodeRunApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Run Datasource Node",
|
||||
description=(
|
||||
"Execute a single datasource node within the knowledge pipeline. Returns a streaming "
|
||||
"response with the node execution results."
|
||||
"Execute a single datasource node within the knowledge pipeline. Returns a streaming response with the "
|
||||
"node execution results."
|
||||
),
|
||||
tags=["Knowledge Pipeline"],
|
||||
responses={
|
||||
@ -187,11 +190,6 @@ class DatasourceNodeRunApi(DatasetApiResource):
|
||||
}
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[DatasourceNodeRunPayload.__name__])
|
||||
@service_api_ns.response(
|
||||
200,
|
||||
"Datasource node run successfully",
|
||||
service_api_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
def post(self, tenant_id: str, dataset_id: UUID, node_id: str):
|
||||
"""Resource for getting datasource plugins."""
|
||||
dataset_id_str = str(dataset_id)
|
||||
@ -208,10 +206,11 @@ class DatasourceNodeRunApi(DatasetApiResource):
|
||||
datasource_node_run_api_entity = DatasourceNodeRunApiEntity.model_validate(
|
||||
{
|
||||
**payload.model_dump(exclude_none=True),
|
||||
"pipeline_id": str(pipeline.id),
|
||||
"pipeline_id": pipeline.id,
|
||||
"node_id": node_id,
|
||||
}
|
||||
)
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(
|
||||
PipelineGenerator.convert_to_event_stream(
|
||||
rag_pipeline_service.run_datasource_workflow_node(
|
||||
@ -234,8 +233,8 @@ class PipelineRunApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Run Pipeline",
|
||||
description=(
|
||||
"Execute the full knowledge pipeline for a knowledge base. Supports both streaming and "
|
||||
"blocking response modes."
|
||||
"Execute the full knowledge pipeline for a knowledge base. Supports both streaming and blocking response "
|
||||
"modes."
|
||||
),
|
||||
tags=["Knowledge Pipeline"],
|
||||
responses={
|
||||
@ -259,11 +258,6 @@ class PipelineRunApi(DatasetApiResource):
|
||||
}
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[PipelineRunApiEntity.__name__])
|
||||
@service_api_ns.response(
|
||||
200,
|
||||
"Pipeline run successfully",
|
||||
service_api_ns.models[GeneratedAppResponse.__name__],
|
||||
)
|
||||
def post(self, tenant_id: str, dataset_id: UUID):
|
||||
"""Resource for running a rag pipeline."""
|
||||
dataset_id_str = str(dataset_id)
|
||||
@ -289,6 +283,7 @@ class PipelineRunApi(DatasetApiResource):
|
||||
streaming=payload.response_mode == "streaming",
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except Exception as ex:
|
||||
raise PipelineRunError(description=str(ex))
|
||||
@ -364,4 +359,4 @@ class KnowledgebasePipelineFileUploadApi(DatasetApiResource):
|
||||
except services.errors.file.UnsupportedFileTypeError:
|
||||
raise UnsupportedFileTypeError()
|
||||
|
||||
return serialize_upload_file(upload_file), 201
|
||||
return dump_response(PipelineUploadFileResponse, upload_file), 201
|
||||
|
||||
@ -5,7 +5,7 @@ from pydantic import BaseModel, Field, field_validator
|
||||
from werkzeug.exceptions import BadRequest, 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.web import web_ns
|
||||
from controllers.web.error import (
|
||||
@ -87,7 +87,7 @@ class ChatMessagePayload(BaseModel):
|
||||
|
||||
|
||||
register_schema_models(web_ns, CompletionMessagePayload, ChatMessagePayload)
|
||||
register_response_schema_models(web_ns, GeneratedAppResponse, SimpleResultResponse)
|
||||
register_response_schema_models(web_ns, SimpleResultResponse)
|
||||
|
||||
|
||||
# define completion api for user
|
||||
@ -106,7 +106,7 @@ class CompletionApi(WebApiResource):
|
||||
500: "Internal Server Error",
|
||||
}
|
||||
)
|
||||
@web_ns.response(200, "Success", web_ns.models[GeneratedAppResponse.__name__])
|
||||
@web_ns.response(200, "Success")
|
||||
def post(self, app_model: App, end_user: EndUser):
|
||||
if app_model.mode != AppMode.COMPLETION:
|
||||
raise NotCompletionAppError()
|
||||
@ -122,6 +122,7 @@ class CompletionApi(WebApiResource):
|
||||
app_model=app_model, user=end_user, args=args, invoke_from=InvokeFrom.WEB_APP, streaming=streaming
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -172,7 +173,7 @@ class CompletionStopApi(WebApiResource):
|
||||
app_mode=AppMode.value_of(app_model.mode),
|
||||
)
|
||||
|
||||
return {"result": "success"}, 200
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json"), 200
|
||||
|
||||
|
||||
@web_ns.route("/chat-messages")
|
||||
@ -190,7 +191,7 @@ class ChatApi(WebApiResource):
|
||||
500: "Internal Server Error",
|
||||
}
|
||||
)
|
||||
@web_ns.response(200, "Success", web_ns.models[GeneratedAppResponse.__name__])
|
||||
@web_ns.response(200, "Success")
|
||||
def post(self, app_model: App, end_user: EndUser):
|
||||
app_mode = AppMode.value_of(app_model.mode)
|
||||
if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT, AppMode.AGENT}:
|
||||
@ -213,6 +214,7 @@ class ChatApi(WebApiResource):
|
||||
app_model=app_model, user=end_user, args=args, invoke_from=InvokeFrom.WEB_APP, streaming=streaming
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except services.errors.conversation.ConversationNotExistsError:
|
||||
raise NotFound("Conversation Not Exists.")
|
||||
@ -266,4 +268,4 @@ class ChatStopApi(WebApiResource):
|
||||
app_mode=app_mode,
|
||||
)
|
||||
|
||||
return {"result": "success"}, 200
|
||||
return SimpleResultResponse(result="success").model_dump(mode="json"), 200
|
||||
|
||||
@ -7,7 +7,6 @@ from pydantic import BaseModel, Field, TypeAdapter
|
||||
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.web import web_ns
|
||||
from controllers.web.error import (
|
||||
@ -51,7 +50,6 @@ class MessageMoreLikeThisQuery(BaseModel):
|
||||
register_schema_models(web_ns, MessageListQuery, MessageFeedbackPayload, MessageMoreLikeThisQuery)
|
||||
register_response_schema_models(
|
||||
web_ns,
|
||||
GeneratedAppResponse,
|
||||
ResultResponse,
|
||||
SuggestedQuestionsResponse,
|
||||
WebMessageInfiniteScrollPagination,
|
||||
@ -161,7 +159,7 @@ class MessageMoreLikeThisApi(WebApiResource):
|
||||
500: "Internal Server Error",
|
||||
}
|
||||
)
|
||||
@web_ns.response(200, "Success", web_ns.models[GeneratedAppResponse.__name__])
|
||||
@web_ns.response(200, "Success")
|
||||
def get(self, app_model: App, end_user: EndUser, message_id: UUID):
|
||||
if app_model.mode != "completion":
|
||||
raise NotCompletionAppError()
|
||||
@ -182,6 +180,7 @@ class MessageMoreLikeThisApi(WebApiResource):
|
||||
streaming=streaming,
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except MessageNotExistsError:
|
||||
raise NotFound("Message Not Exists.")
|
||||
|
||||
@ -3,7 +3,7 @@ import logging
|
||||
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_models
|
||||
from controllers.web import web_ns
|
||||
from controllers.web.error import (
|
||||
@ -33,7 +33,7 @@ from services.errors.llm import InvokeRateLimitError
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
register_schema_models(web_ns, WorkflowRunPayload)
|
||||
register_response_schema_models(web_ns, GeneratedAppResponse, SimpleResultResponse)
|
||||
register_response_schema_models(web_ns, SimpleResultResponse)
|
||||
|
||||
|
||||
@web_ns.route("/workflows/run")
|
||||
@ -51,7 +51,7 @@ class WorkflowRunApi(WebApiResource):
|
||||
500: "Internal Server Error",
|
||||
}
|
||||
)
|
||||
@web_ns.response(200, "Success", web_ns.models[GeneratedAppResponse.__name__])
|
||||
@web_ns.response(200, "Workflow run stream started")
|
||||
def post(self, app_model: App, end_user: EndUser):
|
||||
"""
|
||||
Run workflow
|
||||
@ -68,6 +68,7 @@ class WorkflowRunApi(WebApiResource):
|
||||
app_model=app_model, user=end_user, args=args, invoke_from=InvokeFrom.WEB_APP, streaming=True
|
||||
)
|
||||
|
||||
# response-contract:ignore compact_generate_response
|
||||
return helper.compact_generate_response(response)
|
||||
except ProviderTokenNotInitError as ex:
|
||||
raise ProviderNotInitializeError(ex.description)
|
||||
@ -121,4 +122,4 @@ class WorkflowTaskStopApi(WebApiResource):
|
||||
# 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")
|
||||
|
||||
@ -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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -392,15 +392,15 @@ Send a request to the chat application.
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | - `app_unavailable` : App unavailable or misconfigured. - `not_chat_app` : App mode does not match the API route. - `conversation_completed` : The conversation has ended. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. | |
|
||||
| 401 | Unauthorized - invalid API token | |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied | |
|
||||
| 404 | `not_found` : Conversation does not exist. | |
|
||||
| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. | |
|
||||
| 500 | `internal_server_error` : Internal server error. | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events. |
|
||||
| 400 | - `app_unavailable` : App unavailable or misconfigured. - `not_chat_app` : App mode does not match the API route. - `conversation_completed` : The conversation has ended. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. |
|
||||
| 401 | Unauthorized - invalid API token |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied |
|
||||
| 404 | `not_found` : Conversation does not exist. |
|
||||
| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. |
|
||||
| 500 | `internal_server_error` : Internal server error. |
|
||||
|
||||
### [POST] /chat-messages/{task_id}/stop
|
||||
**Stop Chat Message Generation**
|
||||
@ -539,15 +539,15 @@ Send a request to the chat application.
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | - `app_unavailable` : App unavailable or misconfigured. - `not_chat_app` : App mode does not match the API route. - `conversation_completed` : The conversation has ended. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. | |
|
||||
| 401 | Unauthorized - invalid API token | |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied | |
|
||||
| 404 | `not_found` : Conversation does not exist. | |
|
||||
| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. | |
|
||||
| 500 | `internal_server_error` : Internal server error. | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events. |
|
||||
| 400 | - `app_unavailable` : App unavailable or misconfigured. - `not_chat_app` : App mode does not match the API route. - `conversation_completed` : The conversation has ended. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. |
|
||||
| 401 | Unauthorized - invalid API token |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied |
|
||||
| 404 | `not_found` : Conversation does not exist. |
|
||||
| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. |
|
||||
| 500 | `internal_server_error` : Internal server error. |
|
||||
|
||||
### [POST] /chat-messages/{task_id}/stop
|
||||
**Stop Chat Message Generation**
|
||||
@ -615,15 +615,15 @@ Send a request to the text generation application.
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `CompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkCompletionEvent` objects. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | - `app_unavailable` : App unavailable or misconfigured. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. | |
|
||||
| 401 | Unauthorized - invalid API token | |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied | |
|
||||
| 404 | Conversation not found | |
|
||||
| 429 | `too_many_requests` : Too many concurrent requests for this app. | |
|
||||
| 500 | `internal_server_error` : Internal server error. | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `CompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkCompletionEvent` objects. |
|
||||
| 400 | - `app_unavailable` : App unavailable or misconfigured. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. |
|
||||
| 401 | Unauthorized - invalid API token |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied |
|
||||
| 404 | Conversation not found |
|
||||
| 429 | `too_many_requests` : Too many concurrent requests for this app. |
|
||||
| 500 | `internal_server_error` : Internal server error. |
|
||||
|
||||
### [POST] /completion-messages/{task_id}/stop
|
||||
**Stop Completion Message Generation**
|
||||
@ -1046,12 +1046,12 @@ Execute a single datasource node within the knowledge pipeline. Returns a stream
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Streaming response with node execution events. | **text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 401 | Unauthorized - invalid API token | |
|
||||
| 403 | Forbidden - dataset API access or workspace access denied | |
|
||||
| 404 | `not_found` : Dataset not found. | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Streaming response with node execution events. |
|
||||
| 401 | Unauthorized - invalid API token |
|
||||
| 403 | Forbidden - dataset API access or workspace access denied |
|
||||
| 404 | `not_found` : Dataset not found. |
|
||||
|
||||
### [POST] /datasets/{dataset_id}/pipeline/run
|
||||
**Run Pipeline**
|
||||
@ -1072,13 +1072,13 @@ Execute the full knowledge pipeline for a knowledge base. Supports both streamin
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Pipeline execution result. Format depends on `response_mode`: streaming returns a `text/event-stream`, blocking returns a JSON object. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 401 | Unauthorized - invalid API token | |
|
||||
| 403 | `forbidden` : Forbidden. | |
|
||||
| 404 | `not_found` : Dataset not found. | |
|
||||
| 500 | `pipeline_run_error` : Pipeline execution failed. | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Pipeline execution result. Format depends on `response_mode`: streaming returns a `text/event-stream`, blocking returns a JSON object. |
|
||||
| 401 | Unauthorized - invalid API token |
|
||||
| 403 | `forbidden` : Forbidden. |
|
||||
| 404 | `not_found` : Dataset not found. |
|
||||
| 500 | `pipeline_run_error` : Pipeline execution failed. |
|
||||
|
||||
---
|
||||
## default
|
||||
@ -2220,15 +2220,15 @@ Execute a workflow. Cannot be executed without a published workflow.
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | - `not_workflow_app` : App mode does not match the API route. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Workflow execution request failed. - `invalid_param` : Invalid parameter value. | |
|
||||
| 401 | Unauthorized - invalid API token | |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied | |
|
||||
| 404 | Workflow not found | |
|
||||
| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. | |
|
||||
| 500 | `internal_server_error` : Internal server error. | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects. |
|
||||
| 400 | - `not_workflow_app` : App mode does not match the API route. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Workflow execution request failed. - `invalid_param` : Invalid parameter value. |
|
||||
| 401 | Unauthorized - invalid API token |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied |
|
||||
| 404 | Workflow not found |
|
||||
| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. |
|
||||
| 500 | `internal_server_error` : Internal server error. |
|
||||
|
||||
### [GET] /workflows/run/{workflow_run_id}
|
||||
**Get Workflow Run Detail**
|
||||
@ -2297,15 +2297,15 @@ Execute a specific workflow version identified by its ID. Useful for running a p
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | - `not_workflow_app` : App mode does not match the API route. - `bad_request` : Workflow is a draft or has an invalid ID format. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Workflow execution request failed. - `invalid_param` : Required parameter missing or invalid. | |
|
||||
| 401 | Unauthorized - invalid API token | |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied | |
|
||||
| 404 | `not_found` : Workflow not found. | |
|
||||
| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. | |
|
||||
| 500 | `internal_server_error` : Internal server error. | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects. |
|
||||
| 400 | - `not_workflow_app` : App mode does not match the API route. - `bad_request` : Workflow is a draft or has an invalid ID format. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Workflow execution request failed. - `invalid_param` : Required parameter missing or invalid. |
|
||||
| 401 | Unauthorized - invalid API token |
|
||||
| 403 | Forbidden - token scope, app, dataset, or workspace access denied |
|
||||
| 404 | `not_found` : Workflow not found. |
|
||||
| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. |
|
||||
| 500 | `internal_server_error` : Internal server error. |
|
||||
|
||||
---
|
||||
## default
|
||||
@ -2960,7 +2960,7 @@ Enum class for custom configuration status.
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| credentials | [ [DatasourceCredentialInfoResponse](#datasourcecredentialinforesponse) ] | | Yes |
|
||||
| credentials | [ [DatasourceCredentialInfoResponse](#datasourcecredentialinforesponse) ] | | No |
|
||||
| datasource_type | string | | No |
|
||||
| node_id | string | | No |
|
||||
| plugin_id | string | | No |
|
||||
@ -3264,12 +3264,6 @@ Enum class for fetch from.
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| FormInputConfig | [ParagraphInputConfig](#paragraphinputconfig)<br>[SelectInputConfig](#selectinputconfig)<br>[FileInputConfig](#fileinputconfig)<br>[FileListInputConfig](#filelistinputconfig) | | |
|
||||
|
||||
#### GeneratedAppResponse
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| GeneratedAppResponse | | | |
|
||||
|
||||
#### HitTestingChildChunk
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -3454,7 +3448,7 @@ Model class for i18n object.
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| JSONValue | string<br>integer<br>number<br>boolean<br>object<br>[ object ] | | |
|
||||
| JSONValue | | | |
|
||||
|
||||
#### JSONValueType
|
||||
|
||||
@ -3937,7 +3931,7 @@ Model class for provider with models response.
|
||||
| output_variable_name | string | | Yes |
|
||||
| type | string | | No |
|
||||
|
||||
#### SimpleAccount
|
||||
#### SimpleAccountResponse
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
@ -4147,7 +4141,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 |
|
||||
|
||||
@ -40,14 +40,14 @@ Create a chat message for conversational applications.
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Success | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | Bad Request | |
|
||||
| 401 | Unauthorized | |
|
||||
| 403 | Forbidden | |
|
||||
| 404 | App Not Found | |
|
||||
| 500 | Internal Server Error | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Success |
|
||||
| 400 | Bad Request |
|
||||
| 401 | Unauthorized |
|
||||
| 403 | Forbidden |
|
||||
| 404 | App Not Found |
|
||||
| 500 | Internal Server Error |
|
||||
|
||||
### [POST] /chat-messages/{task_id}/stop
|
||||
Stop a running chat message task.
|
||||
@ -80,14 +80,14 @@ Create a completion message for text generation applications.
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Success | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | Bad Request | |
|
||||
| 401 | Unauthorized | |
|
||||
| 403 | Forbidden | |
|
||||
| 404 | App Not Found | |
|
||||
| 500 | Internal Server Error | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Success |
|
||||
| 400 | Bad Request |
|
||||
| 401 | Unauthorized |
|
||||
| 403 | Forbidden |
|
||||
| 404 | App Not Found |
|
||||
| 500 | Internal Server Error |
|
||||
|
||||
### [POST] /completion-messages/{task_id}/stop
|
||||
Stop a running completion message task.
|
||||
@ -526,14 +526,14 @@ Generate a new completion similar to an existing message (completion apps only).
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Success | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | Bad Request - Not a completion app or feature disabled | |
|
||||
| 401 | Unauthorized | |
|
||||
| 403 | Forbidden | |
|
||||
| 404 | Message Not Found | |
|
||||
| 500 | Internal Server Error | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Success |
|
||||
| 400 | Bad Request - Not a completion app or feature disabled |
|
||||
| 401 | Unauthorized |
|
||||
| 403 | Forbidden |
|
||||
| 404 | Message Not Found |
|
||||
| 500 | Internal Server Error |
|
||||
|
||||
### [GET] /messages/{message_id}/suggested-questions
|
||||
Get suggested follow-up questions after a message (chat apps only).
|
||||
@ -856,14 +856,14 @@ Execute a workflow with provided inputs and files.
|
||||
|
||||
#### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | Success | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br> |
|
||||
| 400 | Bad Request | |
|
||||
| 401 | Unauthorized | |
|
||||
| 403 | Forbidden | |
|
||||
| 404 | App Not Found | |
|
||||
| 500 | Internal Server Error | |
|
||||
| Code | Description |
|
||||
| ---- | ----------- |
|
||||
| 200 | Success |
|
||||
| 400 | Bad Request |
|
||||
| 401 | Unauthorized |
|
||||
| 403 | Forbidden |
|
||||
| 404 | App Not Found |
|
||||
| 500 | Internal Server Error |
|
||||
|
||||
### [POST] /workflows/tasks/{task_id}/stop
|
||||
**Stop workflow task**
|
||||
@ -1216,12 +1216,6 @@ Button styles for user actions.
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| FormInputConfig | [ParagraphInputConfig](#paragraphinputconfig)<br>[SelectInputConfig](#selectinputconfig)<br>[FileInputConfig](#fileinputconfig)<br>[FileListInputConfig](#filelistinputconfig) | | |
|
||||
|
||||
#### GeneratedAppResponse
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| GeneratedAppResponse | | | |
|
||||
|
||||
#### HumanInputContent
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -1306,7 +1300,7 @@ Parsed multipart form fields for HITL uploads.
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| JSONValue | string<br>integer<br>number<br>boolean<br>object<br>[ object ] | | |
|
||||
| JSONValue | | | |
|
||||
|
||||
#### JSONValueType
|
||||
|
||||
|
||||
@ -607,7 +607,11 @@ class TestMiscApis:
|
||||
method = unwrap(api.get)
|
||||
|
||||
service = MagicMock()
|
||||
service.get_recommended_plugins.return_value = [{"id": "p1"}]
|
||||
recommended_plugins = {
|
||||
"installed_recommended_plugins": [{"id": "p1"}],
|
||||
"uninstalled_recommended_plugins": [{"id": "p2"}],
|
||||
}
|
||||
service.get_recommended_plugins.return_value = recommended_plugins
|
||||
user = make_account()
|
||||
tenant_id = "tenant-1"
|
||||
|
||||
@ -619,7 +623,7 @@ class TestMiscApis:
|
||||
),
|
||||
):
|
||||
result = method(api, tenant_id, user)
|
||||
assert result == [{"id": "p1"}]
|
||||
assert result == recommended_plugins
|
||||
service.get_recommended_plugins.assert_called_once_with("all", user, tenant_id)
|
||||
|
||||
|
||||
@ -826,7 +830,7 @@ class TestRagPipelineByIdApi:
|
||||
result = method(api, pipeline, "old-workflow")
|
||||
|
||||
workflow_service.delete_workflow.assert_called_once()
|
||||
assert result == (None, 204)
|
||||
assert result == ("", 204)
|
||||
|
||||
def test_delete_active_workflow_rejected(self, app: Flask) -> None:
|
||||
api = RagPipelineByIdApi()
|
||||
|
||||
@ -77,9 +77,11 @@ def test_human_input_preview_delegates_to_service(
|
||||
|
||||
preview_payload = {
|
||||
"form_id": "node-42",
|
||||
"node_id": "node-42",
|
||||
"node_title": "Human Input",
|
||||
"form_content": "<div>example</div>",
|
||||
"inputs": [{"name": "topic"}],
|
||||
"actions": [{"id": "continue"}],
|
||||
"actions": [{"id": "continue", "title": "Continue"}],
|
||||
}
|
||||
service_instance = MagicMock()
|
||||
service_instance.get_human_input_form_preview.return_value = preview_payload
|
||||
@ -88,7 +90,15 @@ def test_human_input_preview_delegates_to_service(
|
||||
with app.test_request_context(case.path, method="POST", json={"inputs": {"topic": "tech"}}):
|
||||
response = case.resource_cls().post(app_id=app_model.id, node_id="node-42")
|
||||
|
||||
assert response == preview_payload
|
||||
assert response == {
|
||||
**preview_payload,
|
||||
"TYPE": "human_input_required",
|
||||
"actions": [{"id": "continue", "title": "Continue", "button_style": "default"}],
|
||||
"resolved_default_values": {},
|
||||
"display_in_ui": False,
|
||||
"form_token": None,
|
||||
"expiration_time": None,
|
||||
}
|
||||
service_instance.get_human_input_form_preview.assert_called_once_with(
|
||||
app_model=app_model,
|
||||
account=account,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from inspect import unwrap as inspect_unwrap
|
||||
from inspect import unwrap
|
||||
from io import BytesIO
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock, patch
|
||||
@ -35,24 +35,16 @@ from models.model import AppMode
|
||||
from services.errors.conversation import ConversationNotExistsError
|
||||
from services.errors.llm import InvokeRateLimitError
|
||||
|
||||
unwrap: Any = inspect_unwrap
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def account() -> Account:
|
||||
acc = Account(name="User", email="user@example.com")
|
||||
def account():
|
||||
acc = MagicMock(spec=Account)
|
||||
acc.id = "u1"
|
||||
return acc
|
||||
|
||||
|
||||
def _file_data() -> Any:
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
return file_data
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def trial_app_chat() -> MagicMock:
|
||||
def trial_app_chat():
|
||||
app = MagicMock()
|
||||
app.id = "a-chat"
|
||||
app.mode = AppMode.CHAT
|
||||
@ -60,7 +52,7 @@ def trial_app_chat() -> MagicMock:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def trial_app_completion() -> MagicMock:
|
||||
def trial_app_completion():
|
||||
app = MagicMock()
|
||||
app.id = "a-comp"
|
||||
app.mode = AppMode.COMPLETION
|
||||
@ -68,7 +60,7 @@ def trial_app_completion() -> MagicMock:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def trial_app_workflow() -> MagicMock:
|
||||
def trial_app_workflow():
|
||||
app = MagicMock()
|
||||
app.id = "a-workflow"
|
||||
app.mode = AppMode.WORKFLOW
|
||||
@ -76,7 +68,7 @@ def trial_app_workflow() -> MagicMock:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def valid_parameters() -> dict[str, object]:
|
||||
def valid_parameters():
|
||||
return {
|
||||
"user_input_form": [],
|
||||
"system_parameters": {},
|
||||
@ -92,13 +84,54 @@ 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")
|
||||
def test_trial_workflow_registers_normalized_simple_account_response_model():
|
||||
assert "SimpleAccountResponse" in module.console_ns.models
|
||||
|
||||
|
||||
def _response_model_name(entry: object) -> str:
|
||||
assert isinstance(entry, tuple)
|
||||
assert len(entry) >= 2
|
||||
model = entry[1]
|
||||
name = getattr(model, "name", None)
|
||||
assert isinstance(name, str)
|
||||
return name
|
||||
|
||||
|
||||
def test_trial_endpoints_keep_response_and_query_docs():
|
||||
untyped_generated_response_views = [
|
||||
module.TrialAppWorkflowRunApi.post,
|
||||
module.TrialChatApi.post,
|
||||
module.TrialCompletionApi.post,
|
||||
]
|
||||
for view in untyped_generated_response_views:
|
||||
apidoc = getattr(view, "__apidoc__", {})
|
||||
assert apidoc.get("responses", {})["200"] == ("Success", None, {})
|
||||
|
||||
cases = [
|
||||
(module.TrialMessageSuggestedQuestionApi.get, module.SuggestedQuestionsResponse.__name__),
|
||||
(module.TrialChatAudioApi.post, module.AudioTranscriptResponse.__name__),
|
||||
(module.TrialChatTextApi.post, module.AudioBinaryResponse.__name__),
|
||||
(module.TrialSitApi.get, module.SiteResponse.__name__),
|
||||
(module.TrialAppParameterApi.get, module.ParametersResponse.__name__),
|
||||
(module.AppApi.get, module.AppDetailWithSite.__name__),
|
||||
(module.AppWorkflowApi.get, module.WorkflowResponse.__name__),
|
||||
(module.DatasetListApi.get, module.TrialDatasetListResponse.__name__),
|
||||
]
|
||||
|
||||
for view, model_name in cases:
|
||||
apidoc = getattr(view, "__apidoc__", {})
|
||||
responses = apidoc.get("responses", {})
|
||||
assert _response_model_name(responses["200"]) == model_name
|
||||
|
||||
dataset_params = module.DatasetListApi.get.__apidoc__["params"]
|
||||
assert dataset_params["ids"]["in"] == "query"
|
||||
assert dataset_params["ids"]["type"] == "array"
|
||||
assert dataset_params["page"]["default"] == 1
|
||||
assert dataset_params["limit"]["default"] == 20
|
||||
|
||||
|
||||
class TestTrialAppWorkflowRunApi:
|
||||
def test_not_workflow_app(self, app: Flask, account: Account) -> None:
|
||||
def test_not_workflow_app(self, app: Flask, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -106,7 +139,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
with pytest.raises(NotWorkflowAppError):
|
||||
method(api, account, MagicMock(mode=AppMode.CHAT))
|
||||
|
||||
def test_success(self, app: Flask, trial_app_workflow: MagicMock, account: Account) -> None:
|
||||
def test_success(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -119,7 +152,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
|
||||
assert result is not None
|
||||
|
||||
def test_workflow_provider_not_init(self, app: Flask, trial_app_workflow: MagicMock, account: Account) -> None:
|
||||
def test_workflow_provider_not_init(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -134,7 +167,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
with pytest.raises(ProviderNotInitializeError):
|
||||
method(api, account, trial_app_workflow)
|
||||
|
||||
def test_workflow_quota_exceeded(self, app: Flask, trial_app_workflow: MagicMock, account: Account) -> None:
|
||||
def test_workflow_quota_exceeded(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -149,7 +182,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
with pytest.raises(ProviderQuotaExceededError):
|
||||
method(api, account, trial_app_workflow)
|
||||
|
||||
def test_workflow_model_not_support(self, app: Flask, trial_app_workflow: MagicMock, account: Account) -> None:
|
||||
def test_workflow_model_not_support(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -164,7 +197,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
with pytest.raises(ProviderModelCurrentlyNotSupportError):
|
||||
method(api, account, trial_app_workflow)
|
||||
|
||||
def test_workflow_invoke_error(self, app: Flask, trial_app_workflow: MagicMock, account: Account) -> None:
|
||||
def test_workflow_invoke_error(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -179,7 +212,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
with pytest.raises(CompletionRequestError):
|
||||
method(api, account, trial_app_workflow)
|
||||
|
||||
def test_workflow_rate_limit_error(self, app: Flask, trial_app_workflow: MagicMock, account: Account) -> None:
|
||||
def test_workflow_rate_limit_error(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -194,7 +227,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
with pytest.raises(InvokeRateLimitHttpError):
|
||||
method(api, account, trial_app_workflow)
|
||||
|
||||
def test_workflow_value_error(self, app: Flask, trial_app_workflow: MagicMock, account: Account) -> None:
|
||||
def test_workflow_value_error(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -209,7 +242,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
with pytest.raises(ValueError):
|
||||
method(api, account, trial_app_workflow)
|
||||
|
||||
def test_workflow_generic_exception(self, app: Flask, trial_app_workflow: MagicMock, account: Account) -> None:
|
||||
def test_workflow_generic_exception(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowRunApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -226,7 +259,7 @@ class TestTrialAppWorkflowRunApi:
|
||||
|
||||
|
||||
class TestTrialChatApi:
|
||||
def test_not_chat_app(self, app: Flask, account: Account) -> None:
|
||||
def test_not_chat_app(self, app: Flask, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -234,7 +267,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(NotChatAppError):
|
||||
method(api, account, MagicMock(mode="completion"))
|
||||
|
||||
def test_success(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_success(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -247,7 +280,7 @@ class TestTrialChatApi:
|
||||
|
||||
assert result is not None
|
||||
|
||||
def test_chat_conversation_not_exists(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_conversation_not_exists(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -262,7 +295,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(NotFound):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_conversation_completed(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_conversation_completed(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -277,7 +310,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(ConversationCompletedError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_app_config_broken(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_app_config_broken(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -292,7 +325,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(AppUnavailableError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_provider_not_init(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_provider_not_init(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -307,7 +340,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(ProviderNotInitializeError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_quota_exceeded(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_quota_exceeded(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -322,7 +355,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(ProviderQuotaExceededError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_model_not_support(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_model_not_support(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -337,7 +370,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(ProviderModelCurrentlyNotSupportError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_invoke_error(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_invoke_error(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -352,7 +385,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(CompletionRequestError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_rate_limit_error(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_rate_limit_error(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -367,7 +400,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(InvokeRateLimitHttpError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_value_error(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_value_error(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -382,7 +415,7 @@ class TestTrialChatApi:
|
||||
with pytest.raises(ValueError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_chat_generic_exception(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_chat_generic_exception(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -399,7 +432,7 @@ class TestTrialChatApi:
|
||||
|
||||
|
||||
class TestTrialCompletionApi:
|
||||
def test_not_completion_app(self, app: Flask, account: Account) -> None:
|
||||
def test_not_completion_app(self, app: Flask, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -407,7 +440,7 @@ class TestTrialCompletionApi:
|
||||
with pytest.raises(NotCompletionAppError):
|
||||
method(api, account, MagicMock(mode=AppMode.CHAT))
|
||||
|
||||
def test_success(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_success(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -420,7 +453,7 @@ class TestTrialCompletionApi:
|
||||
|
||||
assert result is not None
|
||||
|
||||
def test_completion_app_config_broken(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_completion_app_config_broken(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -435,7 +468,7 @@ class TestTrialCompletionApi:
|
||||
with pytest.raises(AppUnavailableError):
|
||||
method(api, account, trial_app_completion)
|
||||
|
||||
def test_completion_provider_not_init(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_completion_provider_not_init(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -450,7 +483,7 @@ class TestTrialCompletionApi:
|
||||
with pytest.raises(ProviderNotInitializeError):
|
||||
method(api, account, trial_app_completion)
|
||||
|
||||
def test_completion_quota_exceeded(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_completion_quota_exceeded(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -465,7 +498,7 @@ class TestTrialCompletionApi:
|
||||
with pytest.raises(ProviderQuotaExceededError):
|
||||
method(api, account, trial_app_completion)
|
||||
|
||||
def test_completion_model_not_support(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_completion_model_not_support(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -480,7 +513,7 @@ class TestTrialCompletionApi:
|
||||
with pytest.raises(ProviderModelCurrentlyNotSupportError):
|
||||
method(api, account, trial_app_completion)
|
||||
|
||||
def test_completion_invoke_error(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_completion_invoke_error(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -495,7 +528,7 @@ class TestTrialCompletionApi:
|
||||
with pytest.raises(CompletionRequestError):
|
||||
method(api, account, trial_app_completion)
|
||||
|
||||
def test_completion_rate_limit_error(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_completion_rate_limit_error(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -510,7 +543,7 @@ class TestTrialCompletionApi:
|
||||
with pytest.raises(InternalServerError):
|
||||
method(api, account, trial_app_completion)
|
||||
|
||||
def test_completion_value_error(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_completion_value_error(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -525,7 +558,7 @@ class TestTrialCompletionApi:
|
||||
with pytest.raises(ValueError):
|
||||
method(api, account, trial_app_completion)
|
||||
|
||||
def test_completion_generic_exception(self, app: Flask, trial_app_completion: MagicMock, account: Account) -> None:
|
||||
def test_completion_generic_exception(self, app: Flask, trial_app_completion, account):
|
||||
api = module.TrialCompletionApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -542,7 +575,7 @@ class TestTrialCompletionApi:
|
||||
|
||||
|
||||
class TestTrialMessageSuggestedQuestionApi:
|
||||
def test_not_chat_app(self, app: Flask, account: Account) -> None:
|
||||
def test_not_chat_app(self, app: Flask, account):
|
||||
api = module.TrialMessageSuggestedQuestionApi()
|
||||
method = unwrap(api.get)
|
||||
|
||||
@ -550,7 +583,7 @@ class TestTrialMessageSuggestedQuestionApi:
|
||||
with pytest.raises(NotChatAppError):
|
||||
method(api, account, MagicMock(mode="completion"), str(uuid4()))
|
||||
|
||||
def test_success(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_success(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialMessageSuggestedQuestionApi()
|
||||
method = unwrap(api.get)
|
||||
|
||||
@ -566,7 +599,7 @@ class TestTrialMessageSuggestedQuestionApi:
|
||||
|
||||
assert result == {"data": ["q1", "q2"]}
|
||||
|
||||
def test_conversation_not_exists(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_conversation_not_exists(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialMessageSuggestedQuestionApi()
|
||||
method = unwrap(api.get)
|
||||
|
||||
@ -583,14 +616,14 @@ class TestTrialMessageSuggestedQuestionApi:
|
||||
|
||||
|
||||
class TestTrialAppParameterApi:
|
||||
def test_app_unavailable(self) -> None:
|
||||
def test_app_unavailable(self):
|
||||
api = module.TrialAppParameterApi()
|
||||
method = unwrap(api.get)
|
||||
|
||||
with pytest.raises(AppUnavailableError):
|
||||
method(api, None)
|
||||
|
||||
def test_success_non_workflow(self, valid_parameters: dict[str, object]) -> None:
|
||||
def test_success_non_workflow(self, valid_parameters):
|
||||
api = module.TrialAppParameterApi()
|
||||
method = unwrap(api.get)
|
||||
|
||||
@ -617,11 +650,12 @@ class TestTrialAppParameterApi:
|
||||
|
||||
|
||||
class TestTrialChatAudioApi:
|
||||
def test_success(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_success(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -634,11 +668,12 @@ class TestTrialChatAudioApi:
|
||||
|
||||
assert result == {"text": "hello"}
|
||||
|
||||
def test_app_config_broken(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_app_config_broken(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -653,11 +688,12 @@ class TestTrialChatAudioApi:
|
||||
with pytest.raises(module.AppUnavailableError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_no_audio_uploaded(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_no_audio_uploaded(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -672,11 +708,12 @@ class TestTrialChatAudioApi:
|
||||
with pytest.raises(module.NoAudioUploadedError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_audio_too_large(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_audio_too_large(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -691,11 +728,12 @@ class TestTrialChatAudioApi:
|
||||
with pytest.raises(module.AudioTooLargeError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_unsupported_audio_type(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_unsupported_audio_type(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -710,11 +748,12 @@ class TestTrialChatAudioApi:
|
||||
with pytest.raises(module.UnsupportedAudioTypeError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_provider_not_support_tts(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_provider_not_support_tts(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -729,11 +768,12 @@ class TestTrialChatAudioApi:
|
||||
with pytest.raises(module.ProviderNotSupportSpeechToTextError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_provider_not_init(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_provider_not_init(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -744,11 +784,12 @@ class TestTrialChatAudioApi:
|
||||
with pytest.raises(ProviderNotInitializeError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_quota_exceeded(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_quota_exceeded(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -761,7 +802,7 @@ class TestTrialChatAudioApi:
|
||||
|
||||
|
||||
class TestTrialChatTextApi:
|
||||
def test_success(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_success(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -774,7 +815,7 @@ class TestTrialChatTextApi:
|
||||
|
||||
assert result == {"audio": "base64_data"}
|
||||
|
||||
def test_app_config_broken(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_app_config_broken(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -789,7 +830,7 @@ class TestTrialChatTextApi:
|
||||
with pytest.raises(module.AppUnavailableError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_provider_not_support(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_provider_not_support(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -804,7 +845,7 @@ class TestTrialChatTextApi:
|
||||
with pytest.raises(module.ProviderNotSupportSpeechToTextError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_audio_too_large(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_audio_too_large(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -819,7 +860,7 @@ class TestTrialChatTextApi:
|
||||
with pytest.raises(module.AudioTooLargeError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_no_audio_uploaded(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_no_audio_uploaded(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -834,7 +875,7 @@ class TestTrialChatTextApi:
|
||||
with pytest.raises(module.NoAudioUploadedError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_provider_not_init(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_provider_not_init(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -845,7 +886,7 @@ class TestTrialChatTextApi:
|
||||
with pytest.raises(ProviderNotInitializeError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_quota_exceeded(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_quota_exceeded(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -856,7 +897,7 @@ class TestTrialChatTextApi:
|
||||
with pytest.raises(ProviderQuotaExceededError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_model_not_support(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_model_not_support(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -867,7 +908,7 @@ class TestTrialChatTextApi:
|
||||
with pytest.raises(ProviderModelCurrentlyNotSupportError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_invoke_error(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_invoke_error(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -880,7 +921,7 @@ class TestTrialChatTextApi:
|
||||
|
||||
|
||||
class TestTrialAppWorkflowTaskStopApi:
|
||||
def test_not_workflow_app(self, app: Flask, trial_app_chat: MagicMock) -> None:
|
||||
def test_not_workflow_app(self, app: Flask, trial_app_chat):
|
||||
api = module.TrialAppWorkflowTaskStopApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -888,7 +929,7 @@ class TestTrialAppWorkflowTaskStopApi:
|
||||
with pytest.raises(NotWorkflowAppError):
|
||||
method(api, trial_app_chat, str(uuid4()))
|
||||
|
||||
def test_success(self, app: Flask, trial_app_workflow: MagicMock) -> None:
|
||||
def test_success(self, app: Flask, trial_app_workflow, account):
|
||||
api = module.TrialAppWorkflowTaskStopApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -906,7 +947,7 @@ class TestTrialAppWorkflowTaskStopApi:
|
||||
|
||||
|
||||
class TestTrialSitApi:
|
||||
def test_no_site(self, app: Flask) -> None:
|
||||
def test_no_site(self, app: Flask):
|
||||
api = module.TrialSitApi()
|
||||
method = unwrap(api.get)
|
||||
app_model = MagicMock()
|
||||
@ -917,7 +958,7 @@ class TestTrialSitApi:
|
||||
with pytest.raises(Forbidden):
|
||||
method(api, app_model)
|
||||
|
||||
def test_archived_tenant(self, app: Flask) -> None:
|
||||
def test_archived_tenant(self, app: Flask):
|
||||
api = module.TrialSitApi()
|
||||
method = unwrap(api.get)
|
||||
|
||||
@ -932,7 +973,7 @@ class TestTrialSitApi:
|
||||
with pytest.raises(Forbidden):
|
||||
method(api, app_model)
|
||||
|
||||
def test_success(self, app: Flask) -> None:
|
||||
def test_success(self, app: Flask):
|
||||
api = module.TrialSitApi()
|
||||
method = unwrap(api.get)
|
||||
|
||||
@ -957,11 +998,12 @@ class TestTrialSitApi:
|
||||
|
||||
|
||||
class TestTrialChatAudioApiExceptionHandlers:
|
||||
def test_provider_not_init(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_provider_not_init(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -976,11 +1018,12 @@ class TestTrialChatAudioApiExceptionHandlers:
|
||||
with pytest.raises(ProviderNotInitializeError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_quota_exceeded(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_quota_exceeded(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -995,11 +1038,12 @@ class TestTrialChatAudioApiExceptionHandlers:
|
||||
with pytest.raises(ProviderQuotaExceededError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_invoke_error(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_invoke_error(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatAudioApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
file_data = _file_data()
|
||||
file_data: Any = BytesIO(b"fake audio data")
|
||||
file_data.filename = "test.wav"
|
||||
|
||||
with (
|
||||
app.test_request_context(
|
||||
@ -1016,7 +1060,7 @@ class TestTrialChatAudioApiExceptionHandlers:
|
||||
|
||||
|
||||
class TestTrialChatTextApiExceptionHandlers:
|
||||
def test_app_config_broken(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_app_config_broken(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
@ -1031,7 +1075,7 @@ class TestTrialChatTextApiExceptionHandlers:
|
||||
with pytest.raises(module.AppUnavailableError):
|
||||
method(api, account, trial_app_chat)
|
||||
|
||||
def test_unsupported_audio_type(self, app: Flask, trial_app_chat: MagicMock, account: Account) -> None:
|
||||
def test_unsupported_audio_type(self, app: Flask, trial_app_chat, account):
|
||||
api = module.TrialChatTextApi()
|
||||
method = unwrap(api.post)
|
||||
|
||||
|
||||
@ -1,25 +1,36 @@
|
||||
from types import SimpleNamespace
|
||||
|
||||
from controllers.service_api.app.workflow import WorkflowRunOutputsField, WorkflowRunStatusField
|
||||
from controllers.service_api.app.workflow import WorkflowRunResponse
|
||||
from graphon.enums import WorkflowExecutionStatus
|
||||
from libs.helper import dump_response
|
||||
from models.workflow import WorkflowRun
|
||||
|
||||
|
||||
def test_workflow_run_status_field_with_enum() -> None:
|
||||
field = WorkflowRunStatusField()
|
||||
obj = SimpleNamespace(status=WorkflowExecutionStatus.PAUSED)
|
||||
|
||||
assert field.output("status", obj) == "paused"
|
||||
def _workflow_run(status: WorkflowExecutionStatus, outputs: str | None = '{"foo": "bar"}') -> WorkflowRun:
|
||||
return WorkflowRun(
|
||||
id="run-id",
|
||||
workflow_id="workflow-id",
|
||||
status=status,
|
||||
inputs="{}",
|
||||
outputs=outputs,
|
||||
error=None,
|
||||
total_steps=1,
|
||||
total_tokens=2,
|
||||
elapsed_time=3.5,
|
||||
)
|
||||
|
||||
|
||||
def test_workflow_run_outputs_field_paused_returns_empty() -> None:
|
||||
field = WorkflowRunOutputsField()
|
||||
obj = SimpleNamespace(status=WorkflowExecutionStatus.PAUSED, outputs_dict={"foo": "bar"})
|
||||
def test_workflow_run_serializer_normalizes_status_enum() -> None:
|
||||
response = dump_response(WorkflowRunResponse, _workflow_run(WorkflowExecutionStatus.PAUSED))
|
||||
|
||||
assert field.output("outputs", obj) == {}
|
||||
assert response["status"] == "paused"
|
||||
|
||||
|
||||
def test_workflow_run_outputs_field_running_returns_outputs() -> None:
|
||||
field = WorkflowRunOutputsField()
|
||||
obj = SimpleNamespace(status=WorkflowExecutionStatus.RUNNING, outputs_dict={"foo": "bar"})
|
||||
def test_workflow_run_serializer_paused_returns_empty_outputs() -> None:
|
||||
response = dump_response(WorkflowRunResponse, _workflow_run(WorkflowExecutionStatus.PAUSED))
|
||||
|
||||
assert field.output("outputs", obj) == {"foo": "bar"}
|
||||
assert response["outputs"] == {}
|
||||
|
||||
|
||||
def test_workflow_run_serializer_running_returns_outputs() -> None:
|
||||
response = dump_response(WorkflowRunResponse, _workflow_run(WorkflowExecutionStatus.RUNNING))
|
||||
|
||||
assert response["outputs"] == {"foo": "bar"}
|
||||
|
||||
@ -325,10 +325,12 @@ class TestPipelineRunApiEntity:
|
||||
def test_entity_missing_required_field(self):
|
||||
"""Test entity raises on missing required field."""
|
||||
with pytest.raises(ValueError):
|
||||
PipelineRunApiEntity(
|
||||
inputs={},
|
||||
datasource_type="online_document",
|
||||
# missing datasource_info_list, start_node_id, etc.
|
||||
PipelineRunApiEntity.model_validate(
|
||||
{
|
||||
"inputs": {},
|
||||
"datasource_type": "online_document",
|
||||
# missing datasource_info_list, start_node_id, etc.
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -382,8 +384,19 @@ class TestDatasourcePluginsApiGet:
|
||||
mock_dataset = Mock()
|
||||
mock_db.session.scalar.return_value = mock_dataset
|
||||
|
||||
datasource_plugins = [
|
||||
{
|
||||
"node_id": "node-datasource-1",
|
||||
"plugin_id": "plugin-a",
|
||||
"provider_name": "provider-a",
|
||||
"datasource_type": "online_document",
|
||||
"title": "Online Docs",
|
||||
"user_input_variables": [{"variable": "url", "label": "URL", "type": "text-input", "required": True}],
|
||||
"credentials": [{"id": "cred-1", "name": "Default credential", "type": "oauth2", "is_default": True}],
|
||||
}
|
||||
]
|
||||
mock_svc_instance = Mock()
|
||||
mock_svc_instance.get_datasource_plugins.return_value = [{"name": "plugin_a"}]
|
||||
mock_svc_instance.get_datasource_plugins.return_value = datasource_plugins
|
||||
mock_svc_cls.return_value = mock_svc_instance
|
||||
|
||||
with app.test_request_context("/datasets/test/pipeline/datasource-plugins?is_published=true"):
|
||||
@ -391,11 +404,33 @@ class TestDatasourcePluginsApiGet:
|
||||
response, status = api.get(tenant_id=tenant_id, dataset_id=dataset_id)
|
||||
|
||||
assert status == 200
|
||||
assert response == [{"name": "plugin_a"}]
|
||||
assert response == datasource_plugins
|
||||
mock_svc_instance.get_datasource_plugins.assert_called_once_with(
|
||||
tenant_id=tenant_id, dataset_id=dataset_id, is_published=True
|
||||
)
|
||||
|
||||
@patch("controllers.service_api.dataset.rag_pipeline.rag_pipeline_workflow.db")
|
||||
@patch("controllers.service_api.dataset.rag_pipeline.rag_pipeline_workflow.RagPipelineService")
|
||||
def test_get_plugins_parses_false_is_published_query(self, mock_svc_cls, mock_db, app: Flask):
|
||||
"""Test false query string is parsed as boolean False."""
|
||||
tenant_id = str(uuid.uuid4())
|
||||
dataset_id = str(uuid.uuid4())
|
||||
|
||||
mock_db.session.scalar.return_value = Mock()
|
||||
mock_svc_instance = Mock()
|
||||
mock_svc_instance.get_datasource_plugins.return_value = []
|
||||
mock_svc_cls.return_value = mock_svc_instance
|
||||
|
||||
with app.test_request_context("/datasets/test/pipeline/datasource-plugins?is_published=false"):
|
||||
api = DatasourcePluginsApi()
|
||||
response, status = api.get(tenant_id=tenant_id, dataset_id=dataset_id)
|
||||
|
||||
assert status == 200
|
||||
assert response == []
|
||||
mock_svc_instance.get_datasource_plugins.assert_called_once_with(
|
||||
tenant_id=tenant_id, dataset_id=dataset_id, is_published=False
|
||||
)
|
||||
|
||||
@patch("controllers.service_api.dataset.rag_pipeline.rag_pipeline_workflow.db")
|
||||
def test_get_plugins_not_found(self, mock_db, app: Flask):
|
||||
"""Test NotFound when dataset check fails."""
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -269,6 +269,7 @@ export type MessageDetailResponse = {
|
||||
agent_thoughts?: Array<AgentThought>
|
||||
annotation?: ConversationAnnotation | null
|
||||
annotation_hit_history?: ConversationAnnotationHitHistory | null
|
||||
answer: string
|
||||
answer_tokens?: number | null
|
||||
conversation_id: string
|
||||
created_at?: number | null
|
||||
@ -284,12 +285,11 @@ export type MessageDetailResponse = {
|
||||
}
|
||||
message?: JsonValue | null
|
||||
message_files?: Array<MessageFile>
|
||||
message_metadata_dict?: JsonValue | null
|
||||
message_tokens?: number | null
|
||||
metadata?: JsonValue | null
|
||||
parent_message_id?: string | null
|
||||
provider_response_latency?: number | null
|
||||
query: string
|
||||
re_sign_file_url_answer: string
|
||||
status: string
|
||||
workflow_run_id?: string | null
|
||||
}
|
||||
@ -405,12 +405,30 @@ export type DeletedTool = {
|
||||
}
|
||||
|
||||
export type ModelConfig = {
|
||||
completion_params?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
mode: LlmMode
|
||||
name: string
|
||||
provider: string
|
||||
agent_mode?: JsonValue | null
|
||||
annotation_reply?: JsonValue | null
|
||||
chat_prompt_config?: JsonValue | null
|
||||
completion_prompt_config?: JsonValue | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
dataset_configs?: JsonValue | null
|
||||
dataset_query_variable?: string | null
|
||||
external_data_tools?: JsonValue | null
|
||||
file_upload?: JsonValue | null
|
||||
model?: JsonValue | null
|
||||
more_like_this?: JsonValue | null
|
||||
opening_statement?: string | null
|
||||
pre_prompt?: string | null
|
||||
prompt_type?: string | null
|
||||
retriever_resource?: JsonValue | null
|
||||
sensitive_word_avoidance?: JsonValue | null
|
||||
speech_to_text?: JsonValue | null
|
||||
suggested_questions?: JsonValue | null
|
||||
suggested_questions_after_answer?: JsonValue | null
|
||||
text_to_speech?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
user_input_form?: JsonValue | null
|
||||
}
|
||||
|
||||
export type Site = {
|
||||
@ -436,16 +454,7 @@ export type Tag = {
|
||||
type: string
|
||||
}
|
||||
|
||||
export type JsonValue
|
||||
= | string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type WorkflowPartial = {
|
||||
created_at?: number | null
|
||||
@ -723,7 +732,6 @@ export type AgentThought = {
|
||||
created_at?: number | null
|
||||
files: Array<string>
|
||||
id: string
|
||||
message_chain_id?: string | null
|
||||
message_id: string
|
||||
observation?: string | null
|
||||
position: number
|
||||
@ -743,8 +751,8 @@ export type ConversationAnnotation = {
|
||||
|
||||
export type ConversationAnnotationHitHistory = {
|
||||
annotation_create_account?: SimpleAccount | null
|
||||
annotation_id: string
|
||||
created_at?: number | null
|
||||
id: string
|
||||
}
|
||||
|
||||
export type HumanInputContent = {
|
||||
@ -879,8 +887,6 @@ export type AgentAppPublishedReferenceResponse = {
|
||||
app_name: string
|
||||
}
|
||||
|
||||
export type LlmMode = 'chat' | 'completion'
|
||||
|
||||
export type AgentKind = 'dify_agent'
|
||||
|
||||
export type AgentPublishedReferenceResponse = {
|
||||
|
||||
@ -218,16 +218,37 @@ export const zTag = z.object({
|
||||
type: z.string(),
|
||||
})
|
||||
|
||||
export const zJsonValue = z
|
||||
.union([
|
||||
z.string(),
|
||||
z.int(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.record(z.string(), z.unknown()),
|
||||
z.array(z.unknown()),
|
||||
])
|
||||
.nullable()
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* ModelConfig
|
||||
*/
|
||||
export const zModelConfig = z.object({
|
||||
agent_mode: zJsonValue.nullish(),
|
||||
annotation_reply: zJsonValue.nullish(),
|
||||
chat_prompt_config: zJsonValue.nullish(),
|
||||
completion_prompt_config: zJsonValue.nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
dataset_configs: zJsonValue.nullish(),
|
||||
dataset_query_variable: z.string().nullish(),
|
||||
external_data_tools: zJsonValue.nullish(),
|
||||
file_upload: zJsonValue.nullish(),
|
||||
model: zJsonValue.nullish(),
|
||||
more_like_this: zJsonValue.nullish(),
|
||||
opening_statement: z.string().nullish(),
|
||||
pre_prompt: z.string().nullish(),
|
||||
prompt_type: z.string().nullish(),
|
||||
retriever_resource: zJsonValue.nullish(),
|
||||
sensitive_word_avoidance: zJsonValue.nullish(),
|
||||
speech_to_text: zJsonValue.nullish(),
|
||||
suggested_questions: zJsonValue.nullish(),
|
||||
suggested_questions_after_answer: zJsonValue.nullish(),
|
||||
text_to_speech: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
user_input_form: zJsonValue.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* WorkflowPartial
|
||||
@ -240,6 +261,43 @@ export const zWorkflowPartial = z.object({
|
||||
updated_by: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* AgentAppDetailWithSite
|
||||
*/
|
||||
export const zAgentAppDetailWithSite = z.object({
|
||||
access_mode: z.string().nullish(),
|
||||
active_config_is_published: z.boolean().optional().default(false),
|
||||
api_base_url: z.string().nullish(),
|
||||
app_id: z.string().nullish(),
|
||||
bound_agent_id: z.string().nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
debug_conversation_id: z.string().nullish(),
|
||||
deleted_tools: z.array(zDeletedTool).optional(),
|
||||
description: z.string().nullish(),
|
||||
enable_api: z.boolean(),
|
||||
enable_site: z.boolean(),
|
||||
icon: z.string().nullish(),
|
||||
icon_background: z.string().nullish(),
|
||||
icon_type: z.string().nullish(),
|
||||
icon_url: z.string().nullable(),
|
||||
id: z.string(),
|
||||
maintainer: z.string().nullish(),
|
||||
max_active_requests: z.int().nullish(),
|
||||
mode: z.string(),
|
||||
model_config: zModelConfig.nullish(),
|
||||
name: z.string(),
|
||||
permission_keys: z.array(z.string()).optional(),
|
||||
role: z.string().nullish(),
|
||||
site: zSite.nullish(),
|
||||
tags: z.array(zTag).optional(),
|
||||
tracing: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
use_icon_as_answer_icon: z.boolean().nullish(),
|
||||
workflow: zWorkflowPartial.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* AgentConfigSnapshotSummaryResponse
|
||||
*/
|
||||
@ -570,7 +628,6 @@ export const zAgentThought = z.object({
|
||||
created_at: z.int().nullish(),
|
||||
files: z.array(z.string()),
|
||||
id: z.string(),
|
||||
message_chain_id: z.string().nullish(),
|
||||
message_id: z.string(),
|
||||
observation: z.string().nullish(),
|
||||
position: z.int(),
|
||||
@ -773,60 +830,6 @@ export const zAgentAppPagination = z.object({
|
||||
total: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* LLMMode
|
||||
*
|
||||
* Enum class for large language model mode.
|
||||
*/
|
||||
export const zLlmMode = z.enum(['chat', 'completion'])
|
||||
|
||||
/**
|
||||
* ModelConfig
|
||||
*/
|
||||
export const zModelConfig = z.object({
|
||||
completion_params: z.record(z.string(), z.unknown()).optional(),
|
||||
mode: zLlmMode,
|
||||
name: z.string(),
|
||||
provider: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* AgentAppDetailWithSite
|
||||
*/
|
||||
export const zAgentAppDetailWithSite = z.object({
|
||||
access_mode: z.string().nullish(),
|
||||
active_config_is_published: z.boolean().optional().default(false),
|
||||
api_base_url: z.string().nullish(),
|
||||
app_id: z.string().nullish(),
|
||||
bound_agent_id: z.string().nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
debug_conversation_id: z.string().nullish(),
|
||||
deleted_tools: z.array(zDeletedTool).optional(),
|
||||
description: z.string().nullish(),
|
||||
enable_api: z.boolean(),
|
||||
enable_site: z.boolean(),
|
||||
icon: z.string().nullish(),
|
||||
icon_background: z.string().nullish(),
|
||||
icon_type: z.string().nullish(),
|
||||
icon_url: z.string().nullable(),
|
||||
id: z.string(),
|
||||
maintainer: z.string().nullish(),
|
||||
max_active_requests: z.int().nullish(),
|
||||
mode: z.string(),
|
||||
model_config: zModelConfig.nullish(),
|
||||
name: z.string(),
|
||||
permission_keys: z.array(z.string()).optional(),
|
||||
role: z.string().nullish(),
|
||||
site: zSite.nullish(),
|
||||
tags: z.array(zTag).optional(),
|
||||
tracing: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
use_icon_as_answer_icon: z.boolean().nullish(),
|
||||
workflow: zWorkflowPartial.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* AgentKind
|
||||
*
|
||||
@ -1056,8 +1059,8 @@ export const zConversationAnnotation = z.object({
|
||||
*/
|
||||
export const zConversationAnnotationHitHistory = z.object({
|
||||
annotation_create_account: zSimpleAccount.nullish(),
|
||||
annotation_id: z.string(),
|
||||
created_at: z.int().nullish(),
|
||||
id: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
@ -2035,6 +2038,7 @@ export const zMessageDetailResponse = z.object({
|
||||
agent_thoughts: z.array(zAgentThought).optional(),
|
||||
annotation: zConversationAnnotation.nullish(),
|
||||
annotation_hit_history: zConversationAnnotationHitHistory.nullish(),
|
||||
answer: z.string(),
|
||||
answer_tokens: z.int().nullish(),
|
||||
conversation_id: z.string(),
|
||||
created_at: z.int().nullish(),
|
||||
@ -2048,12 +2052,11 @@ export const zMessageDetailResponse = z.object({
|
||||
inputs: z.record(z.string(), zJsonValue),
|
||||
message: zJsonValue.nullish(),
|
||||
message_files: z.array(zMessageFile).optional(),
|
||||
message_metadata_dict: zJsonValue.nullish(),
|
||||
message_tokens: z.int().nullish(),
|
||||
metadata: zJsonValue.nullish(),
|
||||
parent_message_id: z.string().nullish(),
|
||||
provider_response_latency: z.number().nullish(),
|
||||
query: z.string(),
|
||||
re_sign_file_url_answer: z.string(),
|
||||
status: z.string(),
|
||||
workflow_run_id: z.string().nullish(),
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -119,10 +119,9 @@ export type HumanInputFormPreviewPayload = {
|
||||
}
|
||||
|
||||
export type HumanInputFormPreviewResponse = {
|
||||
actions?: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
display_in_ui?: boolean | null
|
||||
TYPE?: 'human_input_required'
|
||||
actions?: Array<HumanInputUserActionResponse>
|
||||
display_in_ui?: boolean
|
||||
expiration_time?: number | null
|
||||
form_content: string
|
||||
form_id: string
|
||||
@ -137,46 +136,6 @@ export type HumanInputFormPreviewResponse = {
|
||||
}
|
||||
}
|
||||
|
||||
export type HumanInputFormSubmitPayload = {
|
||||
action: string
|
||||
form_inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type HumanInputFormSubmitResponse = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export type IterationNodeRunPayload = {
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
} | null
|
||||
}
|
||||
|
||||
export type GeneratedAppResponse = JsonValue
|
||||
|
||||
export type LoopNodeRunPayload = {
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
} | null
|
||||
}
|
||||
|
||||
export type AdvancedChatWorkflowRunPayload = {
|
||||
conversation_id?: string | null
|
||||
files?: Array<{
|
||||
[key: string]: unknown
|
||||
}> | null
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
} | null
|
||||
parent_message_id?: string | null
|
||||
query?: string
|
||||
}
|
||||
|
||||
export type AgentDriveListResponse = {
|
||||
items?: Array<AgentDriveItemResponse>
|
||||
}
|
||||
@ -409,19 +368,6 @@ export type ConversationMessageDetail = {
|
||||
status: string
|
||||
}
|
||||
|
||||
export type CompletionMessagePayload = {
|
||||
files?: Array<unknown> | null
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
model_config?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
query?: string
|
||||
response_mode?: 'blocking' | 'streaming'
|
||||
retriever_from?: string
|
||||
}
|
||||
|
||||
export type PaginatedConversationVariableResponse = {
|
||||
data: Array<ConversationVariableResponse>
|
||||
has_more: boolean
|
||||
@ -472,6 +418,7 @@ export type MessageDetailResponse = {
|
||||
agent_thoughts?: Array<AgentThought>
|
||||
annotation?: ConversationAnnotation | null
|
||||
annotation_hit_history?: ConversationAnnotationHitHistory | null
|
||||
answer: string
|
||||
answer_tokens?: number | null
|
||||
conversation_id: string
|
||||
created_at?: number | null
|
||||
@ -487,12 +434,11 @@ export type MessageDetailResponse = {
|
||||
}
|
||||
message?: JsonValue | null
|
||||
message_files?: Array<MessageFile>
|
||||
message_metadata_dict?: JsonValue | null
|
||||
message_tokens?: number | null
|
||||
metadata?: JsonValue | null
|
||||
parent_message_id?: string | null
|
||||
provider_response_latency?: number | null
|
||||
query: string
|
||||
re_sign_file_url_answer: string
|
||||
status: string
|
||||
workflow_run_id?: string | null
|
||||
}
|
||||
@ -731,7 +677,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
|
||||
@ -799,7 +745,7 @@ export type WorkflowCommentCreate = {
|
||||
}
|
||||
|
||||
export type WorkflowCommentMentionUsersPayload = {
|
||||
users: Array<AccountWithRole>
|
||||
users: Array<AccountWithRoleResponse>
|
||||
}
|
||||
|
||||
export type WorkflowCommentDetail = {
|
||||
@ -876,18 +822,10 @@ export type WorkflowPaginationResponse = {
|
||||
page: number
|
||||
}
|
||||
|
||||
export type DefaultBlockConfigsResponse = Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
|
||||
export type DefaultBlockConfigResponse = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
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
|
||||
@ -902,7 +840,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
|
||||
}
|
||||
|
||||
@ -923,9 +861,9 @@ export type SyncDraftWorkflowPayload = {
|
||||
}
|
||||
|
||||
export type SyncDraftWorkflowResponse = {
|
||||
hash?: string
|
||||
result?: string
|
||||
updated_at?: string
|
||||
hash: string
|
||||
result: string
|
||||
updated_at: number
|
||||
}
|
||||
|
||||
export type WorkflowDraftVariableList = {
|
||||
@ -961,7 +899,7 @@ export type HumanInputDeliveryTestPayload = {
|
||||
}
|
||||
}
|
||||
|
||||
export type EmptyObjectResponse = {
|
||||
export type HumanInputDeliveryTestResponse = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
@ -1029,7 +967,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
|
||||
@ -1062,17 +1000,6 @@ export type DraftWorkflowNodeRunPayload = {
|
||||
query?: string
|
||||
}
|
||||
|
||||
export type DraftWorkflowRunPayload = {
|
||||
datasource_info_list: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
datasource_type: string
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
start_node_id: string
|
||||
}
|
||||
|
||||
export type WorkflowRunSnapshotView = {
|
||||
node_outputs?: Array<NodeOutputsView>
|
||||
workflow_run_id: string
|
||||
@ -1099,14 +1026,6 @@ export type OutputPreviewView = {
|
||||
value?: unknown
|
||||
}
|
||||
|
||||
export type DraftWorkflowTriggerRunRequest = {
|
||||
node_id: string
|
||||
}
|
||||
|
||||
export type DraftWorkflowTriggerRunAllPayload = {
|
||||
node_ids: Array<string>
|
||||
}
|
||||
|
||||
export type WorkflowDraftVariableListWithoutValue = {
|
||||
items?: Array<WorkflowDraftVariableWithoutValue>
|
||||
total?: number
|
||||
@ -1143,12 +1062,11 @@ export type WorkflowDraftVariableUpdatePayload = {
|
||||
}
|
||||
|
||||
export type PublishWorkflowPayload = {
|
||||
knowledge_base_setting?: {
|
||||
[key: string]: unknown
|
||||
} | null
|
||||
marked_comment?: string | null
|
||||
marked_name?: string | null
|
||||
}
|
||||
|
||||
export type WorkflowPublishResponse = {
|
||||
export type PublishWorkflowResponse = {
|
||||
created_at: number
|
||||
result: string
|
||||
}
|
||||
@ -1167,12 +1085,6 @@ export type WorkflowUpdatePayload = {
|
||||
marked_name?: string | null
|
||||
}
|
||||
|
||||
export type WorkflowRestoreResponse = {
|
||||
hash: string
|
||||
result: string
|
||||
updated_at: number
|
||||
}
|
||||
|
||||
export type ApiKeyList = {
|
||||
data: Array<ApiKeyItem>
|
||||
}
|
||||
@ -1223,12 +1135,30 @@ export type DeletedTool = {
|
||||
}
|
||||
|
||||
export type ModelConfig = {
|
||||
completion_params?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
mode: LlmMode
|
||||
name: string
|
||||
provider: string
|
||||
agent_mode?: JsonValue | null
|
||||
annotation_reply?: JsonValue | null
|
||||
chat_prompt_config?: JsonValue | null
|
||||
completion_prompt_config?: JsonValue | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
dataset_configs?: JsonValue | null
|
||||
dataset_query_variable?: string | null
|
||||
external_data_tools?: JsonValue | null
|
||||
file_upload?: JsonValue | null
|
||||
model?: JsonValue | null
|
||||
more_like_this?: JsonValue | null
|
||||
opening_statement?: string | null
|
||||
pre_prompt?: string | null
|
||||
prompt_type?: string | null
|
||||
retriever_resource?: JsonValue | null
|
||||
sensitive_word_avoidance?: JsonValue | null
|
||||
speech_to_text?: JsonValue | null
|
||||
suggested_questions?: JsonValue | null
|
||||
suggested_questions_after_answer?: JsonValue | null
|
||||
text_to_speech?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
user_input_form?: JsonValue | null
|
||||
}
|
||||
|
||||
export type Site = {
|
||||
@ -1254,16 +1184,7 @@ export type Tag = {
|
||||
type: string
|
||||
}
|
||||
|
||||
export type JsonValue
|
||||
= | string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type WorkflowPartial = {
|
||||
created_at?: number | null
|
||||
@ -1289,7 +1210,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
|
||||
@ -1302,6 +1223,12 @@ export type AdvancedChatWorkflowRunForListResponse = {
|
||||
version?: string | null
|
||||
}
|
||||
|
||||
export type HumanInputUserActionResponse = {
|
||||
button_style?: string
|
||||
id: string
|
||||
title: string
|
||||
}
|
||||
|
||||
export type AgentDriveItemResponse = {
|
||||
created_at?: number | null
|
||||
file_kind: string
|
||||
@ -1498,7 +1425,6 @@ export type AgentThought = {
|
||||
created_at?: number | null
|
||||
files: Array<string>
|
||||
id: string
|
||||
message_chain_id?: string | null
|
||||
message_id: string
|
||||
observation?: string | null
|
||||
position: number
|
||||
@ -1518,8 +1444,8 @@ export type ConversationAnnotation = {
|
||||
|
||||
export type ConversationAnnotationHitHistory = {
|
||||
annotation_create_account?: SimpleAccount | null
|
||||
annotation_id: string
|
||||
created_at?: number | null
|
||||
id: string
|
||||
}
|
||||
|
||||
export type HumanInputContent = {
|
||||
@ -1596,7 +1522,7 @@ export type UserSatisfactionRateStatisticItem = {
|
||||
|
||||
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
|
||||
@ -1607,7 +1533,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
|
||||
@ -1616,7 +1542,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
|
||||
@ -1628,7 +1554,7 @@ export type WorkflowRunForListResponse = {
|
||||
version?: string | null
|
||||
}
|
||||
|
||||
export type SimpleAccount = {
|
||||
export type SimpleAccountResponse = {
|
||||
email: string
|
||||
id: string
|
||||
name: string
|
||||
@ -1671,7 +1597,7 @@ export type WorkflowCommentBasic = {
|
||||
updated_at?: number | null
|
||||
}
|
||||
|
||||
export type AccountWithRole = {
|
||||
export type AccountWithRoleResponse = {
|
||||
avatar?: string | null
|
||||
created_at?: number | null
|
||||
email: string
|
||||
@ -1982,8 +1908,6 @@ export type ModelConfigPartial = {
|
||||
updated_by?: string | null
|
||||
}
|
||||
|
||||
export type LlmMode = 'chat' | 'completion'
|
||||
|
||||
export type Type = 'github' | 'marketplace' | 'package'
|
||||
|
||||
export type Github = {
|
||||
@ -2054,6 +1978,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
|
||||
@ -2631,8 +2561,6 @@ export type AppDetailWithSiteWritable = {
|
||||
workflow?: WorkflowPartial | null
|
||||
}
|
||||
|
||||
export type GeneratedAppResponseWritable = JsonValue
|
||||
|
||||
export type WorkflowCommentBasicListWritable = {
|
||||
data: Array<WorkflowCommentBasicWritable>
|
||||
}
|
||||
@ -2654,6 +2582,10 @@ export type WorkflowCommentDetailWritable = {
|
||||
updated_at?: number | null
|
||||
}
|
||||
|
||||
export type HumanInputDeliveryTestResponseWritable = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export type AppPartialWritable = {
|
||||
access_mode?: string | null
|
||||
app_id?: string | null
|
||||
@ -2999,88 +2931,6 @@ export type PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdForm
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdFormPreviewResponse
|
||||
= PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdFormPreviewResponses[keyof PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdFormPreviewResponses]
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdFormRunData = {
|
||||
body: HumanInputFormSubmitPayload
|
||||
path: {
|
||||
app_id: string
|
||||
node_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/advanced-chat/workflows/draft/human-input/nodes/{node_id}/form/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdFormRunResponses = {
|
||||
200: HumanInputFormSubmitResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdFormRunResponse
|
||||
= PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdFormRunResponses[keyof PostAppsByAppIdAdvancedChatWorkflowsDraftHumanInputNodesByNodeIdFormRunResponses]
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftIterationNodesByNodeIdRunData = {
|
||||
body: IterationNodeRunPayload
|
||||
path: {
|
||||
app_id: string
|
||||
node_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/advanced-chat/workflows/draft/iteration/nodes/{node_id}/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftIterationNodesByNodeIdRunErrors = {
|
||||
403: unknown
|
||||
404: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftIterationNodesByNodeIdRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftIterationNodesByNodeIdRunResponse
|
||||
= PostAppsByAppIdAdvancedChatWorkflowsDraftIterationNodesByNodeIdRunResponses[keyof PostAppsByAppIdAdvancedChatWorkflowsDraftIterationNodesByNodeIdRunResponses]
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftLoopNodesByNodeIdRunData = {
|
||||
body: LoopNodeRunPayload
|
||||
path: {
|
||||
app_id: string
|
||||
node_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/advanced-chat/workflows/draft/loop/nodes/{node_id}/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftLoopNodesByNodeIdRunErrors = {
|
||||
403: unknown
|
||||
404: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftLoopNodesByNodeIdRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftLoopNodesByNodeIdRunResponse
|
||||
= PostAppsByAppIdAdvancedChatWorkflowsDraftLoopNodesByNodeIdRunResponses[keyof PostAppsByAppIdAdvancedChatWorkflowsDraftLoopNodesByNodeIdRunResponses]
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftRunData = {
|
||||
body: AdvancedChatWorkflowRunPayload
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/advanced-chat/workflows/draft/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftRunErrors = {
|
||||
400: unknown
|
||||
403: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdAdvancedChatWorkflowsDraftRunResponse
|
||||
= PostAppsByAppIdAdvancedChatWorkflowsDraftRunResponses[keyof PostAppsByAppIdAdvancedChatWorkflowsDraftRunResponses]
|
||||
|
||||
export type GetAppsByAppIdAgentDriveFilesData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -3831,27 +3681,6 @@ export type GetAppsByAppIdCompletionConversationsByConversationIdResponses = {
|
||||
export type GetAppsByAppIdCompletionConversationsByConversationIdResponse
|
||||
= GetAppsByAppIdCompletionConversationsByConversationIdResponses[keyof GetAppsByAppIdCompletionConversationsByConversationIdResponses]
|
||||
|
||||
export type PostAppsByAppIdCompletionMessagesData = {
|
||||
body: CompletionMessagePayload
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/completion-messages'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdCompletionMessagesErrors = {
|
||||
400: unknown
|
||||
404: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdCompletionMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdCompletionMessagesResponse
|
||||
= PostAppsByAppIdCompletionMessagesResponses[keyof PostAppsByAppIdCompletionMessagesResponses]
|
||||
|
||||
export type PostAppsByAppIdCompletionMessagesByTaskIdStopData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -5114,45 +4943,6 @@ export type GetAppsByAppIdWorkflowsResponses = {
|
||||
export type GetAppsByAppIdWorkflowsResponse
|
||||
= GetAppsByAppIdWorkflowsResponses[keyof GetAppsByAppIdWorkflowsResponses]
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsData = {
|
||||
body?: never
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/workflows/default-workflow-block-configs'
|
||||
}
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsResponses = {
|
||||
200: DefaultBlockConfigsResponse
|
||||
}
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsResponse
|
||||
= GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsResponses[keyof GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsResponses]
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeData = {
|
||||
body?: never
|
||||
path: {
|
||||
app_id: string
|
||||
block_type: string
|
||||
}
|
||||
query?: {
|
||||
q?: string
|
||||
}
|
||||
url: '/apps/{app_id}/workflows/default-workflow-block-configs/{block_type}'
|
||||
}
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeErrors = {
|
||||
404: unknown
|
||||
}
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponses = {
|
||||
200: DefaultBlockConfigResponse
|
||||
}
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponse
|
||||
= GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponses[keyof GetAppsByAppIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponses]
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDraftData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -5293,7 +5083,7 @@ export type PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdDeliveryTestData
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdDeliveryTestResponses = {
|
||||
200: EmptyObjectResponse
|
||||
200: HumanInputDeliveryTestResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdDeliveryTestResponse
|
||||
@ -5316,67 +5106,6 @@ export type PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormPreviewRespo
|
||||
export type PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormPreviewResponse
|
||||
= PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormPreviewResponses[keyof PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormPreviewResponses]
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormRunData = {
|
||||
body: HumanInputFormSubmitPayload
|
||||
path: {
|
||||
app_id: string
|
||||
node_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/workflows/draft/human-input/nodes/{node_id}/form/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormRunResponses = {
|
||||
200: HumanInputFormSubmitResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormRunResponse
|
||||
= PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormRunResponses[keyof PostAppsByAppIdWorkflowsDraftHumanInputNodesByNodeIdFormRunResponses]
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftIterationNodesByNodeIdRunData = {
|
||||
body: IterationNodeRunPayload
|
||||
path: {
|
||||
app_id: string
|
||||
node_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/workflows/draft/iteration/nodes/{node_id}/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftIterationNodesByNodeIdRunErrors = {
|
||||
403: unknown
|
||||
404: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftIterationNodesByNodeIdRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftIterationNodesByNodeIdRunResponse
|
||||
= PostAppsByAppIdWorkflowsDraftIterationNodesByNodeIdRunResponses[keyof PostAppsByAppIdWorkflowsDraftIterationNodesByNodeIdRunResponses]
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftLoopNodesByNodeIdRunData = {
|
||||
body: LoopNodeRunPayload
|
||||
path: {
|
||||
app_id: string
|
||||
node_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/workflows/draft/loop/nodes/{node_id}/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftLoopNodesByNodeIdRunErrors = {
|
||||
403: unknown
|
||||
404: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftLoopNodesByNodeIdRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftLoopNodesByNodeIdRunResponse
|
||||
= PostAppsByAppIdWorkflowsDraftLoopNodesByNodeIdRunResponses[keyof PostAppsByAppIdWorkflowsDraftLoopNodesByNodeIdRunResponses]
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDraftNodesByNodeIdAgentComposerData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -5556,7 +5285,7 @@ export type PostAppsByAppIdWorkflowsDraftNodesByNodeIdTriggerRunErrors = {
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftNodesByNodeIdTriggerRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: WorkflowRunNodeExecutionResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftNodesByNodeIdTriggerRunResponse
|
||||
@ -5596,26 +5325,6 @@ export type GetAppsByAppIdWorkflowsDraftNodesByNodeIdVariablesResponses = {
|
||||
export type GetAppsByAppIdWorkflowsDraftNodesByNodeIdVariablesResponse
|
||||
= GetAppsByAppIdWorkflowsDraftNodesByNodeIdVariablesResponses[keyof GetAppsByAppIdWorkflowsDraftNodesByNodeIdVariablesResponses]
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftRunData = {
|
||||
body: DraftWorkflowRunPayload
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/workflows/draft/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftRunErrors = {
|
||||
403: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftRunResponse
|
||||
= PostAppsByAppIdWorkflowsDraftRunResponses[keyof PostAppsByAppIdWorkflowsDraftRunResponses]
|
||||
|
||||
export type GetAppsByAppIdWorkflowsDraftRunsByRunIdNodeOutputsData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -5720,48 +5429,6 @@ export type GetAppsByAppIdWorkflowsDraftSystemVariablesResponses = {
|
||||
export type GetAppsByAppIdWorkflowsDraftSystemVariablesResponse
|
||||
= GetAppsByAppIdWorkflowsDraftSystemVariablesResponses[keyof GetAppsByAppIdWorkflowsDraftSystemVariablesResponses]
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftTriggerRunData = {
|
||||
body: DraftWorkflowTriggerRunRequest
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/workflows/draft/trigger/run'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftTriggerRunErrors = {
|
||||
403: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftTriggerRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftTriggerRunResponse
|
||||
= PostAppsByAppIdWorkflowsDraftTriggerRunResponses[keyof PostAppsByAppIdWorkflowsDraftTriggerRunResponses]
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftTriggerRunAllData = {
|
||||
body: DraftWorkflowTriggerRunAllPayload
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/apps/{app_id}/workflows/draft/trigger/run-all'
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftTriggerRunAllErrors = {
|
||||
403: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftTriggerRunAllResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsDraftTriggerRunAllResponse
|
||||
= PostAppsByAppIdWorkflowsDraftTriggerRunAllResponses[keyof PostAppsByAppIdWorkflowsDraftTriggerRunAllResponses]
|
||||
|
||||
export type DeleteAppsByAppIdWorkflowsDraftVariablesData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -5908,7 +5575,7 @@ export type PostAppsByAppIdWorkflowsPublishData = {
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsPublishResponses = {
|
||||
200: WorkflowPublishResponse
|
||||
200: PublishWorkflowResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsPublishResponse
|
||||
@ -6077,7 +5744,7 @@ export type PostAppsByAppIdWorkflowsByWorkflowIdRestoreErrors = {
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsByWorkflowIdRestoreResponses = {
|
||||
200: WorkflowRestoreResponse
|
||||
200: SyncDraftWorkflowResponse
|
||||
}
|
||||
|
||||
export type PostAppsByAppIdWorkflowsByWorkflowIdRestoreResponse
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -13,9 +13,6 @@ import {
|
||||
zGetInstalledAppsByInstalledAppIdConversationsPath,
|
||||
zGetInstalledAppsByInstalledAppIdConversationsQuery,
|
||||
zGetInstalledAppsByInstalledAppIdConversationsResponse,
|
||||
zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisPath,
|
||||
zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisQuery,
|
||||
zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponse,
|
||||
zGetInstalledAppsByInstalledAppIdMessagesByMessageIdSuggestedQuestionsPath,
|
||||
zGetInstalledAppsByInstalledAppIdMessagesByMessageIdSuggestedQuestionsResponse,
|
||||
zGetInstalledAppsByInstalledAppIdMessagesPath,
|
||||
@ -40,16 +37,10 @@ import {
|
||||
zPostInstalledAppsBody,
|
||||
zPostInstalledAppsByInstalledAppIdAudioToTextPath,
|
||||
zPostInstalledAppsByInstalledAppIdAudioToTextResponse,
|
||||
zPostInstalledAppsByInstalledAppIdChatMessagesBody,
|
||||
zPostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopPath,
|
||||
zPostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopResponse,
|
||||
zPostInstalledAppsByInstalledAppIdChatMessagesPath,
|
||||
zPostInstalledAppsByInstalledAppIdChatMessagesResponse,
|
||||
zPostInstalledAppsByInstalledAppIdCompletionMessagesBody,
|
||||
zPostInstalledAppsByInstalledAppIdCompletionMessagesByTaskIdStopPath,
|
||||
zPostInstalledAppsByInstalledAppIdCompletionMessagesByTaskIdStopResponse,
|
||||
zPostInstalledAppsByInstalledAppIdCompletionMessagesPath,
|
||||
zPostInstalledAppsByInstalledAppIdCompletionMessagesResponse,
|
||||
zPostInstalledAppsByInstalledAppIdConversationsByCIdNameBody,
|
||||
zPostInstalledAppsByInstalledAppIdConversationsByCIdNamePath,
|
||||
zPostInstalledAppsByInstalledAppIdConversationsByCIdNameResponse,
|
||||
@ -62,9 +53,6 @@ import {
|
||||
zPostInstalledAppsByInstalledAppIdTextToAudioBody,
|
||||
zPostInstalledAppsByInstalledAppIdTextToAudioPath,
|
||||
zPostInstalledAppsByInstalledAppIdTextToAudioResponse,
|
||||
zPostInstalledAppsByInstalledAppIdWorkflowsRunBody,
|
||||
zPostInstalledAppsByInstalledAppIdWorkflowsRunPath,
|
||||
zPostInstalledAppsByInstalledAppIdWorkflowsRunResponse,
|
||||
zPostInstalledAppsByInstalledAppIdWorkflowsTasksByTaskIdStopPath,
|
||||
zPostInstalledAppsByInstalledAppIdWorkflowsTasksByTaskIdStopResponse,
|
||||
zPostInstalledAppsResponse,
|
||||
@ -104,28 +92,11 @@ export const byTaskId = {
|
||||
stop,
|
||||
}
|
||||
|
||||
export const post3 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postInstalledAppsByInstalledAppIdChatMessages',
|
||||
path: '/installed-apps/{installed_app_id}/chat-messages',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostInstalledAppsByInstalledAppIdChatMessagesBody,
|
||||
params: zPostInstalledAppsByInstalledAppIdChatMessagesPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostInstalledAppsByInstalledAppIdChatMessagesResponse)
|
||||
|
||||
export const chatMessages = {
|
||||
post: post3,
|
||||
byTaskId,
|
||||
}
|
||||
|
||||
export const post4 = oc
|
||||
export const post3 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -137,35 +108,18 @@ export const post4 = oc
|
||||
.output(zPostInstalledAppsByInstalledAppIdCompletionMessagesByTaskIdStopResponse)
|
||||
|
||||
export const stop2 = {
|
||||
post: post4,
|
||||
post: post3,
|
||||
}
|
||||
|
||||
export const byTaskId2 = {
|
||||
stop: stop2,
|
||||
}
|
||||
|
||||
export const post5 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postInstalledAppsByInstalledAppIdCompletionMessages',
|
||||
path: '/installed-apps/{installed_app_id}/completion-messages',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostInstalledAppsByInstalledAppIdCompletionMessagesBody,
|
||||
params: zPostInstalledAppsByInstalledAppIdCompletionMessagesPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostInstalledAppsByInstalledAppIdCompletionMessagesResponse)
|
||||
|
||||
export const completionMessages = {
|
||||
post: post5,
|
||||
byTaskId: byTaskId2,
|
||||
}
|
||||
|
||||
export const post6 = oc
|
||||
export const post4 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -182,7 +136,7 @@ export const post6 = oc
|
||||
.output(zPostInstalledAppsByInstalledAppIdConversationsByCIdNameResponse)
|
||||
|
||||
export const name = {
|
||||
post: post6,
|
||||
post: post4,
|
||||
}
|
||||
|
||||
export const patch = oc
|
||||
@ -255,7 +209,7 @@ export const conversations = {
|
||||
byCId,
|
||||
}
|
||||
|
||||
export const post7 = oc
|
||||
export const post5 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -272,30 +226,10 @@ export const post7 = oc
|
||||
.output(zPostInstalledAppsByInstalledAppIdMessagesByMessageIdFeedbacksResponse)
|
||||
|
||||
export const feedbacks = {
|
||||
post: post7,
|
||||
post: post5,
|
||||
}
|
||||
|
||||
export const get2 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
operationId: 'getInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThis',
|
||||
path: '/installed-apps/{installed_app_id}/messages/{message_id}/more-like-this',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
params: zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisPath,
|
||||
query: zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisQuery,
|
||||
}),
|
||||
)
|
||||
.output(zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponse)
|
||||
|
||||
export const moreLikeThis = {
|
||||
get: get2,
|
||||
}
|
||||
|
||||
export const get3 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -311,16 +245,15 @@ export const get3 = oc
|
||||
.output(zGetInstalledAppsByInstalledAppIdMessagesByMessageIdSuggestedQuestionsResponse)
|
||||
|
||||
export const suggestedQuestions = {
|
||||
get: get3,
|
||||
get: get2,
|
||||
}
|
||||
|
||||
export const byMessageId = {
|
||||
feedbacks,
|
||||
moreLikeThis,
|
||||
suggestedQuestions,
|
||||
}
|
||||
|
||||
export const get4 = oc
|
||||
export const get3 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -337,14 +270,14 @@ export const get4 = oc
|
||||
.output(zGetInstalledAppsByInstalledAppIdMessagesResponse)
|
||||
|
||||
export const messages = {
|
||||
get: get4,
|
||||
get: get3,
|
||||
byMessageId,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get app meta
|
||||
*/
|
||||
export const get5 = oc
|
||||
export const get4 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -357,13 +290,13 @@ export const get5 = oc
|
||||
.output(zGetInstalledAppsByInstalledAppIdMetaResponse)
|
||||
|
||||
export const meta = {
|
||||
get: get5,
|
||||
get: get4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve app parameters
|
||||
*/
|
||||
export const get6 = oc
|
||||
export const get5 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -376,7 +309,7 @@ export const get6 = oc
|
||||
.output(zGetInstalledAppsByInstalledAppIdParametersResponse)
|
||||
|
||||
export const parameters = {
|
||||
get: get6,
|
||||
get: get5,
|
||||
}
|
||||
|
||||
export const delete2 = oc
|
||||
@ -395,7 +328,7 @@ export const byMessageId2 = {
|
||||
delete: delete2,
|
||||
}
|
||||
|
||||
export const get7 = oc
|
||||
export const get6 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -411,7 +344,7 @@ export const get7 = oc
|
||||
)
|
||||
.output(zGetInstalledAppsByInstalledAppIdSavedMessagesResponse)
|
||||
|
||||
export const post8 = oc
|
||||
export const post6 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -428,12 +361,12 @@ export const post8 = oc
|
||||
.output(zPostInstalledAppsByInstalledAppIdSavedMessagesResponse)
|
||||
|
||||
export const savedMessages = {
|
||||
get: get7,
|
||||
post: post8,
|
||||
get: get6,
|
||||
post: post6,
|
||||
byMessageId: byMessageId2,
|
||||
}
|
||||
|
||||
export const post9 = oc
|
||||
export const post7 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -450,37 +383,13 @@ export const post9 = oc
|
||||
.output(zPostInstalledAppsByInstalledAppIdTextToAudioResponse)
|
||||
|
||||
export const textToAudio = {
|
||||
post: post9,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run workflow
|
||||
*/
|
||||
export const post10 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postInstalledAppsByInstalledAppIdWorkflowsRun',
|
||||
path: '/installed-apps/{installed_app_id}/workflows/run',
|
||||
summary: 'Run workflow',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostInstalledAppsByInstalledAppIdWorkflowsRunBody,
|
||||
params: zPostInstalledAppsByInstalledAppIdWorkflowsRunPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostInstalledAppsByInstalledAppIdWorkflowsRunResponse)
|
||||
|
||||
export const run = {
|
||||
post: post10,
|
||||
post: post7,
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop workflow task
|
||||
*/
|
||||
export const post11 = oc
|
||||
export const post8 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -493,7 +402,7 @@ export const post11 = oc
|
||||
.output(zPostInstalledAppsByInstalledAppIdWorkflowsTasksByTaskIdStopResponse)
|
||||
|
||||
export const stop3 = {
|
||||
post: post11,
|
||||
post: post8,
|
||||
}
|
||||
|
||||
export const byTaskId3 = {
|
||||
@ -505,7 +414,6 @@ export const tasks = {
|
||||
}
|
||||
|
||||
export const workflows = {
|
||||
run,
|
||||
tasks,
|
||||
}
|
||||
|
||||
@ -552,7 +460,7 @@ export const byInstalledAppId = {
|
||||
workflows,
|
||||
}
|
||||
|
||||
export const get8 = oc
|
||||
export const get7 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -563,7 +471,7 @@ export const get8 = oc
|
||||
.input(z.object({ query: zGetInstalledAppsQuery.optional() }))
|
||||
.output(zGetInstalledAppsResponse)
|
||||
|
||||
export const post12 = oc
|
||||
export const post9 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -575,8 +483,8 @@ export const post12 = oc
|
||||
.output(zPostInstalledAppsResponse)
|
||||
|
||||
export const installedApps = {
|
||||
get: get8,
|
||||
post: post12,
|
||||
get: get7,
|
||||
post: post9,
|
||||
byInstalledAppId,
|
||||
}
|
||||
|
||||
|
||||
@ -29,39 +29,10 @@ export type AudioTranscriptResponse = {
|
||||
text: string
|
||||
}
|
||||
|
||||
export type ChatMessagePayload = {
|
||||
conversation_id?: string | null
|
||||
files?: Array<unknown> | null
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
model_config?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
parent_message_id?: string | null
|
||||
query: string
|
||||
response_mode?: 'blocking' | 'streaming'
|
||||
retriever_from?: string
|
||||
}
|
||||
|
||||
export type GeneratedAppResponse = JsonValue
|
||||
|
||||
export type SimpleResultResponse = {
|
||||
result: string
|
||||
}
|
||||
|
||||
export type CompletionMessageExplorePayload = {
|
||||
files?: Array<{
|
||||
[key: string]: unknown
|
||||
}> | null
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
query?: string
|
||||
response_mode?: 'blocking' | 'streaming' | null
|
||||
retriever_from?: string
|
||||
}
|
||||
|
||||
export type ConversationInfiniteScrollPagination = {
|
||||
data: Array<SimpleConversation>
|
||||
has_more: boolean
|
||||
@ -154,18 +125,6 @@ export type TextToAudioPayload = {
|
||||
|
||||
export type AudioBinaryResponse = Blob | File
|
||||
|
||||
export type WorkflowRunPayload = {
|
||||
files?: Array<{
|
||||
transfer_method: 'local_file' | 'remote_url'
|
||||
type: 'audio' | 'custom' | 'document' | 'image' | 'video'
|
||||
upload_file_id?: string
|
||||
url?: string
|
||||
}> | null
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type InstalledAppResponse = {
|
||||
app: InstalledAppInfoResponse
|
||||
app_owner_tenant_id: string
|
||||
@ -176,16 +135,7 @@ export type InstalledAppResponse = {
|
||||
uninstallable: boolean
|
||||
}
|
||||
|
||||
export type JsonValue
|
||||
= | string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type ExploreMessageListItem = {
|
||||
agent_thoughts: Array<AgentThought>
|
||||
@ -246,7 +196,6 @@ export type AgentThought = {
|
||||
created_at?: number | null
|
||||
files: Array<string>
|
||||
id: string
|
||||
message_chain_id?: string | null
|
||||
message_id: string
|
||||
observation?: string | null
|
||||
position: number
|
||||
@ -477,22 +426,6 @@ export type PostInstalledAppsByInstalledAppIdAudioToTextResponses = {
|
||||
export type PostInstalledAppsByInstalledAppIdAudioToTextResponse
|
||||
= PostInstalledAppsByInstalledAppIdAudioToTextResponses[keyof PostInstalledAppsByInstalledAppIdAudioToTextResponses]
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdChatMessagesData = {
|
||||
body: ChatMessagePayload
|
||||
path: {
|
||||
installed_app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/installed-apps/{installed_app_id}/chat-messages'
|
||||
}
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdChatMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdChatMessagesResponse
|
||||
= PostInstalledAppsByInstalledAppIdChatMessagesResponses[keyof PostInstalledAppsByInstalledAppIdChatMessagesResponses]
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -510,22 +443,6 @@ export type PostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopResponses =
|
||||
export type PostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopResponse
|
||||
= PostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopResponses[keyof PostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopResponses]
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdCompletionMessagesData = {
|
||||
body: CompletionMessageExplorePayload
|
||||
path: {
|
||||
installed_app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/installed-apps/{installed_app_id}/completion-messages'
|
||||
}
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdCompletionMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdCompletionMessagesResponse
|
||||
= PostInstalledAppsByInstalledAppIdCompletionMessagesResponses[keyof PostInstalledAppsByInstalledAppIdCompletionMessagesResponses]
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdCompletionMessagesByTaskIdStopData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -668,25 +585,6 @@ export type PostInstalledAppsByInstalledAppIdMessagesByMessageIdFeedbacksRespons
|
||||
export type PostInstalledAppsByInstalledAppIdMessagesByMessageIdFeedbacksResponse
|
||||
= PostInstalledAppsByInstalledAppIdMessagesByMessageIdFeedbacksResponses[keyof PostInstalledAppsByInstalledAppIdMessagesByMessageIdFeedbacksResponses]
|
||||
|
||||
export type GetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisData = {
|
||||
body?: never
|
||||
path: {
|
||||
installed_app_id: string
|
||||
message_id: string
|
||||
}
|
||||
query: {
|
||||
response_mode: 'blocking' | 'streaming'
|
||||
}
|
||||
url: '/installed-apps/{installed_app_id}/messages/{message_id}/more-like-this'
|
||||
}
|
||||
|
||||
export type GetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type GetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponse
|
||||
= GetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponses[keyof GetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponses]
|
||||
|
||||
export type GetInstalledAppsByInstalledAppIdMessagesByMessageIdSuggestedQuestionsData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -804,22 +702,6 @@ export type PostInstalledAppsByInstalledAppIdTextToAudioResponses = {
|
||||
export type PostInstalledAppsByInstalledAppIdTextToAudioResponse
|
||||
= PostInstalledAppsByInstalledAppIdTextToAudioResponses[keyof PostInstalledAppsByInstalledAppIdTextToAudioResponses]
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdWorkflowsRunData = {
|
||||
body: WorkflowRunPayload
|
||||
path: {
|
||||
installed_app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/installed-apps/{installed_app_id}/workflows/run'
|
||||
}
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdWorkflowsRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdWorkflowsRunResponse
|
||||
= PostInstalledAppsByInstalledAppIdWorkflowsRunResponses[keyof PostInstalledAppsByInstalledAppIdWorkflowsRunResponses]
|
||||
|
||||
export type PostInstalledAppsByInstalledAppIdWorkflowsTasksByTaskIdStopData = {
|
||||
body?: never
|
||||
path: {
|
||||
|
||||
@ -38,20 +38,6 @@ export const zAudioTranscriptResponse = z.object({
|
||||
text: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ChatMessagePayload
|
||||
*/
|
||||
export const zChatMessagePayload = z.object({
|
||||
conversation_id: z.string().nullish(),
|
||||
files: z.array(z.unknown()).nullish(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
model_config: z.record(z.string(), z.unknown()).optional(),
|
||||
parent_message_id: z.string().nullish(),
|
||||
query: z.string(),
|
||||
response_mode: z.enum(['blocking', 'streaming']).optional().default('blocking'),
|
||||
retriever_from: z.string().optional().default('dev'),
|
||||
})
|
||||
|
||||
/**
|
||||
* SimpleResultResponse
|
||||
*/
|
||||
@ -59,17 +45,6 @@ export const zSimpleResultResponse = z.object({
|
||||
result: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* CompletionMessageExplorePayload
|
||||
*/
|
||||
export const zCompletionMessageExplorePayload = z.object({
|
||||
files: z.array(z.record(z.string(), z.unknown())).nullish(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
query: z.string().optional().default(''),
|
||||
response_mode: z.enum(['blocking', 'streaming']).nullish(),
|
||||
retriever_from: z.string().optional().default('explore_app'),
|
||||
})
|
||||
|
||||
export const zConversationRenamePayload = z.intersection(
|
||||
z.union([
|
||||
z.object({
|
||||
@ -139,38 +114,7 @@ export const zTextToAudioPayload = z.object({
|
||||
*/
|
||||
export const zAudioBinaryResponse = z.custom<Blob | File>()
|
||||
|
||||
/**
|
||||
* WorkflowRunPayload
|
||||
*/
|
||||
export const zWorkflowRunPayload = z.object({
|
||||
files: z
|
||||
.array(
|
||||
z.object({
|
||||
transfer_method: z.enum(['local_file', 'remote_url']),
|
||||
type: z.enum(['audio', 'custom', 'document', 'image', 'video']),
|
||||
upload_file_id: z.string().optional(),
|
||||
url: z.string().optional(),
|
||||
}),
|
||||
)
|
||||
.nullish(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
})
|
||||
|
||||
export const zJsonValue = z
|
||||
.union([
|
||||
z.string(),
|
||||
z.int(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.record(z.string(), z.unknown()),
|
||||
z.array(z.unknown()),
|
||||
])
|
||||
.nullable()
|
||||
|
||||
/**
|
||||
* GeneratedAppResponse
|
||||
*/
|
||||
export const zGeneratedAppResponse = zJsonValue
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* SimpleConversation
|
||||
@ -266,7 +210,6 @@ export const zAgentThought = z.object({
|
||||
created_at: z.int().nullish(),
|
||||
files: z.array(z.string()),
|
||||
id: z.string(),
|
||||
message_chain_id: z.string().nullish(),
|
||||
message_id: z.string(),
|
||||
observation: z.string().nullish(),
|
||||
position: z.int(),
|
||||
@ -577,17 +520,6 @@ export const zPostInstalledAppsByInstalledAppIdAudioToTextPath = z.object({
|
||||
*/
|
||||
export const zPostInstalledAppsByInstalledAppIdAudioToTextResponse = zAudioTranscriptResponse
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdChatMessagesBody = zChatMessagePayload
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdChatMessagesPath = z.object({
|
||||
installed_app_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostInstalledAppsByInstalledAppIdChatMessagesResponse = zGeneratedAppResponse
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopPath = z.object({
|
||||
installed_app_id: z.uuid(),
|
||||
task_id: z.string(),
|
||||
@ -599,18 +531,6 @@ export const zPostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopPath = z.
|
||||
export const zPostInstalledAppsByInstalledAppIdChatMessagesByTaskIdStopResponse
|
||||
= zSimpleResultResponse
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdCompletionMessagesBody
|
||||
= zCompletionMessageExplorePayload
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdCompletionMessagesPath = z.object({
|
||||
installed_app_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostInstalledAppsByInstalledAppIdCompletionMessagesResponse = zGeneratedAppResponse
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdCompletionMessagesByTaskIdStopPath = z.object({
|
||||
installed_app_id: z.uuid(),
|
||||
task_id: z.string(),
|
||||
@ -711,21 +631,6 @@ export const zPostInstalledAppsByInstalledAppIdMessagesByMessageIdFeedbacksPath
|
||||
export const zPostInstalledAppsByInstalledAppIdMessagesByMessageIdFeedbacksResponse
|
||||
= zResultResponse
|
||||
|
||||
export const zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisPath = z.object({
|
||||
installed_app_id: z.uuid(),
|
||||
message_id: z.uuid(),
|
||||
})
|
||||
|
||||
export const zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisQuery = z.object({
|
||||
response_mode: z.enum(['blocking', 'streaming']),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zGetInstalledAppsByInstalledAppIdMessagesByMessageIdMoreLikeThisResponse
|
||||
= zGeneratedAppResponse
|
||||
|
||||
export const zGetInstalledAppsByInstalledAppIdMessagesByMessageIdSuggestedQuestionsPath = z.object({
|
||||
installed_app_id: z.uuid(),
|
||||
message_id: z.uuid(),
|
||||
@ -802,17 +707,6 @@ export const zPostInstalledAppsByInstalledAppIdTextToAudioPath = z.object({
|
||||
*/
|
||||
export const zPostInstalledAppsByInstalledAppIdTextToAudioResponse = zAudioBinaryResponse
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdWorkflowsRunBody = zWorkflowRunPayload
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdWorkflowsRunPath = z.object({
|
||||
installed_app_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostInstalledAppsByInstalledAppIdWorkflowsRunResponse = zGeneratedAppResponse
|
||||
|
||||
export const zPostInstalledAppsByInstalledAppIdWorkflowsTasksByTaskIdStopPath = z.object({
|
||||
installed_app_id: z.uuid(),
|
||||
task_id: z.string(),
|
||||
|
||||
@ -25,15 +25,33 @@ export type SimpleDataResponse = {
|
||||
}
|
||||
|
||||
export type ModelConfig = {
|
||||
completion_params?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
mode: LlmMode
|
||||
name: string
|
||||
provider: string
|
||||
agent_mode?: JsonValue | null
|
||||
annotation_reply?: JsonValue | null
|
||||
chat_prompt_config?: JsonValue | null
|
||||
completion_prompt_config?: JsonValue | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
dataset_configs?: JsonValue | null
|
||||
dataset_query_variable?: string | null
|
||||
external_data_tools?: JsonValue | null
|
||||
file_upload?: JsonValue | null
|
||||
model?: JsonValue | null
|
||||
more_like_this?: JsonValue | null
|
||||
opening_statement?: string | null
|
||||
pre_prompt?: string | null
|
||||
prompt_type?: string | null
|
||||
retriever_resource?: JsonValue | null
|
||||
sensitive_word_avoidance?: JsonValue | null
|
||||
speech_to_text?: JsonValue | null
|
||||
suggested_questions?: JsonValue | null
|
||||
suggested_questions_after_answer?: JsonValue | null
|
||||
text_to_speech?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
user_input_form?: JsonValue | null
|
||||
}
|
||||
|
||||
export type LlmMode = 'chat' | 'completion'
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type PostInstructionGenerateData = {
|
||||
body: InstructionGeneratePayload
|
||||
|
||||
@ -21,21 +21,36 @@ export const zSimpleDataResponse = z.object({
|
||||
data: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* LLMMode
|
||||
*
|
||||
* Enum class for large language model mode.
|
||||
*/
|
||||
export const zLlmMode = z.enum(['chat', 'completion'])
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* ModelConfig
|
||||
*/
|
||||
export const zModelConfig = z.object({
|
||||
completion_params: z.record(z.string(), z.unknown()).optional(),
|
||||
mode: zLlmMode,
|
||||
name: z.string(),
|
||||
provider: z.string(),
|
||||
agent_mode: zJsonValue.nullish(),
|
||||
annotation_reply: zJsonValue.nullish(),
|
||||
chat_prompt_config: zJsonValue.nullish(),
|
||||
completion_prompt_config: zJsonValue.nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
dataset_configs: zJsonValue.nullish(),
|
||||
dataset_query_variable: z.string().nullish(),
|
||||
external_data_tools: zJsonValue.nullish(),
|
||||
file_upload: zJsonValue.nullish(),
|
||||
model: zJsonValue.nullish(),
|
||||
more_like_this: zJsonValue.nullish(),
|
||||
opening_statement: z.string().nullish(),
|
||||
pre_prompt: z.string().nullish(),
|
||||
prompt_type: z.string().nullish(),
|
||||
retriever_resource: zJsonValue.nullish(),
|
||||
sensitive_word_avoidance: zJsonValue.nullish(),
|
||||
speech_to_text: zJsonValue.nullish(),
|
||||
suggested_questions: zJsonValue.nullish(),
|
||||
suggested_questions_after_answer: zJsonValue.nullish(),
|
||||
text_to_speech: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
user_input_form: zJsonValue.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@ -24,11 +24,6 @@ import {
|
||||
zGetRagPipelinesByPipelineIdWorkflowRunsPath,
|
||||
zGetRagPipelinesByPipelineIdWorkflowRunsQuery,
|
||||
zGetRagPipelinesByPipelineIdWorkflowRunsResponse,
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypePath,
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeQuery,
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponse,
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsPath,
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsResponse,
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesPath,
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesResponse,
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdLastRunPath,
|
||||
@ -93,35 +88,17 @@ import {
|
||||
zPostRagPipelinesByPipelineIdWorkflowsByWorkflowIdRestorePath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsByWorkflowIdRestoreResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceVariablesInspectBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceVariablesInspectPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceVariablesInspectResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdRunBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdRunPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdRunResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftRunBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftRunPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsDraftRunResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdPreviewBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdPreviewPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdPreviewResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedRunBody,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedRunPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishedRunResponse,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishPath,
|
||||
zPostRagPipelinesByPipelineIdWorkflowsPublishResponse,
|
||||
zPostRagPipelinesImportsBody,
|
||||
@ -506,87 +483,10 @@ export const workflowRuns = {
|
||||
byRunId,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default block config
|
||||
*/
|
||||
export const get10 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
operationId: 'getRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockType',
|
||||
path: '/rag/pipelines/{pipeline_id}/workflows/default-workflow-block-configs/{block_type}',
|
||||
summary: 'Get default block config',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
params: zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypePath,
|
||||
query:
|
||||
zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeQuery.optional(),
|
||||
}),
|
||||
)
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponse)
|
||||
|
||||
export const byBlockType = {
|
||||
get: get10,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default block config
|
||||
*/
|
||||
export const get11 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
operationId: 'getRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigs',
|
||||
path: '/rag/pipelines/{pipeline_id}/workflows/default-workflow-block-configs',
|
||||
summary: 'Get default block config',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(z.object({ params: zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsPath }))
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsResponse)
|
||||
|
||||
export const defaultWorkflowBlockConfigs = {
|
||||
get: get11,
|
||||
byBlockType,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run rag pipeline datasource
|
||||
*/
|
||||
export const post9 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRun',
|
||||
path: '/rag/pipelines/{pipeline_id}/workflows/draft/datasource/nodes/{node_id}/run',
|
||||
summary: 'Run rag pipeline datasource',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunBody,
|
||||
params: zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunResponse)
|
||||
|
||||
export const run = {
|
||||
post: post9,
|
||||
}
|
||||
|
||||
export const byNodeId = {
|
||||
run,
|
||||
}
|
||||
|
||||
export const nodes = {
|
||||
byNodeId,
|
||||
}
|
||||
|
||||
/**
|
||||
* Set datasource variables
|
||||
*/
|
||||
export const post10 = oc
|
||||
export const post9 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -604,18 +504,17 @@ export const post10 = oc
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceVariablesInspectResponse)
|
||||
|
||||
export const variablesInspect = {
|
||||
post: post10,
|
||||
post: post9,
|
||||
}
|
||||
|
||||
export const datasource = {
|
||||
nodes,
|
||||
variablesInspect,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get draft workflow
|
||||
*/
|
||||
export const get12 = oc
|
||||
export const get10 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -628,82 +527,10 @@ export const get12 = oc
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesResponse)
|
||||
|
||||
export const environmentVariables = {
|
||||
get: get12,
|
||||
get: get10,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run draft workflow iteration node
|
||||
*/
|
||||
export const post11 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRun',
|
||||
path: '/rag/pipelines/{pipeline_id}/workflows/draft/iteration/nodes/{node_id}/run',
|
||||
summary: 'Run draft workflow iteration node',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunBody,
|
||||
params: zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunResponse)
|
||||
|
||||
export const run2 = {
|
||||
post: post11,
|
||||
}
|
||||
|
||||
export const byNodeId2 = {
|
||||
run: run2,
|
||||
}
|
||||
|
||||
export const nodes2 = {
|
||||
byNodeId: byNodeId2,
|
||||
}
|
||||
|
||||
export const iteration = {
|
||||
nodes: nodes2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run draft workflow loop node
|
||||
*/
|
||||
export const post12 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRun',
|
||||
path: '/rag/pipelines/{pipeline_id}/workflows/draft/loop/nodes/{node_id}/run',
|
||||
summary: 'Run draft workflow loop node',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunBody,
|
||||
params: zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunResponse)
|
||||
|
||||
export const run3 = {
|
||||
post: post12,
|
||||
}
|
||||
|
||||
export const byNodeId3 = {
|
||||
run: run3,
|
||||
}
|
||||
|
||||
export const nodes3 = {
|
||||
byNodeId: byNodeId3,
|
||||
}
|
||||
|
||||
export const loop = {
|
||||
nodes: nodes3,
|
||||
}
|
||||
|
||||
export const get13 = oc
|
||||
export const get11 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -715,13 +542,13 @@ export const get13 = oc
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdLastRunResponse)
|
||||
|
||||
export const lastRun = {
|
||||
get: get13,
|
||||
get: get11,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run draft workflow node
|
||||
*/
|
||||
export const post13 = oc
|
||||
export const post10 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -738,8 +565,8 @@ export const post13 = oc
|
||||
)
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdRunResponse)
|
||||
|
||||
export const run4 = {
|
||||
post: post13,
|
||||
export const run = {
|
||||
post: post10,
|
||||
}
|
||||
|
||||
export const delete2 = oc
|
||||
@ -756,7 +583,7 @@ export const delete2 = oc
|
||||
)
|
||||
.output(zDeleteRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdVariablesResponse)
|
||||
|
||||
export const get14 = oc
|
||||
export const get12 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -769,23 +596,23 @@ export const get14 = oc
|
||||
|
||||
export const variables = {
|
||||
delete: delete2,
|
||||
get: get14,
|
||||
get: get12,
|
||||
}
|
||||
|
||||
export const byNodeId4 = {
|
||||
export const byNodeId = {
|
||||
lastRun,
|
||||
run: run4,
|
||||
run,
|
||||
variables,
|
||||
}
|
||||
|
||||
export const nodes4 = {
|
||||
byNodeId: byNodeId4,
|
||||
export const nodes = {
|
||||
byNodeId,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get first step parameters of rag pipeline
|
||||
*/
|
||||
export const get15 = oc
|
||||
export const get13 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -803,7 +630,7 @@ export const get15 = oc
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsDraftPreProcessingParametersResponse)
|
||||
|
||||
export const parameters = {
|
||||
get: get15,
|
||||
get: get13,
|
||||
}
|
||||
|
||||
export const preProcessing = {
|
||||
@ -813,7 +640,7 @@ export const preProcessing = {
|
||||
/**
|
||||
* Get second step parameters of rag pipeline
|
||||
*/
|
||||
export const get16 = oc
|
||||
export const get14 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -831,38 +658,14 @@ export const get16 = oc
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersResponse)
|
||||
|
||||
export const parameters2 = {
|
||||
get: get16,
|
||||
get: get14,
|
||||
}
|
||||
|
||||
export const processing = {
|
||||
parameters: parameters2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run draft workflow
|
||||
*/
|
||||
export const post14 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postRagPipelinesByPipelineIdWorkflowsDraftRun',
|
||||
path: '/rag/pipelines/{pipeline_id}/workflows/draft/run',
|
||||
summary: 'Run draft workflow',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostRagPipelinesByPipelineIdWorkflowsDraftRunBody,
|
||||
params: zPostRagPipelinesByPipelineIdWorkflowsDraftRunPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsDraftRunResponse)
|
||||
|
||||
export const run5 = {
|
||||
post: post14,
|
||||
}
|
||||
|
||||
export const get17 = oc
|
||||
export const get15 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -874,7 +677,7 @@ export const get17 = oc
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsDraftSystemVariablesResponse)
|
||||
|
||||
export const systemVariables = {
|
||||
get: get17,
|
||||
get: get15,
|
||||
}
|
||||
|
||||
export const put = oc
|
||||
@ -908,7 +711,7 @@ export const delete3 = oc
|
||||
)
|
||||
.output(zDeleteRagPipelinesByPipelineIdWorkflowsDraftVariablesByVariableIdResponse)
|
||||
|
||||
export const get18 = oc
|
||||
export const get16 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -937,7 +740,7 @@ export const patch2 = oc
|
||||
|
||||
export const byVariableId = {
|
||||
delete: delete3,
|
||||
get: get18,
|
||||
get: get16,
|
||||
patch: patch2,
|
||||
reset,
|
||||
}
|
||||
@ -957,7 +760,7 @@ export const delete4 = oc
|
||||
/**
|
||||
* Get draft workflow
|
||||
*/
|
||||
export const get19 = oc
|
||||
export const get17 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -976,14 +779,14 @@ export const get19 = oc
|
||||
|
||||
export const variables2 = {
|
||||
delete: delete4,
|
||||
get: get19,
|
||||
get: get17,
|
||||
byVariableId,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get draft rag pipeline's workflow
|
||||
*/
|
||||
export const get20 = oc
|
||||
export const get18 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -998,7 +801,7 @@ export const get20 = oc
|
||||
/**
|
||||
* Sync draft workflow
|
||||
*/
|
||||
export const post15 = oc
|
||||
export const post11 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -1016,16 +819,13 @@ export const post15 = oc
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsDraftResponse)
|
||||
|
||||
export const draft = {
|
||||
get: get20,
|
||||
post: post15,
|
||||
get: get18,
|
||||
post: post11,
|
||||
datasource,
|
||||
environmentVariables,
|
||||
iteration,
|
||||
loop,
|
||||
nodes: nodes4,
|
||||
nodes,
|
||||
preProcessing,
|
||||
processing,
|
||||
run: run5,
|
||||
systemVariables,
|
||||
variables: variables2,
|
||||
}
|
||||
@ -1033,7 +833,7 @@ export const draft = {
|
||||
/**
|
||||
* Get published pipeline
|
||||
*/
|
||||
export const get21 = oc
|
||||
export const get19 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -1048,7 +848,7 @@ export const get21 = oc
|
||||
/**
|
||||
* Publish workflow
|
||||
*/
|
||||
export const post16 = oc
|
||||
export const post12 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -1061,14 +861,14 @@ export const post16 = oc
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsPublishResponse)
|
||||
|
||||
export const publish2 = {
|
||||
get: get21,
|
||||
post: post16,
|
||||
get: get19,
|
||||
post: post12,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run datasource content preview
|
||||
*/
|
||||
export const post17 = oc
|
||||
export const post13 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -1086,50 +886,25 @@ export const post17 = oc
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdPreviewResponse)
|
||||
|
||||
export const preview = {
|
||||
post: post17,
|
||||
post: post13,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run rag pipeline datasource
|
||||
*/
|
||||
export const post18 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRun',
|
||||
path: '/rag/pipelines/{pipeline_id}/workflows/published/datasource/nodes/{node_id}/run',
|
||||
summary: 'Run rag pipeline datasource',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunBody,
|
||||
params: zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunResponse)
|
||||
|
||||
export const run6 = {
|
||||
post: post18,
|
||||
}
|
||||
|
||||
export const byNodeId5 = {
|
||||
export const byNodeId2 = {
|
||||
preview,
|
||||
run: run6,
|
||||
}
|
||||
|
||||
export const nodes5 = {
|
||||
byNodeId: byNodeId5,
|
||||
export const nodes2 = {
|
||||
byNodeId: byNodeId2,
|
||||
}
|
||||
|
||||
export const datasource2 = {
|
||||
nodes: nodes5,
|
||||
nodes: nodes2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get first step parameters of rag pipeline
|
||||
*/
|
||||
export const get22 = oc
|
||||
export const get20 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -1147,7 +922,7 @@ export const get22 = oc
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsPublishedPreProcessingParametersResponse)
|
||||
|
||||
export const parameters3 = {
|
||||
get: get22,
|
||||
get: get20,
|
||||
}
|
||||
|
||||
export const preProcessing2 = {
|
||||
@ -1157,7 +932,7 @@ export const preProcessing2 = {
|
||||
/**
|
||||
* Get second step parameters of rag pipeline
|
||||
*/
|
||||
export const get23 = oc
|
||||
export const get21 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -1175,45 +950,20 @@ export const get23 = oc
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersResponse)
|
||||
|
||||
export const parameters4 = {
|
||||
get: get23,
|
||||
get: get21,
|
||||
}
|
||||
|
||||
export const processing2 = {
|
||||
parameters: parameters4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run published workflow
|
||||
*/
|
||||
export const post19 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postRagPipelinesByPipelineIdWorkflowsPublishedRun',
|
||||
path: '/rag/pipelines/{pipeline_id}/workflows/published/run',
|
||||
summary: 'Run published workflow',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostRagPipelinesByPipelineIdWorkflowsPublishedRunBody,
|
||||
params: zPostRagPipelinesByPipelineIdWorkflowsPublishedRunPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsPublishedRunResponse)
|
||||
|
||||
export const run7 = {
|
||||
post: post19,
|
||||
}
|
||||
|
||||
export const published = {
|
||||
datasource: datasource2,
|
||||
preProcessing: preProcessing2,
|
||||
processing: processing2,
|
||||
run: run7,
|
||||
}
|
||||
|
||||
export const post20 = oc
|
||||
export const post14 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -1225,7 +975,7 @@ export const post20 = oc
|
||||
.output(zPostRagPipelinesByPipelineIdWorkflowsByWorkflowIdRestoreResponse)
|
||||
|
||||
export const restore = {
|
||||
post: post20,
|
||||
post: post14,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1273,7 +1023,7 @@ export const byWorkflowId = {
|
||||
/**
|
||||
* Get published workflows
|
||||
*/
|
||||
export const get24 = oc
|
||||
export const get22 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -1291,8 +1041,7 @@ export const get24 = oc
|
||||
.output(zGetRagPipelinesByPipelineIdWorkflowsResponse)
|
||||
|
||||
export const workflows = {
|
||||
get: get24,
|
||||
defaultWorkflowBlockConfigs,
|
||||
get: get22,
|
||||
draft,
|
||||
publish: publish2,
|
||||
published,
|
||||
|
||||
@ -89,7 +89,7 @@ export type PipelineTemplateDetailResponse = {
|
||||
name: string
|
||||
}
|
||||
|
||||
export type RagPipelineOpaqueResponse = unknown
|
||||
export type DatasourcePluginListResponse = Array<PluginDatasourceProviderEntity>
|
||||
|
||||
export type RagPipelineImportPayload = {
|
||||
description?: string | null
|
||||
@ -107,6 +107,21 @@ export type RagPipelineImportCheckDependenciesResponse = {
|
||||
leaked_dependencies?: Array<PluginDependency>
|
||||
}
|
||||
|
||||
export type RagPipelineRecommendedPluginResponse = {
|
||||
installed_recommended_plugins: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
uninstalled_recommended_plugins: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
}
|
||||
|
||||
export type RagPipelineTransformResponse = {
|
||||
dataset_id: string
|
||||
pipeline_id: string
|
||||
status: string
|
||||
}
|
||||
|
||||
export type WorkflowRunPaginationResponse = {
|
||||
data: Array<WorkflowRunForListResponse>
|
||||
has_more: boolean
|
||||
@ -119,7 +134,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
|
||||
@ -147,18 +162,10 @@ export type WorkflowPaginationResponse = {
|
||||
page: number
|
||||
}
|
||||
|
||||
export type DefaultBlockConfigsResponse = Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
|
||||
export type DefaultBlockConfigResponse = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
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 +180,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
|
||||
}
|
||||
|
||||
@ -202,14 +209,6 @@ export type RagPipelineWorkflowSyncResponse = {
|
||||
updated_at: number
|
||||
}
|
||||
|
||||
export type DatasourceNodeRunPayload = {
|
||||
credential_id?: string | null
|
||||
datasource_type: string
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type DatasourceVariablesPayload = {
|
||||
datasource_info: {
|
||||
[key: string]: unknown
|
||||
@ -221,7 +220,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
|
||||
@ -248,12 +247,6 @@ export type EnvironmentVariableListResponse = {
|
||||
items: Array<EnvironmentVariableItemResponse>
|
||||
}
|
||||
|
||||
export type NodeRunPayload = {
|
||||
inputs?: {
|
||||
[key: string]: unknown
|
||||
} | null
|
||||
}
|
||||
|
||||
export type NodeRunRequiredPayload = {
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
@ -264,21 +257,10 @@ export type WorkflowDraftVariableList = {
|
||||
items?: Array<WorkflowDraftVariable>
|
||||
}
|
||||
|
||||
export type RagPipelineStepParametersResponse = {
|
||||
export type RagPipelineVariablesResponse = {
|
||||
variables: unknown
|
||||
}
|
||||
|
||||
export type DraftWorkflowRunPayload = {
|
||||
datasource_info_list: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
datasource_type: string
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
start_node_id: string
|
||||
}
|
||||
|
||||
export type WorkflowDraftVariableListWithoutValue = {
|
||||
items?: Array<WorkflowDraftVariableWithoutValue>
|
||||
total?: number
|
||||
@ -329,20 +311,6 @@ export type Parser = {
|
||||
|
||||
export type DataSourceContentPreviewResponse = unknown
|
||||
|
||||
export type PublishedWorkflowRunPayload = {
|
||||
datasource_info_list: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
datasource_type: string
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
is_preview?: boolean
|
||||
original_document_id?: string | null
|
||||
response_mode?: 'blocking' | 'streaming'
|
||||
start_node_id: string
|
||||
}
|
||||
|
||||
export type WorkflowUpdatePayload = {
|
||||
marked_comment?: string | null
|
||||
marked_name?: string | null
|
||||
@ -413,6 +381,14 @@ export type PipelineTemplateItemResponse = {
|
||||
privacy_policy?: string | null
|
||||
}
|
||||
|
||||
export type PluginDatasourceProviderEntity = {
|
||||
declaration: DatasourceProviderEntityWithPlugin
|
||||
is_authorized?: boolean
|
||||
plugin_id: string
|
||||
plugin_unique_identifier: string
|
||||
provider: string
|
||||
}
|
||||
|
||||
export type PluginDependency = {
|
||||
current_identifier?: string | null
|
||||
type: Type
|
||||
@ -421,7 +397,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 +409,7 @@ export type WorkflowRunForListResponse = {
|
||||
version?: string | null
|
||||
}
|
||||
|
||||
export type SimpleAccount = {
|
||||
export type SimpleAccountResponse = {
|
||||
email: string
|
||||
id: string
|
||||
name: string
|
||||
@ -515,6 +491,14 @@ export type DatasetWeightedScoreResponse = {
|
||||
weight_type?: string | null
|
||||
}
|
||||
|
||||
export type DatasourceProviderEntityWithPlugin = {
|
||||
credentials_schema?: Array<ProviderConfig>
|
||||
datasources?: Array<DatasourceEntity>
|
||||
identity: DatasourceProviderIdentity
|
||||
oauth_schema?: OAuthSchema | null
|
||||
provider_type: DatasourceProviderType
|
||||
}
|
||||
|
||||
export type Type = 'github' | 'marketplace' | 'package'
|
||||
|
||||
export type Github = {
|
||||
@ -544,6 +528,162 @@ export type DatasetVectorSettingResponse = {
|
||||
vector_weight?: number | null
|
||||
}
|
||||
|
||||
export type ProviderConfig = {
|
||||
default?: number | string | number | boolean | null
|
||||
help?: I18nObject | null
|
||||
label?: I18nObject | null
|
||||
multiple?: boolean
|
||||
name: string
|
||||
options?: Array<Option> | null
|
||||
placeholder?: I18nObject | null
|
||||
required?: boolean
|
||||
scope?: AppSelectorScope | ModelSelectorScope | ToolSelectorScope | null
|
||||
type: CoreEntitiesProviderEntitiesBasicProviderConfigType
|
||||
url?: string | null
|
||||
}
|
||||
|
||||
export type DatasourceEntity = {
|
||||
description: I18nObject
|
||||
identity: DatasourceIdentity
|
||||
output_schema?: {
|
||||
[key: string]: unknown
|
||||
} | null
|
||||
parameters?: Array<DatasourceParameter>
|
||||
}
|
||||
|
||||
export type DatasourceProviderIdentity = {
|
||||
author: string
|
||||
description: I18nObject
|
||||
icon: string
|
||||
label: I18nObject
|
||||
name: string
|
||||
tags?: Array<ToolLabelEnum> | null
|
||||
}
|
||||
|
||||
export type OAuthSchema = {
|
||||
client_schema?: Array<ProviderConfig>
|
||||
credentials_schema?: Array<ProviderConfig>
|
||||
}
|
||||
|
||||
export type DatasourceProviderType
|
||||
= | 'local_file'
|
||||
| 'online_document'
|
||||
| 'online_drive'
|
||||
| 'website_crawl'
|
||||
|
||||
export type I18nObject = {
|
||||
en_US: string
|
||||
ja_JP?: string | null
|
||||
pt_BR?: string | null
|
||||
zh_Hans?: string | null
|
||||
}
|
||||
|
||||
export type Option = {
|
||||
label: I18nObject
|
||||
value: string
|
||||
}
|
||||
|
||||
export type AppSelectorScope = 'all' | 'chat' | 'completion' | 'workflow'
|
||||
|
||||
export type ModelSelectorScope
|
||||
= | 'llm'
|
||||
| 'moderation'
|
||||
| 'rerank'
|
||||
| 'speech2text'
|
||||
| 'text-embedding'
|
||||
| 'tts'
|
||||
| 'vision'
|
||||
|
||||
export type ToolSelectorScope = 'all' | 'builtin' | 'custom' | 'workflow'
|
||||
|
||||
export type CoreEntitiesProviderEntitiesBasicProviderConfigType
|
||||
= | 'app-selector'
|
||||
| 'array[tools]'
|
||||
| 'boolean'
|
||||
| 'model-selector'
|
||||
| 'secret-input'
|
||||
| 'select'
|
||||
| 'text-input'
|
||||
|
||||
export type DatasourceIdentity = {
|
||||
author: string
|
||||
icon?: string | null
|
||||
label: I18nObject
|
||||
name: string
|
||||
provider: string
|
||||
}
|
||||
|
||||
export type DatasourceParameter = {
|
||||
auto_generate?: PluginParameterAutoGenerate | null
|
||||
default?:
|
||||
| number
|
||||
| number
|
||||
| string
|
||||
| boolean
|
||||
| Array<unknown>
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| null
|
||||
description: I18nObject
|
||||
label: I18nObject
|
||||
max?: number | number | null
|
||||
min?: number | number | null
|
||||
name: string
|
||||
options?: Array<PluginParameterOption>
|
||||
placeholder?: I18nObject | null
|
||||
precision?: number | null
|
||||
required?: boolean
|
||||
scope?: string | null
|
||||
template?: PluginParameterTemplate | null
|
||||
type: DatasourceParameterType
|
||||
}
|
||||
|
||||
export type ToolLabelEnum
|
||||
= | 'business'
|
||||
| 'design'
|
||||
| 'education'
|
||||
| 'entertainment'
|
||||
| 'finance'
|
||||
| 'image'
|
||||
| 'medical'
|
||||
| 'news'
|
||||
| 'other'
|
||||
| 'productivity'
|
||||
| 'rag'
|
||||
| 'search'
|
||||
| 'social'
|
||||
| 'travel'
|
||||
| 'utilities'
|
||||
| 'videos'
|
||||
| 'weather'
|
||||
|
||||
export type PluginParameterAutoGenerate = {
|
||||
type: CorePluginEntitiesParametersPluginParameterAutoGenerateType
|
||||
}
|
||||
|
||||
export type PluginParameterOption = {
|
||||
icon?: string | null
|
||||
label: I18nObject
|
||||
value: string
|
||||
}
|
||||
|
||||
export type PluginParameterTemplate = {
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
export type DatasourceParameterType
|
||||
= | 'boolean'
|
||||
| 'file'
|
||||
| 'files'
|
||||
| 'number'
|
||||
| 'secret-input'
|
||||
| 'select'
|
||||
| 'string'
|
||||
| 'system-files'
|
||||
|
||||
export type CorePluginEntitiesParametersPluginParameterAutoGenerateType = 'prompt_instruction'
|
||||
|
||||
export type DeleteRagPipelineCustomizedTemplatesByTemplateIdData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -663,7 +803,7 @@ export type GetRagPipelinesDatasourcePluginsData = {
|
||||
}
|
||||
|
||||
export type GetRagPipelinesDatasourcePluginsResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
200: DatasourcePluginListResponse
|
||||
}
|
||||
|
||||
export type GetRagPipelinesDatasourcePluginsResponse
|
||||
@ -740,7 +880,7 @@ export type GetRagPipelinesRecommendedPluginsData = {
|
||||
}
|
||||
|
||||
export type GetRagPipelinesRecommendedPluginsResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
200: RagPipelineRecommendedPluginResponse
|
||||
}
|
||||
|
||||
export type GetRagPipelinesRecommendedPluginsResponse
|
||||
@ -756,7 +896,7 @@ export type PostRagPipelinesTransformDatasetsByDatasetIdData = {
|
||||
}
|
||||
|
||||
export type PostRagPipelinesTransformDatasetsByDatasetIdResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
200: RagPipelineTransformResponse
|
||||
}
|
||||
|
||||
export type PostRagPipelinesTransformDatasetsByDatasetIdResponse
|
||||
@ -891,41 +1031,6 @@ export type GetRagPipelinesByPipelineIdWorkflowsResponses = {
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsResponse
|
||||
= GetRagPipelinesByPipelineIdWorkflowsResponses[keyof GetRagPipelinesByPipelineIdWorkflowsResponses]
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsData = {
|
||||
body?: never
|
||||
path: {
|
||||
pipeline_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/rag/pipelines/{pipeline_id}/workflows/default-workflow-block-configs'
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsResponses = {
|
||||
200: DefaultBlockConfigsResponse
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsResponse
|
||||
= GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsResponses[keyof GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsResponses]
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeData = {
|
||||
body?: never
|
||||
path: {
|
||||
block_type: string
|
||||
pipeline_id: string
|
||||
}
|
||||
query?: {
|
||||
q?: string
|
||||
}
|
||||
url: '/rag/pipelines/{pipeline_id}/workflows/default-workflow-block-configs/{block_type}'
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponses = {
|
||||
200: DefaultBlockConfigResponse
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponse
|
||||
= GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponses[keyof GetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponses]
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDraftData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -962,23 +1067,6 @@ export type PostRagPipelinesByPipelineIdWorkflowsDraftResponses = {
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftResponse
|
||||
= PostRagPipelinesByPipelineIdWorkflowsDraftResponses[keyof PostRagPipelinesByPipelineIdWorkflowsDraftResponses]
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunData = {
|
||||
body: DatasourceNodeRunPayload
|
||||
path: {
|
||||
node_id: string
|
||||
pipeline_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/rag/pipelines/{pipeline_id}/workflows/draft/datasource/nodes/{node_id}/run'
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunResponse
|
||||
= PostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunResponses[keyof PostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunResponses]
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftDatasourceVariablesInspectData = {
|
||||
body: DatasourceVariablesPayload
|
||||
path: {
|
||||
@ -1011,40 +1099,6 @@ export type GetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesRespons
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesResponse
|
||||
= GetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesResponses[keyof GetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesResponses]
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunData = {
|
||||
body: NodeRunPayload
|
||||
path: {
|
||||
node_id: string
|
||||
pipeline_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/rag/pipelines/{pipeline_id}/workflows/draft/iteration/nodes/{node_id}/run'
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunResponse
|
||||
= PostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunResponses[keyof PostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunResponses]
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunData = {
|
||||
body: NodeRunPayload
|
||||
path: {
|
||||
node_id: string
|
||||
pipeline_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/rag/pipelines/{pipeline_id}/workflows/draft/loop/nodes/{node_id}/run'
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunResponse
|
||||
= PostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunResponses[keyof PostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunResponses]
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdLastRunData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -1125,7 +1179,7 @@ export type GetRagPipelinesByPipelineIdWorkflowsDraftPreProcessingParametersData
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDraftPreProcessingParametersResponses = {
|
||||
200: RagPipelineStepParametersResponse
|
||||
200: RagPipelineVariablesResponse
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDraftPreProcessingParametersResponse
|
||||
@ -1143,28 +1197,12 @@ export type GetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersData =
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersResponses = {
|
||||
200: RagPipelineStepParametersResponse
|
||||
200: RagPipelineVariablesResponse
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersResponse
|
||||
= GetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersResponses[keyof GetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersResponses]
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftRunData = {
|
||||
body: DraftWorkflowRunPayload
|
||||
path: {
|
||||
pipeline_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/rag/pipelines/{pipeline_id}/workflows/draft/run'
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftRunResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsDraftRunResponse
|
||||
= PostRagPipelinesByPipelineIdWorkflowsDraftRunResponses[keyof PostRagPipelinesByPipelineIdWorkflowsDraftRunResponses]
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsDraftSystemVariablesData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -1335,23 +1373,6 @@ export type PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeI
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdPreviewResponse
|
||||
= PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdPreviewResponses[keyof PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdPreviewResponses]
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunData = {
|
||||
body: DatasourceNodeRunPayload
|
||||
path: {
|
||||
node_id: string
|
||||
pipeline_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/rag/pipelines/{pipeline_id}/workflows/published/datasource/nodes/{node_id}/run'
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunResponse
|
||||
= PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunResponses[keyof PostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunResponses]
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsPublishedPreProcessingParametersData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -1364,7 +1385,7 @@ export type GetRagPipelinesByPipelineIdWorkflowsPublishedPreProcessingParameters
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsPublishedPreProcessingParametersResponses = {
|
||||
200: RagPipelineStepParametersResponse
|
||||
200: RagPipelineVariablesResponse
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsPublishedPreProcessingParametersResponse
|
||||
@ -1382,28 +1403,12 @@ export type GetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersDat
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersResponses = {
|
||||
200: RagPipelineStepParametersResponse
|
||||
200: RagPipelineVariablesResponse
|
||||
}
|
||||
|
||||
export type GetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersResponse
|
||||
= GetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersResponses[keyof GetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersResponses]
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsPublishedRunData = {
|
||||
body: PublishedWorkflowRunPayload
|
||||
path: {
|
||||
pipeline_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/rag/pipelines/{pipeline_id}/workflows/published/run'
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsPublishedRunResponses = {
|
||||
200: RagPipelineOpaqueResponse
|
||||
}
|
||||
|
||||
export type PostRagPipelinesByPipelineIdWorkflowsPublishedRunResponse
|
||||
= PostRagPipelinesByPipelineIdWorkflowsPublishedRunResponses[keyof PostRagPipelinesByPipelineIdWorkflowsPublishedRunResponses]
|
||||
|
||||
export type DeleteRagPipelinesByPipelineIdWorkflowsByWorkflowIdData = {
|
||||
body?: never
|
||||
path: {
|
||||
|
||||
@ -39,11 +39,6 @@ export const zPipelineTemplateDetailResponse = z.object({
|
||||
name: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* RagPipelineOpaqueResponse
|
||||
*/
|
||||
export const zRagPipelineOpaqueResponse = z.unknown()
|
||||
|
||||
/**
|
||||
* RagPipelineImportPayload
|
||||
*/
|
||||
@ -59,6 +54,23 @@ export const zRagPipelineImportPayload = z.object({
|
||||
yaml_url: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* RagPipelineRecommendedPluginResponse
|
||||
*/
|
||||
export const zRagPipelineRecommendedPluginResponse = z.object({
|
||||
installed_recommended_plugins: z.array(z.record(z.string(), z.unknown())),
|
||||
uninstalled_recommended_plugins: z.array(z.record(z.string(), z.unknown())),
|
||||
})
|
||||
|
||||
/**
|
||||
* RagPipelineTransformResponse
|
||||
*/
|
||||
export const zRagPipelineTransformResponse = z.object({
|
||||
dataset_id: z.string(),
|
||||
pipeline_id: z.string(),
|
||||
status: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* SimpleResultResponse
|
||||
*/
|
||||
@ -66,16 +78,6 @@ export const zSimpleResultResponse = z.object({
|
||||
result: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DefaultBlockConfigsResponse
|
||||
*/
|
||||
export const zDefaultBlockConfigsResponse = z.array(z.record(z.string(), z.unknown()))
|
||||
|
||||
/**
|
||||
* DefaultBlockConfigResponse
|
||||
*/
|
||||
export const zDefaultBlockConfigResponse = z.record(z.string(), z.unknown())
|
||||
|
||||
/**
|
||||
* DraftWorkflowSyncPayload
|
||||
*/
|
||||
@ -97,15 +99,6 @@ export const zRagPipelineWorkflowSyncResponse = z.object({
|
||||
updated_at: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourceNodeRunPayload
|
||||
*/
|
||||
export const zDatasourceNodeRunPayload = z.object({
|
||||
credential_id: z.string().nullish(),
|
||||
datasource_type: z.string(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourceVariablesPayload
|
||||
*/
|
||||
@ -116,13 +109,6 @@ export const zDatasourceVariablesPayload = z.object({
|
||||
start_node_title: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* NodeRunPayload
|
||||
*/
|
||||
export const zNodeRunPayload = z.object({
|
||||
inputs: z.record(z.string(), z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* NodeRunRequiredPayload
|
||||
*/
|
||||
@ -131,22 +117,12 @@ export const zNodeRunRequiredPayload = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* RagPipelineStepParametersResponse
|
||||
* RagPipelineVariablesResponse
|
||||
*/
|
||||
export const zRagPipelineStepParametersResponse = z.object({
|
||||
export const zRagPipelineVariablesResponse = z.object({
|
||||
variables: z.unknown(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DraftWorkflowRunPayload
|
||||
*/
|
||||
export const zDraftWorkflowRunPayload = z.object({
|
||||
datasource_info_list: z.array(z.record(z.string(), z.unknown())),
|
||||
datasource_type: z.string(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
start_node_id: z.string(),
|
||||
})
|
||||
|
||||
export const zWorkflowDraftVariable = z.object({
|
||||
description: z.string().optional(),
|
||||
edited: z.boolean().optional(),
|
||||
@ -204,19 +180,6 @@ export const zParser = z.object({
|
||||
*/
|
||||
export const zDataSourceContentPreviewResponse = z.unknown()
|
||||
|
||||
/**
|
||||
* PublishedWorkflowRunPayload
|
||||
*/
|
||||
export const zPublishedWorkflowRunPayload = z.object({
|
||||
datasource_info_list: z.array(z.record(z.string(), z.unknown())),
|
||||
datasource_type: z.string(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
is_preview: z.boolean().optional().default(false),
|
||||
original_document_id: z.string().nullish(),
|
||||
response_mode: z.enum(['blocking', 'streaming']).optional().default('streaming'),
|
||||
start_node_id: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* WorkflowUpdatePayload
|
||||
*/
|
||||
@ -322,9 +285,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 +298,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 +334,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 +356,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 +434,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 +445,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(),
|
||||
})
|
||||
|
||||
@ -673,6 +636,263 @@ export const zDatasetDetailResponse = z.object({
|
||||
word_count: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourceProviderType
|
||||
*
|
||||
* Enum class for datasource provider
|
||||
*/
|
||||
export const zDatasourceProviderType = z.enum([
|
||||
'local_file',
|
||||
'online_document',
|
||||
'online_drive',
|
||||
'website_crawl',
|
||||
])
|
||||
|
||||
/**
|
||||
* I18nObject
|
||||
*
|
||||
* Model class for i18n object.
|
||||
*/
|
||||
export const zI18nObject = z.object({
|
||||
en_US: z.string(),
|
||||
ja_JP: z.string().nullish(),
|
||||
pt_BR: z.string().nullish(),
|
||||
zh_Hans: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Option
|
||||
*/
|
||||
export const zOption = z.object({
|
||||
label: zI18nObject,
|
||||
value: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* AppSelectorScope
|
||||
*/
|
||||
export const zAppSelectorScope = z.enum(['all', 'chat', 'completion', 'workflow'])
|
||||
|
||||
/**
|
||||
* ModelSelectorScope
|
||||
*/
|
||||
export const zModelSelectorScope = z.enum([
|
||||
'llm',
|
||||
'moderation',
|
||||
'rerank',
|
||||
'speech2text',
|
||||
'text-embedding',
|
||||
'tts',
|
||||
'vision',
|
||||
])
|
||||
|
||||
/**
|
||||
* ToolSelectorScope
|
||||
*/
|
||||
export const zToolSelectorScope = z.enum(['all', 'builtin', 'custom', 'workflow'])
|
||||
|
||||
/**
|
||||
* Type
|
||||
*/
|
||||
export const zCoreEntitiesProviderEntitiesBasicProviderConfigType = z.enum([
|
||||
'app-selector',
|
||||
'array[tools]',
|
||||
'boolean',
|
||||
'model-selector',
|
||||
'secret-input',
|
||||
'select',
|
||||
'text-input',
|
||||
])
|
||||
|
||||
/**
|
||||
* ProviderConfig
|
||||
*
|
||||
* Model class for common provider settings like credentials
|
||||
*/
|
||||
export const zProviderConfig = z.object({
|
||||
default: z.union([z.int(), z.string(), z.number(), z.boolean()]).nullish(),
|
||||
help: zI18nObject.nullish(),
|
||||
label: zI18nObject.nullish(),
|
||||
multiple: z.boolean().optional().default(false),
|
||||
name: z.string(),
|
||||
options: z.array(zOption).nullish(),
|
||||
placeholder: zI18nObject.nullish(),
|
||||
required: z.boolean().optional().default(false),
|
||||
scope: z.union([zAppSelectorScope, zModelSelectorScope, zToolSelectorScope]).nullish(),
|
||||
type: zCoreEntitiesProviderEntitiesBasicProviderConfigType,
|
||||
url: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* OAuthSchema
|
||||
*
|
||||
* OAuth schema
|
||||
*/
|
||||
export const zOAuthSchema = z.object({
|
||||
client_schema: z.array(zProviderConfig).optional(),
|
||||
credentials_schema: z.array(zProviderConfig).optional(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourceIdentity
|
||||
*/
|
||||
export const zDatasourceIdentity = z.object({
|
||||
author: z.string(),
|
||||
icon: z.string().nullish(),
|
||||
label: zI18nObject,
|
||||
name: z.string(),
|
||||
provider: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ToolLabelEnum
|
||||
*/
|
||||
export const zToolLabelEnum = z.enum([
|
||||
'business',
|
||||
'design',
|
||||
'education',
|
||||
'entertainment',
|
||||
'finance',
|
||||
'image',
|
||||
'medical',
|
||||
'news',
|
||||
'other',
|
||||
'productivity',
|
||||
'rag',
|
||||
'search',
|
||||
'social',
|
||||
'travel',
|
||||
'utilities',
|
||||
'videos',
|
||||
'weather',
|
||||
])
|
||||
|
||||
/**
|
||||
* DatasourceProviderIdentity
|
||||
*/
|
||||
export const zDatasourceProviderIdentity = z.object({
|
||||
author: z.string(),
|
||||
description: zI18nObject,
|
||||
icon: z.string(),
|
||||
label: zI18nObject,
|
||||
name: z.string(),
|
||||
tags: z.array(zToolLabelEnum).nullish().default([]),
|
||||
})
|
||||
|
||||
/**
|
||||
* PluginParameterOption
|
||||
*/
|
||||
export const zPluginParameterOption = z.object({
|
||||
icon: z.string().nullish(),
|
||||
label: zI18nObject,
|
||||
value: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* PluginParameterTemplate
|
||||
*/
|
||||
export const zPluginParameterTemplate = z.object({
|
||||
enabled: z.boolean().optional().default(false),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourceParameterType
|
||||
*
|
||||
* removes TOOLS_SELECTOR from PluginParameterType
|
||||
*/
|
||||
export const zDatasourceParameterType = z.enum([
|
||||
'boolean',
|
||||
'file',
|
||||
'files',
|
||||
'number',
|
||||
'secret-input',
|
||||
'select',
|
||||
'string',
|
||||
'system-files',
|
||||
])
|
||||
|
||||
/**
|
||||
* Type
|
||||
*/
|
||||
export const zCorePluginEntitiesParametersPluginParameterAutoGenerateType = z.enum([
|
||||
'prompt_instruction',
|
||||
])
|
||||
|
||||
/**
|
||||
* PluginParameterAutoGenerate
|
||||
*/
|
||||
export const zPluginParameterAutoGenerate = z.object({
|
||||
type: zCorePluginEntitiesParametersPluginParameterAutoGenerateType,
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourceParameter
|
||||
*
|
||||
* Overrides type
|
||||
*/
|
||||
export const zDatasourceParameter = z.object({
|
||||
auto_generate: zPluginParameterAutoGenerate.nullish(),
|
||||
default: z
|
||||
.union([
|
||||
z.number(),
|
||||
z.int(),
|
||||
z.string(),
|
||||
z.boolean(),
|
||||
z.array(z.unknown()),
|
||||
z.record(z.string(), z.unknown()),
|
||||
])
|
||||
.nullish(),
|
||||
description: zI18nObject,
|
||||
label: zI18nObject,
|
||||
max: z.union([z.number(), z.int()]).nullish(),
|
||||
min: z.union([z.number(), z.int()]).nullish(),
|
||||
name: z.string(),
|
||||
options: z.array(zPluginParameterOption).optional(),
|
||||
placeholder: zI18nObject.nullish(),
|
||||
precision: z.int().nullish(),
|
||||
required: z.boolean().optional().default(false),
|
||||
scope: z.string().nullish(),
|
||||
template: zPluginParameterTemplate.nullish(),
|
||||
type: zDatasourceParameterType,
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourceEntity
|
||||
*/
|
||||
export const zDatasourceEntity = z.object({
|
||||
description: zI18nObject,
|
||||
identity: zDatasourceIdentity,
|
||||
output_schema: z.record(z.string(), z.unknown()).nullish(),
|
||||
parameters: z.array(zDatasourceParameter).optional(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourceProviderEntityWithPlugin
|
||||
*/
|
||||
export const zDatasourceProviderEntityWithPlugin = z.object({
|
||||
credentials_schema: z.array(zProviderConfig).optional(),
|
||||
datasources: z.array(zDatasourceEntity).optional(),
|
||||
identity: zDatasourceProviderIdentity,
|
||||
oauth_schema: zOAuthSchema.nullish(),
|
||||
provider_type: zDatasourceProviderType,
|
||||
})
|
||||
|
||||
/**
|
||||
* PluginDatasourceProviderEntity
|
||||
*/
|
||||
export const zPluginDatasourceProviderEntity = z.object({
|
||||
declaration: zDatasourceProviderEntityWithPlugin,
|
||||
is_authorized: z.boolean().optional().default(false),
|
||||
plugin_id: z.string(),
|
||||
plugin_unique_identifier: z.string(),
|
||||
provider: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasourcePluginListResponse
|
||||
*/
|
||||
export const zDatasourcePluginListResponse = z.array(zPluginDatasourceProviderEntity)
|
||||
|
||||
export const zDeleteRagPipelineCustomizedTemplatesByTemplateIdPath = z.object({
|
||||
template_id: z.string(),
|
||||
})
|
||||
@ -739,9 +959,9 @@ export const zGetRagPipelineTemplatesByTemplateIdQuery = z.object({
|
||||
export const zGetRagPipelineTemplatesByTemplateIdResponse = zPipelineTemplateDetailResponse
|
||||
|
||||
/**
|
||||
* Success
|
||||
* Datasource plugins retrieved successfully
|
||||
*/
|
||||
export const zGetRagPipelinesDatasourcePluginsResponse = zRagPipelineOpaqueResponse
|
||||
export const zGetRagPipelinesDatasourcePluginsResponse = zDatasourcePluginListResponse
|
||||
|
||||
export const zPostRagPipelinesImportsBody = zRagPipelineImportPayload
|
||||
|
||||
@ -774,18 +994,18 @@ export const zGetRagPipelinesRecommendedPluginsQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
* Recommended plugins retrieved successfully
|
||||
*/
|
||||
export const zGetRagPipelinesRecommendedPluginsResponse = zRagPipelineOpaqueResponse
|
||||
export const zGetRagPipelinesRecommendedPluginsResponse = zRagPipelineRecommendedPluginResponse
|
||||
|
||||
export const zPostRagPipelinesTransformDatasetsByDatasetIdPath = z.object({
|
||||
dataset_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
* Dataset transformed successfully
|
||||
*/
|
||||
export const zPostRagPipelinesTransformDatasetsByDatasetIdResponse = zRagPipelineOpaqueResponse
|
||||
export const zPostRagPipelinesTransformDatasetsByDatasetIdResponse = zRagPipelineTransformResponse
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdCustomizedPublishBody = zCustomizedPipelineTemplatePayload
|
||||
|
||||
@ -873,33 +1093,6 @@ export const zGetRagPipelinesByPipelineIdWorkflowsQuery = z.object({
|
||||
*/
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsResponse = zWorkflowPaginationResponse
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Default block configs retrieved successfully
|
||||
*/
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsResponse
|
||||
= zDefaultBlockConfigsResponse
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypePath
|
||||
= z.object({
|
||||
block_type: z.string(),
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeQuery
|
||||
= z.object({
|
||||
q: z.string().optional(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Default block config retrieved successfully
|
||||
*/
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDefaultWorkflowBlockConfigsByBlockTypeResponse
|
||||
= zDefaultBlockConfigResponse
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDraftPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
@ -920,20 +1113,6 @@ export const zPostRagPipelinesByPipelineIdWorkflowsDraftPath = z.object({
|
||||
*/
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftResponse = zRagPipelineWorkflowSyncResponse
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunBody
|
||||
= zDatasourceNodeRunPayload
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunPath = z.object({
|
||||
node_id: z.string(),
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceNodesByNodeIdRunResponse
|
||||
= zRagPipelineOpaqueResponse
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftDatasourceVariablesInspectBody
|
||||
= zDatasourceVariablesPayload
|
||||
|
||||
@ -957,33 +1136,6 @@ export const zGetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesPath
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDraftEnvironmentVariablesResponse
|
||||
= zEnvironmentVariableListResponse
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunBody
|
||||
= zNodeRunPayload
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunPath = z.object({
|
||||
node_id: z.string(),
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftIterationNodesByNodeIdRunResponse
|
||||
= zRagPipelineOpaqueResponse
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunBody = zNodeRunPayload
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunPath = z.object({
|
||||
node_id: z.string(),
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftLoopNodesByNodeIdRunResponse
|
||||
= zRagPipelineOpaqueResponse
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDraftNodesByNodeIdLastRunPath = z.object({
|
||||
node_id: z.string(),
|
||||
pipeline_id: z.uuid(),
|
||||
@ -1039,10 +1191,10 @@ export const zGetRagPipelinesByPipelineIdWorkflowsDraftPreProcessingParametersQu
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
* First step parameters retrieved successfully
|
||||
*/
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDraftPreProcessingParametersResponse
|
||||
= zRagPipelineStepParametersResponse
|
||||
= zRagPipelineVariablesResponse
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
@ -1053,21 +1205,10 @@ export const zGetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersQuery
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
* Second step parameters retrieved successfully
|
||||
*/
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDraftProcessingParametersResponse
|
||||
= zRagPipelineStepParametersResponse
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftRunBody = zDraftWorkflowRunPayload
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftRunPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsDraftRunResponse = zRagPipelineOpaqueResponse
|
||||
= zRagPipelineVariablesResponse
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsDraftSystemVariablesPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
@ -1181,21 +1322,6 @@ export const zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNod
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdPreviewResponse
|
||||
= zDataSourceContentPreviewResponse
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunBody
|
||||
= zDatasourceNodeRunPayload
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunPath
|
||||
= z.object({
|
||||
node_id: z.string(),
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsPublishedDatasourceNodesByNodeIdRunResponse
|
||||
= zRagPipelineOpaqueResponse
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsPublishedPreProcessingParametersPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
@ -1205,10 +1331,10 @@ export const zGetRagPipelinesByPipelineIdWorkflowsPublishedPreProcessingParamete
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
* First step parameters retrieved successfully
|
||||
*/
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsPublishedPreProcessingParametersResponse
|
||||
= zRagPipelineStepParametersResponse
|
||||
= zRagPipelineVariablesResponse
|
||||
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
@ -1219,21 +1345,10 @@ export const zGetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersQ
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
* Second step parameters retrieved successfully
|
||||
*/
|
||||
export const zGetRagPipelinesByPipelineIdWorkflowsPublishedProcessingParametersResponse
|
||||
= zRagPipelineStepParametersResponse
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsPublishedRunBody = zPublishedWorkflowRunPayload
|
||||
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsPublishedRunPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostRagPipelinesByPipelineIdWorkflowsPublishedRunResponse = zRagPipelineOpaqueResponse
|
||||
= zRagPipelineVariablesResponse
|
||||
|
||||
export const zDeleteRagPipelinesByPipelineIdWorkflowsByWorkflowIdPath = z.object({
|
||||
pipeline_id: z.uuid(),
|
||||
|
||||
@ -14,15 +14,33 @@ export type RuleCodeGeneratePayload = {
|
||||
export type GeneratorResponse = unknown
|
||||
|
||||
export type ModelConfig = {
|
||||
completion_params?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
mode: LlmMode
|
||||
name: string
|
||||
provider: string
|
||||
agent_mode?: JsonValue | null
|
||||
annotation_reply?: JsonValue | null
|
||||
chat_prompt_config?: JsonValue | null
|
||||
completion_prompt_config?: JsonValue | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
dataset_configs?: JsonValue | null
|
||||
dataset_query_variable?: string | null
|
||||
external_data_tools?: JsonValue | null
|
||||
file_upload?: JsonValue | null
|
||||
model?: JsonValue | null
|
||||
more_like_this?: JsonValue | null
|
||||
opening_statement?: string | null
|
||||
pre_prompt?: string | null
|
||||
prompt_type?: string | null
|
||||
retriever_resource?: JsonValue | null
|
||||
sensitive_word_avoidance?: JsonValue | null
|
||||
speech_to_text?: JsonValue | null
|
||||
suggested_questions?: JsonValue | null
|
||||
suggested_questions_after_answer?: JsonValue | null
|
||||
text_to_speech?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
user_input_form?: JsonValue | null
|
||||
}
|
||||
|
||||
export type LlmMode = 'chat' | 'completion'
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type PostRuleCodeGenerateData = {
|
||||
body: RuleCodeGeneratePayload
|
||||
|
||||
@ -7,21 +7,36 @@ import * as z from 'zod'
|
||||
*/
|
||||
export const zGeneratorResponse = z.unknown()
|
||||
|
||||
/**
|
||||
* LLMMode
|
||||
*
|
||||
* Enum class for large language model mode.
|
||||
*/
|
||||
export const zLlmMode = z.enum(['chat', 'completion'])
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* ModelConfig
|
||||
*/
|
||||
export const zModelConfig = z.object({
|
||||
completion_params: z.record(z.string(), z.unknown()).optional(),
|
||||
mode: zLlmMode,
|
||||
name: z.string(),
|
||||
provider: z.string(),
|
||||
agent_mode: zJsonValue.nullish(),
|
||||
annotation_reply: zJsonValue.nullish(),
|
||||
chat_prompt_config: zJsonValue.nullish(),
|
||||
completion_prompt_config: zJsonValue.nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
dataset_configs: zJsonValue.nullish(),
|
||||
dataset_query_variable: z.string().nullish(),
|
||||
external_data_tools: zJsonValue.nullish(),
|
||||
file_upload: zJsonValue.nullish(),
|
||||
model: zJsonValue.nullish(),
|
||||
more_like_this: zJsonValue.nullish(),
|
||||
opening_statement: z.string().nullish(),
|
||||
pre_prompt: z.string().nullish(),
|
||||
prompt_type: z.string().nullish(),
|
||||
retriever_resource: zJsonValue.nullish(),
|
||||
sensitive_word_avoidance: zJsonValue.nullish(),
|
||||
speech_to_text: zJsonValue.nullish(),
|
||||
suggested_questions: zJsonValue.nullish(),
|
||||
suggested_questions_after_answer: zJsonValue.nullish(),
|
||||
text_to_speech: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
user_input_form: zJsonValue.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@ -13,15 +13,33 @@ export type RuleGeneratePayload = {
|
||||
export type GeneratorResponse = unknown
|
||||
|
||||
export type ModelConfig = {
|
||||
completion_params?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
mode: LlmMode
|
||||
name: string
|
||||
provider: string
|
||||
agent_mode?: JsonValue | null
|
||||
annotation_reply?: JsonValue | null
|
||||
chat_prompt_config?: JsonValue | null
|
||||
completion_prompt_config?: JsonValue | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
dataset_configs?: JsonValue | null
|
||||
dataset_query_variable?: string | null
|
||||
external_data_tools?: JsonValue | null
|
||||
file_upload?: JsonValue | null
|
||||
model?: JsonValue | null
|
||||
more_like_this?: JsonValue | null
|
||||
opening_statement?: string | null
|
||||
pre_prompt?: string | null
|
||||
prompt_type?: string | null
|
||||
retriever_resource?: JsonValue | null
|
||||
sensitive_word_avoidance?: JsonValue | null
|
||||
speech_to_text?: JsonValue | null
|
||||
suggested_questions?: JsonValue | null
|
||||
suggested_questions_after_answer?: JsonValue | null
|
||||
text_to_speech?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
user_input_form?: JsonValue | null
|
||||
}
|
||||
|
||||
export type LlmMode = 'chat' | 'completion'
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type PostRuleGenerateData = {
|
||||
body: RuleGeneratePayload
|
||||
|
||||
@ -7,21 +7,36 @@ import * as z from 'zod'
|
||||
*/
|
||||
export const zGeneratorResponse = z.unknown()
|
||||
|
||||
/**
|
||||
* LLMMode
|
||||
*
|
||||
* Enum class for large language model mode.
|
||||
*/
|
||||
export const zLlmMode = z.enum(['chat', 'completion'])
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* ModelConfig
|
||||
*/
|
||||
export const zModelConfig = z.object({
|
||||
completion_params: z.record(z.string(), z.unknown()).optional(),
|
||||
mode: zLlmMode,
|
||||
name: z.string(),
|
||||
provider: z.string(),
|
||||
agent_mode: zJsonValue.nullish(),
|
||||
annotation_reply: zJsonValue.nullish(),
|
||||
chat_prompt_config: zJsonValue.nullish(),
|
||||
completion_prompt_config: zJsonValue.nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
dataset_configs: zJsonValue.nullish(),
|
||||
dataset_query_variable: z.string().nullish(),
|
||||
external_data_tools: zJsonValue.nullish(),
|
||||
file_upload: zJsonValue.nullish(),
|
||||
model: zJsonValue.nullish(),
|
||||
more_like_this: zJsonValue.nullish(),
|
||||
opening_statement: z.string().nullish(),
|
||||
pre_prompt: z.string().nullish(),
|
||||
prompt_type: z.string().nullish(),
|
||||
retriever_resource: zJsonValue.nullish(),
|
||||
sensitive_word_avoidance: zJsonValue.nullish(),
|
||||
speech_to_text: zJsonValue.nullish(),
|
||||
suggested_questions: zJsonValue.nullish(),
|
||||
suggested_questions_after_answer: zJsonValue.nullish(),
|
||||
text_to_speech: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
user_input_form: zJsonValue.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@ -12,15 +12,33 @@ export type RuleStructuredOutputPayload = {
|
||||
export type GeneratorResponse = unknown
|
||||
|
||||
export type ModelConfig = {
|
||||
completion_params?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
mode: LlmMode
|
||||
name: string
|
||||
provider: string
|
||||
agent_mode?: JsonValue | null
|
||||
annotation_reply?: JsonValue | null
|
||||
chat_prompt_config?: JsonValue | null
|
||||
completion_prompt_config?: JsonValue | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
dataset_configs?: JsonValue | null
|
||||
dataset_query_variable?: string | null
|
||||
external_data_tools?: JsonValue | null
|
||||
file_upload?: JsonValue | null
|
||||
model?: JsonValue | null
|
||||
more_like_this?: JsonValue | null
|
||||
opening_statement?: string | null
|
||||
pre_prompt?: string | null
|
||||
prompt_type?: string | null
|
||||
retriever_resource?: JsonValue | null
|
||||
sensitive_word_avoidance?: JsonValue | null
|
||||
speech_to_text?: JsonValue | null
|
||||
suggested_questions?: JsonValue | null
|
||||
suggested_questions_after_answer?: JsonValue | null
|
||||
text_to_speech?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
user_input_form?: JsonValue | null
|
||||
}
|
||||
|
||||
export type LlmMode = 'chat' | 'completion'
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type PostRuleStructuredOutputGenerateData = {
|
||||
body: RuleStructuredOutputPayload
|
||||
|
||||
@ -7,21 +7,36 @@ import * as z from 'zod'
|
||||
*/
|
||||
export const zGeneratorResponse = z.unknown()
|
||||
|
||||
/**
|
||||
* LLMMode
|
||||
*
|
||||
* Enum class for large language model mode.
|
||||
*/
|
||||
export const zLlmMode = z.enum(['chat', 'completion'])
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* ModelConfig
|
||||
*/
|
||||
export const zModelConfig = z.object({
|
||||
completion_params: z.record(z.string(), z.unknown()).optional(),
|
||||
mode: zLlmMode,
|
||||
name: z.string(),
|
||||
provider: z.string(),
|
||||
agent_mode: zJsonValue.nullish(),
|
||||
annotation_reply: zJsonValue.nullish(),
|
||||
chat_prompt_config: zJsonValue.nullish(),
|
||||
completion_prompt_config: zJsonValue.nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
dataset_configs: zJsonValue.nullish(),
|
||||
dataset_query_variable: z.string().nullish(),
|
||||
external_data_tools: zJsonValue.nullish(),
|
||||
file_upload: zJsonValue.nullish(),
|
||||
model: zJsonValue.nullish(),
|
||||
more_like_this: zJsonValue.nullish(),
|
||||
opening_statement: z.string().nullish(),
|
||||
pre_prompt: z.string().nullish(),
|
||||
prompt_type: z.string().nullish(),
|
||||
retriever_resource: zJsonValue.nullish(),
|
||||
sensitive_word_avoidance: zJsonValue.nullish(),
|
||||
speech_to_text: zJsonValue.nullish(),
|
||||
suggested_questions: zJsonValue.nullish(),
|
||||
suggested_questions_after_answer: zJsonValue.nullish(),
|
||||
text_to_speech: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
user_input_form: zJsonValue.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@ -17,8 +17,6 @@ import {
|
||||
zGetSnippetsBySnippetIdWorkflowRunsPath,
|
||||
zGetSnippetsBySnippetIdWorkflowRunsQuery,
|
||||
zGetSnippetsBySnippetIdWorkflowRunsResponse,
|
||||
zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsPath,
|
||||
zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponse,
|
||||
zGetSnippetsBySnippetIdWorkflowsDraftConfigPath,
|
||||
zGetSnippetsBySnippetIdWorkflowsDraftConfigResponse,
|
||||
zGetSnippetsBySnippetIdWorkflowsDraftConversationVariablesPath,
|
||||
@ -65,7 +63,6 @@ import {
|
||||
zPostSnippetsBySnippetIdWorkflowsDraftRunBody,
|
||||
zPostSnippetsBySnippetIdWorkflowsDraftRunPath,
|
||||
zPostSnippetsBySnippetIdWorkflowsDraftRunResponse,
|
||||
zPostSnippetsBySnippetIdWorkflowsPublishBody,
|
||||
zPostSnippetsBySnippetIdWorkflowsPublishPath,
|
||||
zPostSnippetsBySnippetIdWorkflowsPublishResponse,
|
||||
zPutSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResetPath,
|
||||
@ -169,29 +166,10 @@ export const workflowRuns = {
|
||||
byRunId,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default block configurations for snippet workflow
|
||||
*/
|
||||
export const get4 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
operationId: 'getSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigs',
|
||||
path: '/snippets/{snippet_id}/workflows/default-workflow-block-configs',
|
||||
summary: 'Get default block configurations for snippet workflow',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsPath }))
|
||||
.output(zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponse)
|
||||
|
||||
export const defaultWorkflowBlockConfigs = {
|
||||
get: get4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get snippet draft workflow configuration limits
|
||||
*/
|
||||
export const get5 = oc
|
||||
export const get4 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -204,13 +182,13 @@ export const get5 = oc
|
||||
.output(zGetSnippetsBySnippetIdWorkflowsDraftConfigResponse)
|
||||
|
||||
export const config = {
|
||||
get: get5,
|
||||
get: get4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversation variables are not used in snippet workflows; returns an empty list for API parity
|
||||
*/
|
||||
export const get6 = oc
|
||||
export const get5 = oc
|
||||
.route({
|
||||
description:
|
||||
'Conversation variables are not used in snippet workflows; returns an empty list for API parity',
|
||||
@ -224,13 +202,13 @@ export const get6 = oc
|
||||
.output(zGetSnippetsBySnippetIdWorkflowsDraftConversationVariablesResponse)
|
||||
|
||||
export const conversationVariables = {
|
||||
get: get6,
|
||||
get: get5,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get environment variables from snippet draft workflow graph
|
||||
*/
|
||||
export const get7 = oc
|
||||
export const get6 = oc
|
||||
.route({
|
||||
description: 'Get environment variables from snippet draft workflow graph',
|
||||
inputStructure: 'detailed',
|
||||
@ -243,7 +221,7 @@ export const get7 = oc
|
||||
.output(zGetSnippetsBySnippetIdWorkflowsDraftEnvironmentVariablesResponse)
|
||||
|
||||
export const environmentVariables = {
|
||||
get: get7,
|
||||
get: get6,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -337,7 +315,7 @@ export const loop = {
|
||||
* Returns the most recent execution record for the given node,
|
||||
* including status, inputs, outputs, and timing information.
|
||||
*/
|
||||
export const get8 = oc
|
||||
export const get7 = oc
|
||||
.route({
|
||||
description:
|
||||
'Get last run result for a node in snippet draft workflow\nReturns the most recent execution record for the given node,\nincluding status, inputs, outputs, and timing information.',
|
||||
@ -352,7 +330,7 @@ export const get8 = oc
|
||||
.output(zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdLastRunResponse)
|
||||
|
||||
export const lastRun = {
|
||||
get: get8,
|
||||
get: get7,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -404,7 +382,7 @@ export const delete_ = oc
|
||||
/**
|
||||
* Get variables for a specific node (snippet draft workflow)
|
||||
*/
|
||||
export const get9 = oc
|
||||
export const get8 = oc
|
||||
.route({
|
||||
description: 'Get variables for a specific node (snippet draft workflow)',
|
||||
inputStructure: 'detailed',
|
||||
@ -418,7 +396,7 @@ export const get9 = oc
|
||||
|
||||
export const variables = {
|
||||
delete: delete_,
|
||||
get: get9,
|
||||
get: get8,
|
||||
}
|
||||
|
||||
export const byNodeId3 = {
|
||||
@ -463,7 +441,7 @@ export const run4 = {
|
||||
/**
|
||||
* System variables are not used in snippet workflows; returns an empty list for API parity
|
||||
*/
|
||||
export const get10 = oc
|
||||
export const get9 = oc
|
||||
.route({
|
||||
description:
|
||||
'System variables are not used in snippet workflows; returns an empty list for API parity',
|
||||
@ -477,7 +455,7 @@ export const get10 = oc
|
||||
.output(zGetSnippetsBySnippetIdWorkflowsDraftSystemVariablesResponse)
|
||||
|
||||
export const systemVariables = {
|
||||
get: get10,
|
||||
get: get9,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -518,7 +496,7 @@ export const delete2 = oc
|
||||
/**
|
||||
* Get a specific draft workflow variable (snippet scope)
|
||||
*/
|
||||
export const get11 = oc
|
||||
export const get10 = oc
|
||||
.route({
|
||||
description: 'Get a specific draft workflow variable (snippet scope)',
|
||||
inputStructure: 'detailed',
|
||||
@ -552,7 +530,7 @@ export const patch = oc
|
||||
|
||||
export const byVariableId = {
|
||||
delete: delete2,
|
||||
get: get11,
|
||||
get: get10,
|
||||
patch,
|
||||
reset,
|
||||
}
|
||||
@ -576,7 +554,7 @@ export const delete3 = oc
|
||||
/**
|
||||
* List draft workflow variables without values (paginated, snippet scope)
|
||||
*/
|
||||
export const get12 = oc
|
||||
export const get11 = oc
|
||||
.route({
|
||||
description: 'List draft workflow variables without values (paginated, snippet scope)',
|
||||
inputStructure: 'detailed',
|
||||
@ -595,14 +573,14 @@ export const get12 = oc
|
||||
|
||||
export const variables2 = {
|
||||
delete: delete3,
|
||||
get: get12,
|
||||
get: get11,
|
||||
byVariableId,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get draft workflow for snippet
|
||||
*/
|
||||
export const get13 = oc
|
||||
export const get12 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -635,7 +613,7 @@ export const post6 = oc
|
||||
.output(zPostSnippetsBySnippetIdWorkflowsDraftResponse)
|
||||
|
||||
export const draft = {
|
||||
get: get13,
|
||||
get: get12,
|
||||
post: post6,
|
||||
config,
|
||||
conversationVariables,
|
||||
@ -651,7 +629,7 @@ export const draft = {
|
||||
/**
|
||||
* Get published workflow for snippet
|
||||
*/
|
||||
export const get14 = oc
|
||||
export const get13 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
@ -675,16 +653,11 @@ export const post7 = oc
|
||||
summary: 'Publish snippet workflow',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostSnippetsBySnippetIdWorkflowsPublishBody,
|
||||
params: zPostSnippetsBySnippetIdWorkflowsPublishPath,
|
||||
}),
|
||||
)
|
||||
.input(z.object({ params: zPostSnippetsBySnippetIdWorkflowsPublishPath }))
|
||||
.output(zPostSnippetsBySnippetIdWorkflowsPublishResponse)
|
||||
|
||||
export const publish = {
|
||||
get: get14,
|
||||
get: get13,
|
||||
post: post7,
|
||||
}
|
||||
|
||||
@ -719,7 +692,7 @@ export const byWorkflowId = {
|
||||
*
|
||||
* Get all published workflows for a snippet
|
||||
*/
|
||||
export const get15 = oc
|
||||
export const get14 = oc
|
||||
.route({
|
||||
description: 'Get all published workflows for a snippet',
|
||||
inputStructure: 'detailed',
|
||||
@ -738,8 +711,7 @@ export const get15 = oc
|
||||
.output(zGetSnippetsBySnippetIdWorkflowsResponse)
|
||||
|
||||
export const workflows = {
|
||||
get: get15,
|
||||
defaultWorkflowBlockConfigs,
|
||||
get: get14,
|
||||
draft,
|
||||
publish,
|
||||
byWorkflowId,
|
||||
|
||||
@ -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
|
||||
@ -44,14 +44,10 @@ export type SnippetWorkflowPaginationResponse = {
|
||||
page: number
|
||||
}
|
||||
|
||||
export type DefaultBlockConfigsResponse = Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
|
||||
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 +65,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
|
||||
}
|
||||
|
||||
@ -86,7 +82,7 @@ export type SnippetDraftSyncPayload = {
|
||||
}> | null
|
||||
}
|
||||
|
||||
export type WorkflowRestoreResponse = {
|
||||
export type SyncDraftWorkflowResponse = {
|
||||
hash: string
|
||||
result: string
|
||||
updated_at: number
|
||||
@ -110,7 +106,7 @@ export type SnippetIterationNodeRunPayload = {
|
||||
} | null
|
||||
}
|
||||
|
||||
export type GeneratedAppResponse = JsonValue
|
||||
export type EventStreamResponse = string
|
||||
|
||||
export type SnippetLoopNodeRunPayload = {
|
||||
inputs?: {
|
||||
@ -120,7 +116,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
|
||||
@ -197,20 +193,14 @@ export type WorkflowDraftVariableUpdatePayload = {
|
||||
value?: unknown | null
|
||||
}
|
||||
|
||||
export type PublishWorkflowPayload = {
|
||||
knowledge_base_setting?: {
|
||||
[key: string]: unknown
|
||||
} | null
|
||||
}
|
||||
|
||||
export type WorkflowPublishResponse = {
|
||||
export type PublishWorkflowResponse = {
|
||||
created_at: number
|
||||
result: string
|
||||
}
|
||||
|
||||
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
|
||||
@ -222,7 +212,7 @@ export type WorkflowRunForListResponse = {
|
||||
version?: string | null
|
||||
}
|
||||
|
||||
export type SimpleAccount = {
|
||||
export type SimpleAccountResponse = {
|
||||
email: string
|
||||
id: string
|
||||
name: string
|
||||
@ -281,17 +271,6 @@ export type EnvironmentVariableItemResponse = {
|
||||
visible: boolean
|
||||
}
|
||||
|
||||
export type JsonValue
|
||||
= | string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
|
||||
export type WorkflowDraftVariableWithoutValue = {
|
||||
description?: string
|
||||
edited?: boolean
|
||||
@ -401,22 +380,6 @@ export type GetSnippetsBySnippetIdWorkflowsResponses = {
|
||||
export type GetSnippetsBySnippetIdWorkflowsResponse
|
||||
= GetSnippetsBySnippetIdWorkflowsResponses[keyof GetSnippetsBySnippetIdWorkflowsResponses]
|
||||
|
||||
export type GetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsData = {
|
||||
body?: never
|
||||
path: {
|
||||
snippet_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/snippets/{snippet_id}/workflows/default-workflow-block-configs'
|
||||
}
|
||||
|
||||
export type GetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponses = {
|
||||
200: DefaultBlockConfigsResponse
|
||||
}
|
||||
|
||||
export type GetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponse
|
||||
= GetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponses[keyof GetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponses]
|
||||
|
||||
export type GetSnippetsBySnippetIdWorkflowsDraftData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -451,7 +414,7 @@ export type PostSnippetsBySnippetIdWorkflowsDraftErrors = {
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsDraftResponses = {
|
||||
200: WorkflowRestoreResponse
|
||||
200: SyncDraftWorkflowResponse
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsDraftResponse
|
||||
@ -524,7 +487,7 @@ export type PostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunErrors
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: EventStreamResponse
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunResponse
|
||||
@ -545,7 +508,7 @@ export type PostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunErrors = {
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: EventStreamResponse
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunResponse
|
||||
@ -641,7 +604,7 @@ export type PostSnippetsBySnippetIdWorkflowsDraftRunErrors = {
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsDraftRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: EventStreamResponse
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsDraftRunResponse
|
||||
@ -804,7 +767,7 @@ export type GetSnippetsBySnippetIdWorkflowsPublishResponse
|
||||
= GetSnippetsBySnippetIdWorkflowsPublishResponses[keyof GetSnippetsBySnippetIdWorkflowsPublishResponses]
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsPublishData = {
|
||||
body: PublishWorkflowPayload
|
||||
body?: never
|
||||
path: {
|
||||
snippet_id: string
|
||||
}
|
||||
@ -817,7 +780,7 @@ export type PostSnippetsBySnippetIdWorkflowsPublishErrors = {
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsPublishResponses = {
|
||||
200: WorkflowPublishResponse
|
||||
200: PublishWorkflowResponse
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsPublishResponse
|
||||
@ -839,7 +802,7 @@ export type PostSnippetsBySnippetIdWorkflowsByWorkflowIdRestoreErrors = {
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsByWorkflowIdRestoreResponses = {
|
||||
200: WorkflowRestoreResponse
|
||||
200: SyncDraftWorkflowResponse
|
||||
}
|
||||
|
||||
export type PostSnippetsBySnippetIdWorkflowsByWorkflowIdRestoreResponse
|
||||
|
||||
@ -9,11 +9,6 @@ export const zSimpleResultResponse = z.object({
|
||||
result: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DefaultBlockConfigsResponse
|
||||
*/
|
||||
export const zDefaultBlockConfigsResponse = z.array(z.record(z.string(), z.unknown()))
|
||||
|
||||
/**
|
||||
* SnippetDraftSyncPayload
|
||||
*
|
||||
@ -27,9 +22,9 @@ export const zSnippetDraftSyncPayload = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* WorkflowRestoreResponse
|
||||
* SyncDraftWorkflowResponse
|
||||
*/
|
||||
export const zWorkflowRestoreResponse = z.object({
|
||||
export const zSyncDraftWorkflowResponse = z.object({
|
||||
hash: z.string(),
|
||||
result: z.string(),
|
||||
updated_at: z.int(),
|
||||
@ -51,6 +46,11 @@ export const zSnippetIterationNodeRunPayload = z.object({
|
||||
inputs: z.record(z.string(), z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* EventStreamResponse
|
||||
*/
|
||||
export const zEventStreamResponse = z.string()
|
||||
|
||||
/**
|
||||
* SnippetLoopNodeRunPayload
|
||||
*
|
||||
@ -117,26 +117,17 @@ export const zWorkflowDraftVariableUpdatePayload = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* PublishWorkflowPayload
|
||||
*
|
||||
* Payload for publishing snippet workflow.
|
||||
* PublishWorkflowResponse
|
||||
*/
|
||||
export const zPublishWorkflowPayload = z.object({
|
||||
knowledge_base_setting: z.record(z.string(), z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* WorkflowPublishResponse
|
||||
*/
|
||||
export const zWorkflowPublishResponse = z.object({
|
||||
export const zPublishWorkflowResponse = z.object({
|
||||
created_at: z.int(),
|
||||
result: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* SimpleAccount
|
||||
* SimpleAccountResponse
|
||||
*/
|
||||
export const zSimpleAccount = z.object({
|
||||
export const zSimpleAccountResponse = z.object({
|
||||
email: z.string(),
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
@ -147,7 +138,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(),
|
||||
@ -183,7 +174,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(),
|
||||
@ -205,7 +196,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(),
|
||||
@ -283,7 +274,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()),
|
||||
@ -295,7 +286,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(),
|
||||
})
|
||||
|
||||
@ -332,22 +323,6 @@ export const zEnvironmentVariableListResponse = z.object({
|
||||
items: z.array(zEnvironmentVariableItemResponse),
|
||||
})
|
||||
|
||||
export const zJsonValue = z
|
||||
.union([
|
||||
z.string(),
|
||||
z.int(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.record(z.string(), z.unknown()),
|
||||
z.array(z.unknown()),
|
||||
])
|
||||
.nullable()
|
||||
|
||||
/**
|
||||
* GeneratedAppResponse
|
||||
*/
|
||||
export const zGeneratedAppResponse = zJsonValue
|
||||
|
||||
export const zWorkflowDraftVariableWithoutValue = z.object({
|
||||
description: z.string().optional(),
|
||||
edited: z.boolean().optional(),
|
||||
@ -424,16 +399,6 @@ export const zGetSnippetsBySnippetIdWorkflowsQuery = z.object({
|
||||
*/
|
||||
export const zGetSnippetsBySnippetIdWorkflowsResponse = zSnippetWorkflowPaginationResponse
|
||||
|
||||
export const zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsPath = z.object({
|
||||
snippet_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Default block configs retrieved successfully
|
||||
*/
|
||||
export const zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponse
|
||||
= zDefaultBlockConfigsResponse
|
||||
|
||||
export const zGetSnippetsBySnippetIdWorkflowsDraftPath = z.object({
|
||||
snippet_id: z.uuid(),
|
||||
})
|
||||
@ -452,7 +417,7 @@ export const zPostSnippetsBySnippetIdWorkflowsDraftPath = z.object({
|
||||
/**
|
||||
* Draft workflow synced successfully
|
||||
*/
|
||||
export const zPostSnippetsBySnippetIdWorkflowsDraftResponse = zWorkflowRestoreResponse
|
||||
export const zPostSnippetsBySnippetIdWorkflowsDraftResponse = zSyncDraftWorkflowResponse
|
||||
|
||||
export const zGetSnippetsBySnippetIdWorkflowsDraftConfigPath = z.object({
|
||||
snippet_id: z.uuid(),
|
||||
@ -495,7 +460,7 @@ export const zPostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunPath
|
||||
* Iteration node run started successfully (SSE stream)
|
||||
*/
|
||||
export const zPostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunResponse
|
||||
= zGeneratedAppResponse
|
||||
= zEventStreamResponse
|
||||
|
||||
export const zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunBody
|
||||
= zSnippetLoopNodeRunPayload
|
||||
@ -509,7 +474,7 @@ export const zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunPath = z.
|
||||
* Loop node run started successfully (SSE stream)
|
||||
*/
|
||||
export const zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunResponse
|
||||
= zGeneratedAppResponse
|
||||
= zEventStreamResponse
|
||||
|
||||
export const zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdLastRunPath = z.object({
|
||||
node_id: z.string(),
|
||||
@ -566,7 +531,7 @@ export const zPostSnippetsBySnippetIdWorkflowsDraftRunPath = z.object({
|
||||
/**
|
||||
* Draft workflow run started successfully (SSE stream)
|
||||
*/
|
||||
export const zPostSnippetsBySnippetIdWorkflowsDraftRunResponse = zGeneratedAppResponse
|
||||
export const zPostSnippetsBySnippetIdWorkflowsDraftRunResponse = zEventStreamResponse
|
||||
|
||||
export const zGetSnippetsBySnippetIdWorkflowsDraftSystemVariablesPath = z.object({
|
||||
snippet_id: z.uuid(),
|
||||
@ -656,8 +621,6 @@ export const zGetSnippetsBySnippetIdWorkflowsPublishPath = z.object({
|
||||
*/
|
||||
export const zGetSnippetsBySnippetIdWorkflowsPublishResponse = zSnippetWorkflowResponse
|
||||
|
||||
export const zPostSnippetsBySnippetIdWorkflowsPublishBody = zPublishWorkflowPayload
|
||||
|
||||
export const zPostSnippetsBySnippetIdWorkflowsPublishPath = z.object({
|
||||
snippet_id: z.uuid(),
|
||||
})
|
||||
@ -665,7 +628,7 @@ export const zPostSnippetsBySnippetIdWorkflowsPublishPath = z.object({
|
||||
/**
|
||||
* Workflow published successfully
|
||||
*/
|
||||
export const zPostSnippetsBySnippetIdWorkflowsPublishResponse = zWorkflowPublishResponse
|
||||
export const zPostSnippetsBySnippetIdWorkflowsPublishResponse = zPublishWorkflowResponse
|
||||
|
||||
export const zPostSnippetsBySnippetIdWorkflowsByWorkflowIdRestorePath = z.object({
|
||||
snippet_id: z.uuid(),
|
||||
@ -675,4 +638,5 @@ export const zPostSnippetsBySnippetIdWorkflowsByWorkflowIdRestorePath = z.object
|
||||
/**
|
||||
* Workflow restored successfully
|
||||
*/
|
||||
export const zPostSnippetsBySnippetIdWorkflowsByWorkflowIdRestoreResponse = zWorkflowRestoreResponse
|
||||
export const zPostSnippetsBySnippetIdWorkflowsByWorkflowIdRestoreResponse
|
||||
= zSyncDraftWorkflowResponse
|
||||
|
||||
@ -19,18 +19,9 @@ import {
|
||||
zGetTrialAppsByAppIdWorkflowsResponse,
|
||||
zPostTrialAppsByAppIdAudioToTextPath,
|
||||
zPostTrialAppsByAppIdAudioToTextResponse,
|
||||
zPostTrialAppsByAppIdChatMessagesBody,
|
||||
zPostTrialAppsByAppIdChatMessagesPath,
|
||||
zPostTrialAppsByAppIdChatMessagesResponse,
|
||||
zPostTrialAppsByAppIdCompletionMessagesBody,
|
||||
zPostTrialAppsByAppIdCompletionMessagesPath,
|
||||
zPostTrialAppsByAppIdCompletionMessagesResponse,
|
||||
zPostTrialAppsByAppIdTextToAudioBody,
|
||||
zPostTrialAppsByAppIdTextToAudioPath,
|
||||
zPostTrialAppsByAppIdTextToAudioResponse,
|
||||
zPostTrialAppsByAppIdWorkflowsRunBody,
|
||||
zPostTrialAppsByAppIdWorkflowsRunPath,
|
||||
zPostTrialAppsByAppIdWorkflowsRunResponse,
|
||||
zPostTrialAppsByAppIdWorkflowsTasksByTaskIdStopPath,
|
||||
zPostTrialAppsByAppIdWorkflowsTasksByTaskIdStopResponse,
|
||||
} from './zod.gen'
|
||||
@ -50,46 +41,6 @@ export const audioToText = {
|
||||
post,
|
||||
}
|
||||
|
||||
export const post2 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postTrialAppsByAppIdChatMessages',
|
||||
path: '/trial-apps/{app_id}/chat-messages',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostTrialAppsByAppIdChatMessagesBody,
|
||||
params: zPostTrialAppsByAppIdChatMessagesPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostTrialAppsByAppIdChatMessagesResponse)
|
||||
|
||||
export const chatMessages = {
|
||||
post: post2,
|
||||
}
|
||||
|
||||
export const post3 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postTrialAppsByAppIdCompletionMessages',
|
||||
path: '/trial-apps/{app_id}/completion-messages',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostTrialAppsByAppIdCompletionMessagesBody,
|
||||
params: zPostTrialAppsByAppIdCompletionMessagesPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostTrialAppsByAppIdCompletionMessagesResponse)
|
||||
|
||||
export const completionMessages = {
|
||||
post: post3,
|
||||
}
|
||||
|
||||
export const get = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
@ -175,7 +126,7 @@ export const site = {
|
||||
get: get4,
|
||||
}
|
||||
|
||||
export const post4 = oc
|
||||
export const post2 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -192,37 +143,13 @@ export const post4 = oc
|
||||
.output(zPostTrialAppsByAppIdTextToAudioResponse)
|
||||
|
||||
export const textToAudio = {
|
||||
post: post4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run workflow
|
||||
*/
|
||||
export const post5 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postTrialAppsByAppIdWorkflowsRun',
|
||||
path: '/trial-apps/{app_id}/workflows/run',
|
||||
summary: 'Run workflow',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
body: zPostTrialAppsByAppIdWorkflowsRunBody,
|
||||
params: zPostTrialAppsByAppIdWorkflowsRunPath,
|
||||
}),
|
||||
)
|
||||
.output(zPostTrialAppsByAppIdWorkflowsRunResponse)
|
||||
|
||||
export const run = {
|
||||
post: post5,
|
||||
post: post2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop workflow task
|
||||
*/
|
||||
export const post6 = oc
|
||||
export const post3 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -235,7 +162,7 @@ export const post6 = oc
|
||||
.output(zPostTrialAppsByAppIdWorkflowsTasksByTaskIdStopResponse)
|
||||
|
||||
export const stop = {
|
||||
post: post6,
|
||||
post: post3,
|
||||
}
|
||||
|
||||
export const byTaskId = {
|
||||
@ -263,7 +190,6 @@ export const get5 = oc
|
||||
|
||||
export const workflows = {
|
||||
get: get5,
|
||||
run,
|
||||
tasks,
|
||||
}
|
||||
|
||||
@ -285,8 +211,6 @@ export const get6 = oc
|
||||
export const byAppId = {
|
||||
get: get6,
|
||||
audioToText,
|
||||
chatMessages,
|
||||
completionMessages,
|
||||
datasets,
|
||||
messages,
|
||||
parameters,
|
||||
|
||||
@ -4,66 +4,47 @@ export type ClientOptions = {
|
||||
baseUrl: `${string}://${string}/console/api` | (string & {})
|
||||
}
|
||||
|
||||
export type TrialAppDetailWithSite = {
|
||||
access_mode?: string
|
||||
api_base_url?: string
|
||||
created_at?: number
|
||||
created_by?: string
|
||||
deleted_tools?: Array<TrialDeletedTool>
|
||||
description?: string
|
||||
enable_api?: boolean
|
||||
enable_site?: boolean
|
||||
icon?: string
|
||||
icon_background?: string
|
||||
icon_type?: string
|
||||
icon_url?: string
|
||||
id?: string
|
||||
max_active_requests?: number
|
||||
mode?: string
|
||||
model_config?: TrialAppModelConfig
|
||||
name?: string
|
||||
export type AppDetailWithSite = {
|
||||
access_mode?: string | null
|
||||
api_base_url?: string | null
|
||||
app_id?: string | null
|
||||
bound_agent_id?: string | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
deleted_tools?: Array<DeletedTool>
|
||||
description?: string | null
|
||||
enable_api: boolean
|
||||
enable_site: boolean
|
||||
icon?: string | null
|
||||
icon_background?: string | null
|
||||
icon_type?: string | null
|
||||
readonly icon_url: string | null
|
||||
id: string
|
||||
maintainer?: string | null
|
||||
max_active_requests?: number | null
|
||||
mode: string
|
||||
model_config?: ModelConfig | null
|
||||
name: string
|
||||
permission_keys?: Array<string>
|
||||
site?: TrialSite
|
||||
tags?: Array<TrialTag>
|
||||
updated_at?: number
|
||||
updated_by?: string
|
||||
use_icon_as_answer_icon?: boolean
|
||||
workflow?: TrialWorkflowPartial
|
||||
site?: Site | null
|
||||
tags?: Array<Tag>
|
||||
tracing?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
use_icon_as_answer_icon?: boolean | null
|
||||
workflow?: WorkflowPartial | null
|
||||
}
|
||||
|
||||
export type AudioTranscriptResponse = {
|
||||
text: string
|
||||
}
|
||||
|
||||
export type ChatRequest = {
|
||||
conversation_id?: string | null
|
||||
files?: Array<unknown> | null
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
parent_message_id?: string | null
|
||||
query: string
|
||||
retriever_from?: string
|
||||
}
|
||||
|
||||
export type GeneratedAppResponse = JsonValue
|
||||
|
||||
export type CompletionRequest = {
|
||||
files?: Array<unknown> | null
|
||||
inputs: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
query?: string
|
||||
response_mode?: 'blocking' | 'streaming' | null
|
||||
retriever_from?: string
|
||||
}
|
||||
|
||||
export type TrialDatasetList = {
|
||||
data?: Array<TrialDataset>
|
||||
has_more?: boolean
|
||||
limit?: number
|
||||
page?: number
|
||||
total?: number
|
||||
export type TrialDatasetListResponse = {
|
||||
data: Array<TrialDatasetListItemResponse>
|
||||
has_more: boolean
|
||||
limit: number
|
||||
page: number
|
||||
total: number
|
||||
}
|
||||
|
||||
export type SuggestedQuestionsResponse = {
|
||||
@ -111,166 +92,119 @@ export type TextToSpeechRequest = {
|
||||
|
||||
export type AudioBinaryResponse = Blob | File
|
||||
|
||||
export type TrialWorkflow = {
|
||||
conversation_variables?: Array<TrialConversationVariable>
|
||||
created_at?: number
|
||||
created_by?: TrialSimpleAccount
|
||||
environment_variables?: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
features?: {
|
||||
export type WorkflowResponse = {
|
||||
conversation_variables: Array<WorkflowConversationVariableResponse>
|
||||
created_at: number
|
||||
created_by?: SimpleAccountResponse | null
|
||||
environment_variables: Array<WorkflowEnvironmentVariableResponse>
|
||||
features: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
graph?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
hash?: string
|
||||
id?: string
|
||||
marked_comment?: string
|
||||
marked_name?: string
|
||||
rag_pipeline_variables?: Array<TrialPipelineVariable>
|
||||
tool_published?: boolean
|
||||
updated_at?: number
|
||||
updated_by?: TrialSimpleAccount
|
||||
version?: string
|
||||
}
|
||||
|
||||
export type WorkflowRunRequest = {
|
||||
files?: Array<unknown> | null
|
||||
inputs: {
|
||||
graph: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
hash: string
|
||||
id: string
|
||||
marked_comment: string
|
||||
marked_name: string
|
||||
rag_pipeline_variables: Array<PipelineVariableResponse>
|
||||
tool_published: boolean
|
||||
updated_at: number
|
||||
updated_by?: SimpleAccountResponse | null
|
||||
version: string
|
||||
}
|
||||
|
||||
export type SimpleResultResponse = {
|
||||
result: string
|
||||
}
|
||||
|
||||
export type TrialDeletedTool = {
|
||||
provider_id?: string
|
||||
tool_name?: string
|
||||
type?: string
|
||||
export type DeletedTool = {
|
||||
provider_id: string
|
||||
tool_name: string
|
||||
type: string
|
||||
}
|
||||
|
||||
export type TrialAppModelConfig = {
|
||||
agent_mode?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
annotation_reply?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
chat_prompt_config?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
completion_prompt_config?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
created_at?: number
|
||||
created_by?: string
|
||||
dataset_configs?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
dataset_query_variable?: string
|
||||
external_data_tools?: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
file_upload?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
model?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
more_like_this?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
opening_statement?: string
|
||||
pre_prompt?: string
|
||||
prompt_type?: string
|
||||
retriever_resource?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
sensitive_word_avoidance?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
speech_to_text?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
suggested_questions?: Array<string>
|
||||
suggested_questions_after_answer?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
text_to_speech?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
updated_at?: number
|
||||
updated_by?: string
|
||||
user_input_form?: Array<{
|
||||
[key: string]: unknown
|
||||
}>
|
||||
export type ModelConfig = {
|
||||
agent_mode?: JsonValue | null
|
||||
annotation_reply?: JsonValue | null
|
||||
chat_prompt_config?: JsonValue | null
|
||||
completion_prompt_config?: JsonValue | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
dataset_configs?: JsonValue | null
|
||||
dataset_query_variable?: string | null
|
||||
external_data_tools?: JsonValue | null
|
||||
file_upload?: JsonValue | null
|
||||
model?: JsonValue | null
|
||||
more_like_this?: JsonValue | null
|
||||
opening_statement?: string | null
|
||||
pre_prompt?: string | null
|
||||
prompt_type?: string | null
|
||||
retriever_resource?: JsonValue | null
|
||||
sensitive_word_avoidance?: JsonValue | null
|
||||
speech_to_text?: JsonValue | null
|
||||
suggested_questions?: JsonValue | null
|
||||
suggested_questions_after_answer?: JsonValue | null
|
||||
text_to_speech?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
user_input_form?: JsonValue | null
|
||||
}
|
||||
|
||||
export type TrialSite = {
|
||||
access_token?: string
|
||||
app_base_url?: string
|
||||
chat_color_theme?: string
|
||||
chat_color_theme_inverted?: boolean
|
||||
code?: string
|
||||
copyright?: string
|
||||
created_at?: number
|
||||
created_by?: string
|
||||
custom_disclaimer?: string
|
||||
customize_domain?: string
|
||||
customize_token_strategy?: string
|
||||
default_language?: string
|
||||
description?: string
|
||||
icon?: string
|
||||
icon_background?: string
|
||||
icon_type?: string
|
||||
icon_url?: string
|
||||
privacy_policy?: string
|
||||
prompt_public?: boolean
|
||||
show_workflow_steps?: boolean
|
||||
title?: string
|
||||
updated_at?: number
|
||||
updated_by?: string
|
||||
use_icon_as_answer_icon?: boolean
|
||||
export type Tag = {
|
||||
id: string
|
||||
name: string
|
||||
type: string
|
||||
}
|
||||
|
||||
export type TrialTag = {
|
||||
id?: string
|
||||
name?: string
|
||||
type?: string
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type WorkflowPartial = {
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
id: string
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
}
|
||||
|
||||
export type TrialWorkflowPartial = {
|
||||
created_at?: number
|
||||
created_by?: string
|
||||
id?: string
|
||||
updated_at?: number
|
||||
updated_by?: string
|
||||
}
|
||||
|
||||
export type JsonValue
|
||||
= | string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
|
||||
export type TrialDataset = {
|
||||
created_at?: number
|
||||
created_by?: string
|
||||
data_source_type?: string
|
||||
description?: string
|
||||
id?: string
|
||||
indexing_technique?: string
|
||||
name?: string
|
||||
permission?: string
|
||||
export type TrialDatasetListItemResponse = {
|
||||
app_count: number
|
||||
author_name: string | null
|
||||
built_in_field_enabled: boolean
|
||||
chunk_structure: string | null
|
||||
created_at: number
|
||||
created_by: string
|
||||
data_source_type: string | null
|
||||
description: string | null
|
||||
doc_form: string | null
|
||||
doc_metadata: Array<DatasetDocMetadataResponse>
|
||||
document_count: number
|
||||
embedding_available?: boolean | null
|
||||
embedding_model: string | null
|
||||
embedding_model_provider: string | null
|
||||
enable_api: boolean
|
||||
external_knowledge_info?: DatasetExternalKnowledgeInfoResponse
|
||||
external_retrieval_model: DatasetExternalRetrievalModelResponse | null
|
||||
icon_info?: DatasetIconInfoResponse
|
||||
id: string
|
||||
indexing_technique: string | null
|
||||
is_multimodal: boolean
|
||||
is_published: boolean
|
||||
maintainer?: string | null
|
||||
name: string
|
||||
permission: string
|
||||
permission_keys?: Array<string>
|
||||
pipeline_id: string | null
|
||||
provider: string
|
||||
retrieval_model_dict: DatasetRetrievalModelResponse
|
||||
runtime_mode: string | null
|
||||
summary_index_setting?: DatasetSummaryIndexSettingResponse
|
||||
tags: Array<DatasetTagResponse>
|
||||
total_available_documents: number
|
||||
total_documents: number
|
||||
updated_at: number
|
||||
updated_by: string | null
|
||||
word_count: number
|
||||
}
|
||||
|
||||
export type JsonObject = {
|
||||
@ -285,56 +219,145 @@ export type SystemParameters = {
|
||||
workflow_file_upload_limit: number
|
||||
}
|
||||
|
||||
export type TrialConversationVariable = {
|
||||
description?: string
|
||||
id?: string
|
||||
name?: string
|
||||
value?:
|
||||
| string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
value_type?: string
|
||||
export type WorkflowConversationVariableResponse = {
|
||||
description: string
|
||||
id: string
|
||||
name: string
|
||||
value: unknown
|
||||
value_type: string
|
||||
}
|
||||
|
||||
export type TrialSimpleAccount = {
|
||||
email?: string
|
||||
id?: string
|
||||
name?: string
|
||||
export type SimpleAccountResponse = {
|
||||
email: string
|
||||
id: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export type TrialPipelineVariable = {
|
||||
allow_file_extension?: Array<string>
|
||||
allow_file_upload_methods?: Array<string>
|
||||
allowed_file_types?: Array<string>
|
||||
belong_to_node_id?: string
|
||||
default_value?:
|
||||
| string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
label?: string
|
||||
max_length?: number
|
||||
options?: Array<string>
|
||||
placeholder?: string
|
||||
required?: boolean
|
||||
tooltips?: string
|
||||
type?: string
|
||||
unit?: string
|
||||
variable?: string
|
||||
export type WorkflowEnvironmentVariableResponse = {
|
||||
description: string
|
||||
id: string
|
||||
name: string
|
||||
value: unknown
|
||||
value_type: string
|
||||
}
|
||||
|
||||
export type GeneratedAppResponseWritable = JsonValue
|
||||
export type PipelineVariableResponse = {
|
||||
allowed_file_extensions?: Array<string> | null
|
||||
allowed_file_types?: Array<string> | null
|
||||
allowed_file_upload_methods?: Array<string> | null
|
||||
belong_to_node_id: string
|
||||
default_value?: unknown
|
||||
label: string
|
||||
max_length?: number | null
|
||||
options?: Array<string> | null
|
||||
placeholder?: string | null
|
||||
required: boolean
|
||||
tooltips?: string | null
|
||||
type: string
|
||||
unit?: string | null
|
||||
variable: string
|
||||
}
|
||||
|
||||
export type DatasetDocMetadataResponse = {
|
||||
id: string
|
||||
name: string
|
||||
type: string
|
||||
}
|
||||
|
||||
export type DatasetExternalKnowledgeInfoResponse = {
|
||||
external_knowledge_api_endpoint?: string | null
|
||||
external_knowledge_api_id?: string | null
|
||||
external_knowledge_api_name?: string | null
|
||||
external_knowledge_id?: string | null
|
||||
}
|
||||
|
||||
export type DatasetExternalRetrievalModelResponse = {
|
||||
score_threshold?: number | null
|
||||
score_threshold_enabled?: boolean | null
|
||||
top_k: number
|
||||
}
|
||||
|
||||
export type DatasetIconInfoResponse = {
|
||||
icon?: string | null
|
||||
icon_background?: string | null
|
||||
icon_type?: string | null
|
||||
icon_url?: string | null
|
||||
}
|
||||
|
||||
export type DatasetRetrievalModelResponse = {
|
||||
reranking_enable: boolean
|
||||
reranking_mode?: string | null
|
||||
reranking_model?: DatasetRerankingModelResponse
|
||||
score_threshold?: number | null
|
||||
score_threshold_enabled: boolean
|
||||
search_method: string
|
||||
top_k: number
|
||||
weights?: DatasetWeightedScoreResponse | null
|
||||
}
|
||||
|
||||
export type DatasetSummaryIndexSettingResponse = {
|
||||
enable?: boolean | null
|
||||
model_name?: string | null
|
||||
model_provider_name?: string | null
|
||||
summary_prompt?: string | null
|
||||
}
|
||||
|
||||
export type DatasetTagResponse = {
|
||||
id: string
|
||||
name: string
|
||||
type: string
|
||||
}
|
||||
|
||||
export type DatasetRerankingModelResponse = {
|
||||
reranking_model_name?: string | null
|
||||
reranking_provider_name?: string | null
|
||||
}
|
||||
|
||||
export type DatasetWeightedScoreResponse = {
|
||||
keyword_setting?: DatasetKeywordSettingResponse
|
||||
vector_setting?: DatasetVectorSettingResponse
|
||||
weight_type?: string | null
|
||||
}
|
||||
|
||||
export type DatasetKeywordSettingResponse = {
|
||||
keyword_weight?: number | null
|
||||
}
|
||||
|
||||
export type DatasetVectorSettingResponse = {
|
||||
embedding_model_name?: string | null
|
||||
embedding_provider_name?: string | null
|
||||
vector_weight?: number | null
|
||||
}
|
||||
|
||||
export type AppDetailWithSiteWritable = {
|
||||
access_mode?: string | null
|
||||
api_base_url?: string | null
|
||||
app_id?: string | null
|
||||
bound_agent_id?: string | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
deleted_tools?: Array<DeletedTool>
|
||||
description?: string | null
|
||||
enable_api: boolean
|
||||
enable_site: boolean
|
||||
icon?: string | null
|
||||
icon_background?: string | null
|
||||
icon_type?: string | null
|
||||
id: string
|
||||
maintainer?: string | null
|
||||
max_active_requests?: number | null
|
||||
mode: string
|
||||
model_config?: ModelConfig | null
|
||||
name: string
|
||||
permission_keys?: Array<string>
|
||||
site?: SiteWritable | null
|
||||
tags?: Array<Tag>
|
||||
tracing?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
use_icon_as_answer_icon?: boolean | null
|
||||
workflow?: WorkflowPartial | null
|
||||
}
|
||||
|
||||
export type SiteWritable = {
|
||||
chat_color_theme?: string | null
|
||||
@ -362,7 +385,7 @@ export type GetTrialAppsByAppIdData = {
|
||||
}
|
||||
|
||||
export type GetTrialAppsByAppIdResponses = {
|
||||
200: TrialAppDetailWithSite
|
||||
200: AppDetailWithSite
|
||||
}
|
||||
|
||||
export type GetTrialAppsByAppIdResponse
|
||||
@ -384,38 +407,6 @@ export type PostTrialAppsByAppIdAudioToTextResponses = {
|
||||
export type PostTrialAppsByAppIdAudioToTextResponse
|
||||
= PostTrialAppsByAppIdAudioToTextResponses[keyof PostTrialAppsByAppIdAudioToTextResponses]
|
||||
|
||||
export type PostTrialAppsByAppIdChatMessagesData = {
|
||||
body: ChatRequest
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/trial-apps/{app_id}/chat-messages'
|
||||
}
|
||||
|
||||
export type PostTrialAppsByAppIdChatMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostTrialAppsByAppIdChatMessagesResponse
|
||||
= PostTrialAppsByAppIdChatMessagesResponses[keyof PostTrialAppsByAppIdChatMessagesResponses]
|
||||
|
||||
export type PostTrialAppsByAppIdCompletionMessagesData = {
|
||||
body: CompletionRequest
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/trial-apps/{app_id}/completion-messages'
|
||||
}
|
||||
|
||||
export type PostTrialAppsByAppIdCompletionMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostTrialAppsByAppIdCompletionMessagesResponse
|
||||
= PostTrialAppsByAppIdCompletionMessagesResponses[keyof PostTrialAppsByAppIdCompletionMessagesResponses]
|
||||
|
||||
export type GetTrialAppsByAppIdDatasetsData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -430,7 +421,7 @@ export type GetTrialAppsByAppIdDatasetsData = {
|
||||
}
|
||||
|
||||
export type GetTrialAppsByAppIdDatasetsResponses = {
|
||||
200: TrialDatasetList
|
||||
200: TrialDatasetListResponse
|
||||
}
|
||||
|
||||
export type GetTrialAppsByAppIdDatasetsResponse
|
||||
@ -511,28 +502,12 @@ export type GetTrialAppsByAppIdWorkflowsData = {
|
||||
}
|
||||
|
||||
export type GetTrialAppsByAppIdWorkflowsResponses = {
|
||||
200: TrialWorkflow
|
||||
200: WorkflowResponse
|
||||
}
|
||||
|
||||
export type GetTrialAppsByAppIdWorkflowsResponse
|
||||
= GetTrialAppsByAppIdWorkflowsResponses[keyof GetTrialAppsByAppIdWorkflowsResponses]
|
||||
|
||||
export type PostTrialAppsByAppIdWorkflowsRunData = {
|
||||
body: WorkflowRunRequest
|
||||
path: {
|
||||
app_id: string
|
||||
}
|
||||
query?: never
|
||||
url: '/trial-apps/{app_id}/workflows/run'
|
||||
}
|
||||
|
||||
export type PostTrialAppsByAppIdWorkflowsRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostTrialAppsByAppIdWorkflowsRunResponse
|
||||
= PostTrialAppsByAppIdWorkflowsRunResponses[keyof PostTrialAppsByAppIdWorkflowsRunResponses]
|
||||
|
||||
export type PostTrialAppsByAppIdWorkflowsTasksByTaskIdStopData = {
|
||||
body?: never
|
||||
path: {
|
||||
|
||||
@ -9,29 +9,6 @@ export const zAudioTranscriptResponse = z.object({
|
||||
text: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ChatRequest
|
||||
*/
|
||||
export const zChatRequest = z.object({
|
||||
conversation_id: z.string().nullish(),
|
||||
files: z.array(z.unknown()).nullish(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
parent_message_id: z.string().nullish(),
|
||||
query: z.string(),
|
||||
retriever_from: z.string().optional().default('explore_app'),
|
||||
})
|
||||
|
||||
/**
|
||||
* CompletionRequest
|
||||
*/
|
||||
export const zCompletionRequest = z.object({
|
||||
files: z.array(z.unknown()).nullish(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
query: z.string().optional().default(''),
|
||||
response_mode: z.enum(['blocking', 'streaming']).nullish(),
|
||||
retriever_from: z.string().optional().default('explore_app'),
|
||||
})
|
||||
|
||||
/**
|
||||
* SuggestedQuestionsResponse
|
||||
*/
|
||||
@ -74,14 +51,6 @@ export const zTextToSpeechRequest = z.object({
|
||||
*/
|
||||
export const zAudioBinaryResponse = z.custom<Blob | File>()
|
||||
|
||||
/**
|
||||
* WorkflowRunRequest
|
||||
*/
|
||||
export const zWorkflowRunRequest = z.object({
|
||||
files: z.array(z.unknown()).nullish(),
|
||||
inputs: z.record(z.string(), z.unknown()),
|
||||
})
|
||||
|
||||
/**
|
||||
* SimpleResultResponse
|
||||
*/
|
||||
@ -89,213 +58,99 @@ export const zSimpleResultResponse = z.object({
|
||||
result: z.string(),
|
||||
})
|
||||
|
||||
export const zTrialDeletedTool = z.object({
|
||||
provider_id: z.string().optional(),
|
||||
tool_name: z.string().optional(),
|
||||
type: z.string().optional(),
|
||||
/**
|
||||
* DeletedTool
|
||||
*/
|
||||
export const zDeletedTool = z.object({
|
||||
provider_id: z.string(),
|
||||
tool_name: z.string(),
|
||||
type: z.string(),
|
||||
})
|
||||
|
||||
export const zTrialAppModelConfig = z.object({
|
||||
agent_mode: z.record(z.string(), z.unknown()).optional(),
|
||||
annotation_reply: z.record(z.string(), z.unknown()).optional(),
|
||||
chat_prompt_config: z.record(z.string(), z.unknown()).optional(),
|
||||
completion_prompt_config: z.record(z.string(), z.unknown()).optional(),
|
||||
created_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
created_by: z.string().optional(),
|
||||
dataset_configs: z.record(z.string(), z.unknown()).optional(),
|
||||
dataset_query_variable: z.string().optional(),
|
||||
external_data_tools: z.array(z.record(z.string(), z.unknown())).optional(),
|
||||
file_upload: z.record(z.string(), z.unknown()).optional(),
|
||||
model: z.record(z.string(), z.unknown()).optional(),
|
||||
more_like_this: z.record(z.string(), z.unknown()).optional(),
|
||||
opening_statement: z.string().optional(),
|
||||
pre_prompt: z.string().optional(),
|
||||
prompt_type: z.string().optional(),
|
||||
retriever_resource: z.record(z.string(), z.unknown()).optional(),
|
||||
sensitive_word_avoidance: z.record(z.string(), z.unknown()).optional(),
|
||||
speech_to_text: z.record(z.string(), z.unknown()).optional(),
|
||||
suggested_questions: z.array(z.string()).optional(),
|
||||
suggested_questions_after_answer: z.record(z.string(), z.unknown()).optional(),
|
||||
text_to_speech: z.record(z.string(), z.unknown()).optional(),
|
||||
updated_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
updated_by: z.string().optional(),
|
||||
user_input_form: z.array(z.record(z.string(), z.unknown())).optional(),
|
||||
})
|
||||
|
||||
export const zTrialSite = z.object({
|
||||
access_token: z.string().optional(),
|
||||
app_base_url: z.string().optional(),
|
||||
chat_color_theme: z.string().optional(),
|
||||
chat_color_theme_inverted: z.boolean().optional(),
|
||||
code: z.string().optional(),
|
||||
copyright: z.string().optional(),
|
||||
created_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
created_by: z.string().optional(),
|
||||
custom_disclaimer: z.string().optional(),
|
||||
customize_domain: z.string().optional(),
|
||||
customize_token_strategy: z.string().optional(),
|
||||
default_language: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
icon: z.string().optional(),
|
||||
icon_background: z.string().optional(),
|
||||
icon_type: z.string().optional(),
|
||||
icon_url: z.string().optional(),
|
||||
privacy_policy: z.string().optional(),
|
||||
prompt_public: z.boolean().optional(),
|
||||
show_workflow_steps: z.boolean().optional(),
|
||||
title: z.string().optional(),
|
||||
updated_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
updated_by: z.string().optional(),
|
||||
use_icon_as_answer_icon: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export const zTrialTag = z.object({
|
||||
id: z.string().optional(),
|
||||
name: z.string().optional(),
|
||||
type: z.string().optional(),
|
||||
})
|
||||
|
||||
export const zTrialWorkflowPartial = z.object({
|
||||
created_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
created_by: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
updated_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
updated_by: z.string().optional(),
|
||||
})
|
||||
|
||||
export const zTrialAppDetailWithSite = z.object({
|
||||
access_mode: z.string().optional(),
|
||||
api_base_url: z.string().optional(),
|
||||
created_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
created_by: z.string().optional(),
|
||||
deleted_tools: z.array(zTrialDeletedTool).optional(),
|
||||
description: z.string().optional(),
|
||||
enable_api: z.boolean().optional(),
|
||||
enable_site: z.boolean().optional(),
|
||||
icon: z.string().optional(),
|
||||
icon_background: z.string().optional(),
|
||||
icon_type: z.string().optional(),
|
||||
icon_url: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
max_active_requests: z.int().optional(),
|
||||
mode: z.string().optional(),
|
||||
model_config: zTrialAppModelConfig.optional(),
|
||||
name: z.string().optional(),
|
||||
permission_keys: z.array(z.string()).optional(),
|
||||
site: zTrialSite.optional(),
|
||||
tags: z.array(zTrialTag).optional(),
|
||||
updated_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
updated_by: z.string().optional(),
|
||||
use_icon_as_answer_icon: z.boolean().optional(),
|
||||
workflow: zTrialWorkflowPartial.optional(),
|
||||
})
|
||||
|
||||
export const zJsonValue = z
|
||||
.union([
|
||||
z.string(),
|
||||
z.int(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.record(z.string(), z.unknown()),
|
||||
z.array(z.unknown()),
|
||||
])
|
||||
.nullable()
|
||||
|
||||
/**
|
||||
* GeneratedAppResponse
|
||||
* Tag
|
||||
*/
|
||||
export const zGeneratedAppResponse = zJsonValue
|
||||
|
||||
export const zTrialDataset = z.object({
|
||||
created_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
created_by: z.string().optional(),
|
||||
data_source_type: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
indexing_technique: z.string().optional(),
|
||||
name: z.string().optional(),
|
||||
permission: z.string().optional(),
|
||||
permission_keys: z.array(z.string()).optional(),
|
||||
export const zTag = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
type: z.string(),
|
||||
})
|
||||
|
||||
export const zTrialDatasetList = z.object({
|
||||
data: z.array(zTrialDataset).optional(),
|
||||
has_more: z.boolean().optional(),
|
||||
limit: z.int().optional(),
|
||||
page: z.int().optional(),
|
||||
total: z.int().optional(),
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* ModelConfig
|
||||
*/
|
||||
export const zModelConfig = z.object({
|
||||
agent_mode: zJsonValue.nullish(),
|
||||
annotation_reply: zJsonValue.nullish(),
|
||||
chat_prompt_config: zJsonValue.nullish(),
|
||||
completion_prompt_config: zJsonValue.nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
dataset_configs: zJsonValue.nullish(),
|
||||
dataset_query_variable: z.string().nullish(),
|
||||
external_data_tools: zJsonValue.nullish(),
|
||||
file_upload: zJsonValue.nullish(),
|
||||
model: zJsonValue.nullish(),
|
||||
more_like_this: zJsonValue.nullish(),
|
||||
opening_statement: z.string().nullish(),
|
||||
pre_prompt: z.string().nullish(),
|
||||
prompt_type: z.string().nullish(),
|
||||
retriever_resource: zJsonValue.nullish(),
|
||||
sensitive_word_avoidance: zJsonValue.nullish(),
|
||||
speech_to_text: zJsonValue.nullish(),
|
||||
suggested_questions: zJsonValue.nullish(),
|
||||
suggested_questions_after_answer: zJsonValue.nullish(),
|
||||
text_to_speech: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
user_input_form: zJsonValue.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* WorkflowPartial
|
||||
*/
|
||||
export const zWorkflowPartial = z.object({
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
id: z.string(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* AppDetailWithSite
|
||||
*/
|
||||
export const zAppDetailWithSite = z.object({
|
||||
access_mode: z.string().nullish(),
|
||||
api_base_url: z.string().nullish(),
|
||||
app_id: z.string().nullish(),
|
||||
bound_agent_id: z.string().nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
deleted_tools: z.array(zDeletedTool).optional(),
|
||||
description: z.string().nullish(),
|
||||
enable_api: z.boolean(),
|
||||
enable_site: z.boolean(),
|
||||
icon: z.string().nullish(),
|
||||
icon_background: z.string().nullish(),
|
||||
icon_type: z.string().nullish(),
|
||||
icon_url: z.string().nullable(),
|
||||
id: z.string(),
|
||||
maintainer: z.string().nullish(),
|
||||
max_active_requests: z.int().nullish(),
|
||||
mode: z.string(),
|
||||
model_config: zModelConfig.nullish(),
|
||||
name: z.string(),
|
||||
permission_keys: z.array(z.string()).optional(),
|
||||
site: zSite.nullish(),
|
||||
tags: z.array(zTag).optional(),
|
||||
tracing: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
use_icon_as_answer_icon: z.boolean().nullish(),
|
||||
workflow: zWorkflowPartial.nullish(),
|
||||
})
|
||||
|
||||
export const zJsonObject = z.record(z.string(), z.unknown())
|
||||
@ -329,93 +184,235 @@ export const zParameters = z.object({
|
||||
user_input_form: z.array(zJsonObject),
|
||||
})
|
||||
|
||||
export const zTrialConversationVariable = z.object({
|
||||
description: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
name: z.string().optional(),
|
||||
value: z
|
||||
.union([
|
||||
z.string(),
|
||||
z.int(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.record(z.string(), z.unknown()),
|
||||
z.array(z.unknown()),
|
||||
])
|
||||
.nullish(),
|
||||
value_type: z.string().optional(),
|
||||
})
|
||||
|
||||
export const zTrialSimpleAccount = z.object({
|
||||
email: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
name: z.string().optional(),
|
||||
})
|
||||
|
||||
export const zTrialPipelineVariable = z.object({
|
||||
allow_file_extension: z.array(z.string()).optional(),
|
||||
allow_file_upload_methods: z.array(z.string()).optional(),
|
||||
allowed_file_types: z.array(z.string()).optional(),
|
||||
belong_to_node_id: z.string().optional(),
|
||||
default_value: z
|
||||
.union([
|
||||
z.string(),
|
||||
z.int(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.record(z.string(), z.unknown()),
|
||||
z.array(z.unknown()),
|
||||
])
|
||||
.nullish(),
|
||||
label: z.string().optional(),
|
||||
max_length: z.int().optional(),
|
||||
options: z.array(z.string()).optional(),
|
||||
placeholder: z.string().optional(),
|
||||
required: z.boolean().optional(),
|
||||
tooltips: z.string().optional(),
|
||||
type: z.string().optional(),
|
||||
unit: z.string().optional(),
|
||||
variable: z.string().optional(),
|
||||
})
|
||||
|
||||
export const zTrialWorkflow = z.object({
|
||||
conversation_variables: z.array(zTrialConversationVariable).optional(),
|
||||
created_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
created_by: zTrialSimpleAccount.optional(),
|
||||
environment_variables: z.array(z.record(z.string(), z.unknown())).optional(),
|
||||
features: z.record(z.string(), z.unknown()).optional(),
|
||||
graph: z.record(z.string(), z.unknown()).optional(),
|
||||
hash: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
marked_comment: z.string().optional(),
|
||||
marked_name: z.string().optional(),
|
||||
rag_pipeline_variables: z.array(zTrialPipelineVariable).optional(),
|
||||
tool_published: z.boolean().optional(),
|
||||
updated_at: z.coerce
|
||||
.bigint()
|
||||
.min(BigInt('-9223372036854775808'), {
|
||||
error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
|
||||
})
|
||||
.max(BigInt('9223372036854775807'), {
|
||||
error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
|
||||
})
|
||||
.optional(),
|
||||
updated_by: zTrialSimpleAccount.optional(),
|
||||
version: z.string().optional(),
|
||||
/**
|
||||
* WorkflowConversationVariableResponse
|
||||
*/
|
||||
export const zWorkflowConversationVariableResponse = z.object({
|
||||
description: z.string(),
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
value: z.unknown(),
|
||||
value_type: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* GeneratedAppResponse
|
||||
* SimpleAccountResponse
|
||||
*/
|
||||
export const zGeneratedAppResponseWritable = zJsonValue
|
||||
export const zSimpleAccountResponse = z.object({
|
||||
email: z.string(),
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* WorkflowEnvironmentVariableResponse
|
||||
*/
|
||||
export const zWorkflowEnvironmentVariableResponse = z.object({
|
||||
description: z.string(),
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
value: z.unknown(),
|
||||
value_type: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* PipelineVariableResponse
|
||||
*/
|
||||
export const zPipelineVariableResponse = z.object({
|
||||
allowed_file_extensions: z.array(z.string()).nullish(),
|
||||
allowed_file_types: z.array(z.string()).nullish(),
|
||||
allowed_file_upload_methods: z.array(z.string()).nullish(),
|
||||
belong_to_node_id: z.string(),
|
||||
default_value: z.unknown().optional(),
|
||||
label: z.string(),
|
||||
max_length: z.int().nullish(),
|
||||
options: z.array(z.string()).nullish(),
|
||||
placeholder: z.string().nullish(),
|
||||
required: z.boolean(),
|
||||
tooltips: z.string().nullish(),
|
||||
type: z.string(),
|
||||
unit: z.string().nullish(),
|
||||
variable: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* WorkflowResponse
|
||||
*/
|
||||
export const zWorkflowResponse = z.object({
|
||||
conversation_variables: z.array(zWorkflowConversationVariableResponse),
|
||||
created_at: z.int(),
|
||||
created_by: zSimpleAccountResponse.nullish(),
|
||||
environment_variables: z.array(zWorkflowEnvironmentVariableResponse),
|
||||
features: z.record(z.string(), z.unknown()),
|
||||
graph: z.record(z.string(), z.unknown()),
|
||||
hash: z.string(),
|
||||
id: z.string(),
|
||||
marked_comment: z.string(),
|
||||
marked_name: z.string(),
|
||||
rag_pipeline_variables: z.array(zPipelineVariableResponse),
|
||||
tool_published: z.boolean(),
|
||||
updated_at: z.int(),
|
||||
updated_by: zSimpleAccountResponse.nullish(),
|
||||
version: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetDocMetadataResponse
|
||||
*/
|
||||
export const zDatasetDocMetadataResponse = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
type: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetExternalKnowledgeInfoResponse
|
||||
*/
|
||||
export const zDatasetExternalKnowledgeInfoResponse = z.object({
|
||||
external_knowledge_api_endpoint: z.string().nullish(),
|
||||
external_knowledge_api_id: z.string().nullish(),
|
||||
external_knowledge_api_name: z.string().nullish(),
|
||||
external_knowledge_id: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetExternalRetrievalModelResponse
|
||||
*/
|
||||
export const zDatasetExternalRetrievalModelResponse = z.object({
|
||||
score_threshold: z.number().nullish(),
|
||||
score_threshold_enabled: z.boolean().nullish(),
|
||||
top_k: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetIconInfoResponse
|
||||
*/
|
||||
export const zDatasetIconInfoResponse = z.object({
|
||||
icon: z.string().nullish(),
|
||||
icon_background: z.string().nullish(),
|
||||
icon_type: z.string().nullish(),
|
||||
icon_url: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetSummaryIndexSettingResponse
|
||||
*/
|
||||
export const zDatasetSummaryIndexSettingResponse = z.object({
|
||||
enable: z.boolean().nullish(),
|
||||
model_name: z.string().nullish(),
|
||||
model_provider_name: z.string().nullish(),
|
||||
summary_prompt: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetTagResponse
|
||||
*/
|
||||
export const zDatasetTagResponse = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
type: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetRerankingModelResponse
|
||||
*/
|
||||
export const zDatasetRerankingModelResponse = z.object({
|
||||
reranking_model_name: z.string().nullish(),
|
||||
reranking_provider_name: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetKeywordSettingResponse
|
||||
*/
|
||||
export const zDatasetKeywordSettingResponse = z.object({
|
||||
keyword_weight: z.number().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetVectorSettingResponse
|
||||
*/
|
||||
export const zDatasetVectorSettingResponse = z.object({
|
||||
embedding_model_name: z.string().nullish(),
|
||||
embedding_provider_name: z.string().nullish(),
|
||||
vector_weight: z.number().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetWeightedScoreResponse
|
||||
*/
|
||||
export const zDatasetWeightedScoreResponse = z.object({
|
||||
keyword_setting: zDatasetKeywordSettingResponse.optional(),
|
||||
vector_setting: zDatasetVectorSettingResponse.optional(),
|
||||
weight_type: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* DatasetRetrievalModelResponse
|
||||
*/
|
||||
export const zDatasetRetrievalModelResponse = z.object({
|
||||
reranking_enable: z.boolean(),
|
||||
reranking_mode: z.string().nullish(),
|
||||
reranking_model: zDatasetRerankingModelResponse.optional(),
|
||||
score_threshold: z.number().nullish(),
|
||||
score_threshold_enabled: z.boolean(),
|
||||
search_method: z.string(),
|
||||
top_k: z.int(),
|
||||
weights: zDatasetWeightedScoreResponse.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* TrialDatasetListItemResponse
|
||||
*/
|
||||
export const zTrialDatasetListItemResponse = z.object({
|
||||
app_count: z.int(),
|
||||
author_name: z.string().nullable(),
|
||||
built_in_field_enabled: z.boolean(),
|
||||
chunk_structure: z.string().nullable(),
|
||||
created_at: z.int(),
|
||||
created_by: z.string(),
|
||||
data_source_type: z.string().nullable(),
|
||||
description: z.string().nullable(),
|
||||
doc_form: z.string().nullable(),
|
||||
doc_metadata: z.array(zDatasetDocMetadataResponse),
|
||||
document_count: z.int(),
|
||||
embedding_available: z.boolean().nullish(),
|
||||
embedding_model: z.string().nullable(),
|
||||
embedding_model_provider: z.string().nullable(),
|
||||
enable_api: z.boolean(),
|
||||
external_knowledge_info: zDatasetExternalKnowledgeInfoResponse.optional(),
|
||||
external_retrieval_model: zDatasetExternalRetrievalModelResponse.nullable(),
|
||||
icon_info: zDatasetIconInfoResponse.optional(),
|
||||
id: z.string(),
|
||||
indexing_technique: z.string().nullable(),
|
||||
is_multimodal: z.boolean(),
|
||||
is_published: z.boolean(),
|
||||
maintainer: z.string().nullish(),
|
||||
name: z.string(),
|
||||
permission: z.string(),
|
||||
permission_keys: z.array(z.string()).optional(),
|
||||
pipeline_id: z.string().nullable(),
|
||||
provider: z.string(),
|
||||
retrieval_model_dict: zDatasetRetrievalModelResponse,
|
||||
runtime_mode: z.string().nullable(),
|
||||
summary_index_setting: zDatasetSummaryIndexSettingResponse.optional(),
|
||||
tags: z.array(zDatasetTagResponse),
|
||||
total_available_documents: z.int(),
|
||||
total_documents: z.int(),
|
||||
updated_at: z.int(),
|
||||
updated_by: z.string().nullable(),
|
||||
word_count: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* TrialDatasetListResponse
|
||||
*/
|
||||
export const zTrialDatasetListResponse = z.object({
|
||||
data: z.array(zTrialDatasetListItemResponse),
|
||||
has_more: z.boolean(),
|
||||
limit: z.int(),
|
||||
page: z.int(),
|
||||
total: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Site
|
||||
@ -436,14 +433,47 @@ export const zSiteWritable = z.object({
|
||||
use_icon_as_answer_icon: z.boolean(),
|
||||
})
|
||||
|
||||
/**
|
||||
* AppDetailWithSite
|
||||
*/
|
||||
export const zAppDetailWithSiteWritable = z.object({
|
||||
access_mode: z.string().nullish(),
|
||||
api_base_url: z.string().nullish(),
|
||||
app_id: z.string().nullish(),
|
||||
bound_agent_id: z.string().nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
deleted_tools: z.array(zDeletedTool).optional(),
|
||||
description: z.string().nullish(),
|
||||
enable_api: z.boolean(),
|
||||
enable_site: z.boolean(),
|
||||
icon: z.string().nullish(),
|
||||
icon_background: z.string().nullish(),
|
||||
icon_type: z.string().nullish(),
|
||||
id: z.string(),
|
||||
maintainer: z.string().nullish(),
|
||||
max_active_requests: z.int().nullish(),
|
||||
mode: z.string(),
|
||||
model_config: zModelConfig.nullish(),
|
||||
name: z.string(),
|
||||
permission_keys: z.array(z.string()).optional(),
|
||||
site: zSiteWritable.nullish(),
|
||||
tags: z.array(zTag).optional(),
|
||||
tracing: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
use_icon_as_answer_icon: z.boolean().nullish(),
|
||||
workflow: zWorkflowPartial.nullish(),
|
||||
})
|
||||
|
||||
export const zGetTrialAppsByAppIdPath = z.object({
|
||||
app_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
* App detail retrieved successfully
|
||||
*/
|
||||
export const zGetTrialAppsByAppIdResponse = zTrialAppDetailWithSite
|
||||
export const zGetTrialAppsByAppIdResponse = zAppDetailWithSite
|
||||
|
||||
export const zPostTrialAppsByAppIdAudioToTextPath = z.object({
|
||||
app_id: z.uuid(),
|
||||
@ -454,28 +484,6 @@ export const zPostTrialAppsByAppIdAudioToTextPath = z.object({
|
||||
*/
|
||||
export const zPostTrialAppsByAppIdAudioToTextResponse = zAudioTranscriptResponse
|
||||
|
||||
export const zPostTrialAppsByAppIdChatMessagesBody = zChatRequest
|
||||
|
||||
export const zPostTrialAppsByAppIdChatMessagesPath = z.object({
|
||||
app_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostTrialAppsByAppIdChatMessagesResponse = zGeneratedAppResponse
|
||||
|
||||
export const zPostTrialAppsByAppIdCompletionMessagesBody = zCompletionRequest
|
||||
|
||||
export const zPostTrialAppsByAppIdCompletionMessagesPath = z.object({
|
||||
app_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostTrialAppsByAppIdCompletionMessagesResponse = zGeneratedAppResponse
|
||||
|
||||
export const zGetTrialAppsByAppIdDatasetsPath = z.object({
|
||||
app_id: z.uuid(),
|
||||
})
|
||||
@ -489,7 +497,7 @@ export const zGetTrialAppsByAppIdDatasetsQuery = z.object({
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zGetTrialAppsByAppIdDatasetsResponse = zTrialDatasetList
|
||||
export const zGetTrialAppsByAppIdDatasetsResponse = zTrialDatasetListResponse
|
||||
|
||||
export const zGetTrialAppsByAppIdMessagesByMessageIdSuggestedQuestionsPath = z.object({
|
||||
app_id: z.uuid(),
|
||||
@ -536,20 +544,9 @@ export const zGetTrialAppsByAppIdWorkflowsPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
* Workflow detail retrieved successfully
|
||||
*/
|
||||
export const zGetTrialAppsByAppIdWorkflowsResponse = zTrialWorkflow
|
||||
|
||||
export const zPostTrialAppsByAppIdWorkflowsRunBody = zWorkflowRunRequest
|
||||
|
||||
export const zPostTrialAppsByAppIdWorkflowsRunPath = z.object({
|
||||
app_id: z.uuid(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostTrialAppsByAppIdWorkflowsRunResponse = zGeneratedAppResponse
|
||||
export const zGetTrialAppsByAppIdWorkflowsResponse = zWorkflowResponse
|
||||
|
||||
export const zPostTrialAppsByAppIdWorkflowsTasksByTaskIdStopPath = z.object({
|
||||
app_id: z.uuid(),
|
||||
|
||||
@ -17,15 +17,33 @@ export type WorkflowGeneratePayload = {
|
||||
export type GeneratorResponse = unknown
|
||||
|
||||
export type ModelConfig = {
|
||||
completion_params?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
mode: LlmMode
|
||||
name: string
|
||||
provider: string
|
||||
agent_mode?: JsonValue | null
|
||||
annotation_reply?: JsonValue | null
|
||||
chat_prompt_config?: JsonValue | null
|
||||
completion_prompt_config?: JsonValue | null
|
||||
created_at?: number | null
|
||||
created_by?: string | null
|
||||
dataset_configs?: JsonValue | null
|
||||
dataset_query_variable?: string | null
|
||||
external_data_tools?: JsonValue | null
|
||||
file_upload?: JsonValue | null
|
||||
model?: JsonValue | null
|
||||
more_like_this?: JsonValue | null
|
||||
opening_statement?: string | null
|
||||
pre_prompt?: string | null
|
||||
prompt_type?: string | null
|
||||
retriever_resource?: JsonValue | null
|
||||
sensitive_word_avoidance?: JsonValue | null
|
||||
speech_to_text?: JsonValue | null
|
||||
suggested_questions?: JsonValue | null
|
||||
suggested_questions_after_answer?: JsonValue | null
|
||||
text_to_speech?: JsonValue | null
|
||||
updated_at?: number | null
|
||||
updated_by?: string | null
|
||||
user_input_form?: JsonValue | null
|
||||
}
|
||||
|
||||
export type LlmMode = 'chat' | 'completion'
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type PostWorkflowGenerateData = {
|
||||
body: WorkflowGeneratePayload
|
||||
|
||||
@ -7,21 +7,36 @@ import * as z from 'zod'
|
||||
*/
|
||||
export const zGeneratorResponse = z.unknown()
|
||||
|
||||
/**
|
||||
* LLMMode
|
||||
*
|
||||
* Enum class for large language model mode.
|
||||
*/
|
||||
export const zLlmMode = z.enum(['chat', 'completion'])
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* ModelConfig
|
||||
*/
|
||||
export const zModelConfig = z.object({
|
||||
completion_params: z.record(z.string(), z.unknown()).optional(),
|
||||
mode: zLlmMode,
|
||||
name: z.string(),
|
||||
provider: z.string(),
|
||||
agent_mode: zJsonValue.nullish(),
|
||||
annotation_reply: zJsonValue.nullish(),
|
||||
chat_prompt_config: zJsonValue.nullish(),
|
||||
completion_prompt_config: zJsonValue.nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
created_by: z.string().nullish(),
|
||||
dataset_configs: zJsonValue.nullish(),
|
||||
dataset_query_variable: z.string().nullish(),
|
||||
external_data_tools: zJsonValue.nullish(),
|
||||
file_upload: zJsonValue.nullish(),
|
||||
model: zJsonValue.nullish(),
|
||||
more_like_this: zJsonValue.nullish(),
|
||||
opening_statement: z.string().nullish(),
|
||||
pre_prompt: z.string().nullish(),
|
||||
prompt_type: z.string().nullish(),
|
||||
retriever_resource: zJsonValue.nullish(),
|
||||
sensitive_word_avoidance: zJsonValue.nullish(),
|
||||
speech_to_text: zJsonValue.nullish(),
|
||||
suggested_questions: zJsonValue.nullish(),
|
||||
suggested_questions_after_answer: zJsonValue.nullish(),
|
||||
text_to_speech: zJsonValue.nullish(),
|
||||
updated_at: z.int().nullish(),
|
||||
updated_by: z.string().nullish(),
|
||||
user_input_form: zJsonValue.nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@ -104,8 +104,8 @@ export type SnippetUseCountResponse = {
|
||||
use_count: number
|
||||
}
|
||||
|
||||
export type AccountWithRoleList = {
|
||||
accounts: Array<AccountWithRole>
|
||||
export type AccountWithRoleListResponse = {
|
||||
accounts: Array<AccountWithRoleResponse>
|
||||
}
|
||||
|
||||
export type DefaultModelDataResponse = {
|
||||
@ -921,7 +921,7 @@ export type AnonymousInlineModel7B8B49Ca164e = {
|
||||
type?: string
|
||||
}
|
||||
|
||||
export type AccountWithRole = {
|
||||
export type AccountWithRoleResponse = {
|
||||
avatar?: string | null
|
||||
created_at?: number | null
|
||||
email: string
|
||||
@ -1777,7 +1777,7 @@ export type GetWorkspacesCurrentDatasetOperatorsData = {
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentDatasetOperatorsResponses = {
|
||||
200: AccountWithRoleList
|
||||
200: AccountWithRoleListResponse
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentDatasetOperatorsResponse
|
||||
@ -2004,7 +2004,7 @@ export type GetWorkspacesCurrentMembersData = {
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentMembersResponses = {
|
||||
200: AccountWithRoleList
|
||||
200: AccountWithRoleListResponse
|
||||
}
|
||||
|
||||
export type GetWorkspacesCurrentMembersResponse
|
||||
|
||||
@ -889,9 +889,9 @@ export const zSnippetPagination = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* AccountWithRole
|
||||
* AccountWithRoleResponse
|
||||
*/
|
||||
export const zAccountWithRole = z.object({
|
||||
export const zAccountWithRoleResponse = z.object({
|
||||
avatar: z.string().nullish(),
|
||||
created_at: z.int().nullish(),
|
||||
email: z.string(),
|
||||
@ -905,10 +905,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),
|
||||
})
|
||||
|
||||
/**
|
||||
@ -2274,7 +2274,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']),
|
||||
@ -2378,7 +2378,7 @@ export const zPatchWorkspacesCurrentEndpointsByIdResponse = zEndpointUpdateRespo
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zGetWorkspacesCurrentMembersResponse = zAccountWithRoleList
|
||||
export const zGetWorkspacesCurrentMembersResponse = zAccountWithRoleListResponse
|
||||
|
||||
export const zPostWorkspacesCurrentMembersInviteEmailBody = zMemberInvitePayload
|
||||
|
||||
|
||||
@ -567,7 +567,7 @@ export type DatasourceNodeRunPayload = {
|
||||
export type DatasourcePluginListResponse = Array<DatasourcePluginResponse>
|
||||
|
||||
export type DatasourcePluginResponse = {
|
||||
credentials: Array<DatasourceCredentialInfoResponse>
|
||||
credentials?: Array<DatasourceCredentialInfoResponse>
|
||||
datasource_type?: string | null
|
||||
node_id?: string | null
|
||||
plugin_id?: string | null
|
||||
@ -841,8 +841,6 @@ export type FormInputConfig
|
||||
type: 'file-list'
|
||||
} & FileListInputConfig)
|
||||
|
||||
export type GeneratedAppResponse = JsonValue
|
||||
|
||||
export type HitTestingChildChunk = {
|
||||
content: string
|
||||
id: string
|
||||
@ -1004,16 +1002,7 @@ export type JsonObject = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export type JsonValue
|
||||
= | string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type JsonValueType = unknown
|
||||
|
||||
@ -1414,7 +1403,7 @@ export type SelectInputConfig = {
|
||||
type?: 'select'
|
||||
}
|
||||
|
||||
export type SimpleAccount = {
|
||||
export type SimpleAccountResponse = {
|
||||
email: string
|
||||
id: string
|
||||
name: string
|
||||
@ -1572,7 +1561,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
|
||||
@ -1673,8 +1662,6 @@ export type WorkflowRunResponse = {
|
||||
workflow_id: string
|
||||
}
|
||||
|
||||
export type GeneratedAppResponseWritable = JsonValue
|
||||
|
||||
export type HumanInputFormSubmitResponseWritable = {
|
||||
[key: string]: never
|
||||
}
|
||||
@ -1893,16 +1880,32 @@ export type PostChatMessagesData = {
|
||||
}
|
||||
|
||||
export type PostChatMessagesErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
429: unknown
|
||||
500: unknown
|
||||
400: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
401: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
403: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
404: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
429: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
500: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostChatMessagesError = PostChatMessagesErrors[keyof PostChatMessagesErrors]
|
||||
|
||||
export type PostChatMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostChatMessagesResponse = PostChatMessagesResponses[keyof PostChatMessagesResponses]
|
||||
@ -1938,16 +1941,33 @@ export type PostCompletionMessagesData = {
|
||||
}
|
||||
|
||||
export type PostCompletionMessagesErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
429: unknown
|
||||
500: unknown
|
||||
400: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
401: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
403: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
404: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
429: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
500: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostCompletionMessagesError
|
||||
= PostCompletionMessagesErrors[keyof PostCompletionMessagesErrors]
|
||||
|
||||
export type PostCompletionMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostCompletionMessagesResponse
|
||||
@ -3188,13 +3208,24 @@ export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunData = {
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunErrors = {
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
401: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
403: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
404: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunError
|
||||
= PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunErrors[keyof PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunErrors]
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponse
|
||||
@ -3210,14 +3241,27 @@ export type PostDatasetsByDatasetIdPipelineRunData = {
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineRunErrors = {
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
500: unknown
|
||||
401: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
403: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
404: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
500: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineRunError
|
||||
= PostDatasetsByDatasetIdPipelineRunErrors[keyof PostDatasetsByDatasetIdPipelineRunErrors]
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineRunResponse
|
||||
@ -3622,16 +3666,32 @@ export type PostWorkflowsRunData = {
|
||||
}
|
||||
|
||||
export type PostWorkflowsRunErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
429: unknown
|
||||
500: unknown
|
||||
400: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
401: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
403: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
404: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
429: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
500: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostWorkflowsRunError = PostWorkflowsRunErrors[keyof PostWorkflowsRunErrors]
|
||||
|
||||
export type PostWorkflowsRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostWorkflowsRunResponse = PostWorkflowsRunResponses[keyof PostWorkflowsRunResponses]
|
||||
@ -3692,16 +3752,33 @@ export type PostWorkflowsByWorkflowIdRunData = {
|
||||
}
|
||||
|
||||
export type PostWorkflowsByWorkflowIdRunErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
429: unknown
|
||||
500: unknown
|
||||
400: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
401: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
403: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
404: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
429: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
500: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostWorkflowsByWorkflowIdRunError
|
||||
= PostWorkflowsByWorkflowIdRunErrors[keyof PostWorkflowsByWorkflowIdRunErrors]
|
||||
|
||||
export type PostWorkflowsByWorkflowIdRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
200: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type PostWorkflowsByWorkflowIdRunResponse
|
||||
|
||||
@ -698,7 +698,7 @@ export const zDatasourceNodeRunPayload = z.object({
|
||||
* DatasourcePluginResponse
|
||||
*/
|
||||
export const zDatasourcePluginResponse = z.object({
|
||||
credentials: z.array(zDatasourceCredentialInfoResponse),
|
||||
credentials: z.array(zDatasourceCredentialInfoResponse).optional(),
|
||||
datasource_type: z.string().nullish(),
|
||||
node_id: z.string().nullish(),
|
||||
plugin_id: z.string().nullish(),
|
||||
@ -1114,16 +1114,7 @@ export const zIndexInfoResponse = z.object({
|
||||
|
||||
export const zJsonObject = z.record(z.string(), z.unknown())
|
||||
|
||||
export const zJsonValue = z
|
||||
.union([
|
||||
z.string(),
|
||||
z.int(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.record(z.string(), z.unknown()),
|
||||
z.array(z.unknown()),
|
||||
])
|
||||
.nullable()
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* AgentThought
|
||||
@ -1142,11 +1133,6 @@ export const zAgentThought = z.object({
|
||||
tool_labels: zJsonValue,
|
||||
})
|
||||
|
||||
/**
|
||||
* GeneratedAppResponse
|
||||
*/
|
||||
export const zGeneratedAppResponse = zJsonValue
|
||||
|
||||
export const zJsonValueType = z.unknown()
|
||||
|
||||
export const zJsonValue2 = z.unknown()
|
||||
@ -1676,9 +1662,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(),
|
||||
@ -2196,7 +2182,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(),
|
||||
@ -2288,11 +2274,6 @@ export const zWorkflowRunResponse = z.object({
|
||||
workflow_id: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* GeneratedAppResponse
|
||||
*/
|
||||
export const zGeneratedAppResponseWritable = zJsonValue
|
||||
|
||||
/**
|
||||
* HumanInputFormSubmitResponse
|
||||
*/
|
||||
@ -2409,7 +2390,7 @@ export const zPostChatMessagesBody = zChatRequestPayloadWithUser
|
||||
* - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object.
|
||||
* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events.
|
||||
*/
|
||||
export const zPostChatMessagesResponse = zGeneratedAppResponse
|
||||
export const zPostChatMessagesResponse = z.record(z.string(), z.unknown())
|
||||
|
||||
export const zPostChatMessagesByTaskIdStopBody = zRequiredServiceApiUserPayload
|
||||
|
||||
@ -2430,7 +2411,7 @@ export const zPostCompletionMessagesBody = zCompletionRequestPayloadWithUser
|
||||
* - If `response_mode` is `blocking`, returns `application/json` with a `CompletionResponse` object.
|
||||
* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkCompletionEvent` objects.
|
||||
*/
|
||||
export const zPostCompletionMessagesResponse = zGeneratedAppResponse
|
||||
export const zPostCompletionMessagesResponse = z.record(z.string(), z.unknown())
|
||||
|
||||
export const zPostCompletionMessagesByTaskIdStopBody = zRequiredServiceApiUserPayload
|
||||
|
||||
@ -3061,8 +3042,10 @@ export const zPostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunPath = z.
|
||||
/**
|
||||
* Streaming response with node execution events.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponse
|
||||
= zGeneratedAppResponse
|
||||
export const zPostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponse = z.record(
|
||||
z.string(),
|
||||
z.unknown(),
|
||||
)
|
||||
|
||||
export const zPostDatasetsByDatasetIdPipelineRunBody = zPipelineRunApiEntity
|
||||
|
||||
@ -3073,7 +3056,7 @@ export const zPostDatasetsByDatasetIdPipelineRunPath = z.object({
|
||||
/**
|
||||
* Pipeline execution result. Format depends on `response_mode`: streaming returns a `text/event-stream`, blocking returns a JSON object.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdPipelineRunResponse = zGeneratedAppResponse
|
||||
export const zPostDatasetsByDatasetIdPipelineRunResponse = z.record(z.string(), z.unknown())
|
||||
|
||||
export const zPostDatasetsByDatasetIdRetrieveBody = zHitTestingPayload
|
||||
|
||||
@ -3250,7 +3233,7 @@ export const zPostWorkflowsRunBody = zWorkflowRunPayloadWithUser
|
||||
* - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object.
|
||||
* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects.
|
||||
*/
|
||||
export const zPostWorkflowsRunResponse = zGeneratedAppResponse
|
||||
export const zPostWorkflowsRunResponse = z.record(z.string(), z.unknown())
|
||||
|
||||
export const zGetWorkflowsRunByWorkflowRunIdPath = z.object({
|
||||
workflow_run_id: z.string(),
|
||||
@ -3284,7 +3267,7 @@ export const zPostWorkflowsByWorkflowIdRunPath = z.object({
|
||||
* - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object.
|
||||
* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects.
|
||||
*/
|
||||
export const zPostWorkflowsByWorkflowIdRunResponse = zGeneratedAppResponse
|
||||
export const zPostWorkflowsByWorkflowIdRunResponse = z.record(z.string(), z.unknown())
|
||||
|
||||
export const zGetWorkspacesCurrentModelsModelTypesByModelTypePath = z.object({
|
||||
model_type: z.enum(['llm', 'moderation', 'rerank', 'speech2text', 'text-embedding', 'tts']),
|
||||
|
||||
@ -14,9 +14,6 @@ import {
|
||||
zGetFormHumanInputByFormTokenResponse,
|
||||
zGetLoginStatusQuery,
|
||||
zGetLoginStatusResponse,
|
||||
zGetMessagesByMessageIdMoreLikeThisPath,
|
||||
zGetMessagesByMessageIdMoreLikeThisQuery,
|
||||
zGetMessagesByMessageIdMoreLikeThisResponse,
|
||||
zGetMessagesByMessageIdSuggestedQuestionsPath,
|
||||
zGetMessagesByMessageIdSuggestedQuestionsResponse,
|
||||
zGetMessagesQuery,
|
||||
@ -42,14 +39,10 @@ import {
|
||||
zPatchConversationsByCIdUnpinPath,
|
||||
zPatchConversationsByCIdUnpinResponse,
|
||||
zPostAudioToTextResponse,
|
||||
zPostChatMessagesBody,
|
||||
zPostChatMessagesByTaskIdStopPath,
|
||||
zPostChatMessagesByTaskIdStopResponse,
|
||||
zPostChatMessagesResponse,
|
||||
zPostCompletionMessagesBody,
|
||||
zPostCompletionMessagesByTaskIdStopPath,
|
||||
zPostCompletionMessagesByTaskIdStopResponse,
|
||||
zPostCompletionMessagesResponse,
|
||||
zPostConversationsByCIdNameBody,
|
||||
zPostConversationsByCIdNamePath,
|
||||
zPostConversationsByCIdNameQuery,
|
||||
@ -85,8 +78,6 @@ import {
|
||||
zPostSavedMessagesResponse,
|
||||
zPostTextToAudioBody,
|
||||
zPostTextToAudioResponse,
|
||||
zPostWorkflowsRunBody,
|
||||
zPostWorkflowsRunResponse,
|
||||
zPostWorkflowsTasksByTaskIdStopPath,
|
||||
zPostWorkflowsTasksByTaskIdStopResponse,
|
||||
} from './zod.gen'
|
||||
@ -135,30 +126,14 @@ export const byTaskId = {
|
||||
stop,
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a chat message for conversational applications.
|
||||
*/
|
||||
export const post3 = oc
|
||||
.route({
|
||||
description: 'Create a chat message for conversational applications.',
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postChatMessages',
|
||||
path: '/chat-messages',
|
||||
tags: ['web'],
|
||||
})
|
||||
.input(z.object({ body: zPostChatMessagesBody }))
|
||||
.output(zPostChatMessagesResponse)
|
||||
|
||||
export const chatMessages = {
|
||||
post: post3,
|
||||
byTaskId,
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop a running completion message task.
|
||||
*/
|
||||
export const post4 = oc
|
||||
export const post3 = oc
|
||||
.route({
|
||||
description: 'Stop a running completion message task.',
|
||||
inputStructure: 'detailed',
|
||||
@ -171,37 +146,21 @@ export const post4 = oc
|
||||
.output(zPostCompletionMessagesByTaskIdStopResponse)
|
||||
|
||||
export const stop2 = {
|
||||
post: post4,
|
||||
post: post3,
|
||||
}
|
||||
|
||||
export const byTaskId2 = {
|
||||
stop: stop2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a completion message for text generation applications.
|
||||
*/
|
||||
export const post5 = oc
|
||||
.route({
|
||||
description: 'Create a completion message for text generation applications.',
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postCompletionMessages',
|
||||
path: '/completion-messages',
|
||||
tags: ['web'],
|
||||
})
|
||||
.input(z.object({ body: zPostCompletionMessagesBody }))
|
||||
.output(zPostCompletionMessagesResponse)
|
||||
|
||||
export const completionMessages = {
|
||||
post: post5,
|
||||
byTaskId: byTaskId2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a specific conversation with a custom name or auto-generate one.
|
||||
*/
|
||||
export const post6 = oc
|
||||
export const post4 = oc
|
||||
.route({
|
||||
description: 'Rename a specific conversation with a custom name or auto-generate one.',
|
||||
inputStructure: 'detailed',
|
||||
@ -220,7 +179,7 @@ export const post6 = oc
|
||||
.output(zPostConversationsByCIdNameResponse)
|
||||
|
||||
export const name = {
|
||||
post: post6,
|
||||
post: post4,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -307,7 +266,7 @@ export const conversations = {
|
||||
/**
|
||||
* Verify email code and complete login
|
||||
*/
|
||||
export const post7 = oc
|
||||
export const post5 = oc
|
||||
.route({
|
||||
description: 'Verify email code and complete login',
|
||||
inputStructure: 'detailed',
|
||||
@ -320,13 +279,13 @@ export const post7 = oc
|
||||
.output(zPostEmailCodeLoginValidityResponse)
|
||||
|
||||
export const validity = {
|
||||
post: post7,
|
||||
post: post5,
|
||||
}
|
||||
|
||||
/**
|
||||
* Send email verification code for login
|
||||
*/
|
||||
export const post8 = oc
|
||||
export const post6 = oc
|
||||
.route({
|
||||
description: 'Send email verification code for login',
|
||||
inputStructure: 'detailed',
|
||||
@ -339,7 +298,7 @@ export const post8 = oc
|
||||
.output(zPostEmailCodeLoginResponse)
|
||||
|
||||
export const emailCodeLogin = {
|
||||
post: post8,
|
||||
post: post6,
|
||||
validity,
|
||||
}
|
||||
|
||||
@ -369,7 +328,7 @@ export const emailCodeLogin = {
|
||||
* FileTooLargeError: File exceeds size limit
|
||||
* UnsupportedFileTypeError: File type not supported
|
||||
*/
|
||||
export const post9 = oc
|
||||
export const post7 = oc
|
||||
.route({
|
||||
description:
|
||||
'Upload a file for use in web applications\nAccepts file uploads for use within web applications, supporting\nmultiple file types with automatic validation and storage.\n\nArgs:\n app_model: The associated application model\n end_user: The end user uploading the file\n\nForm Parameters:\n file: The file to upload (required)\n source: Optional source type (datasets or None)\n\nReturns:\n dict: File information including ID, URL, and metadata\n int: HTTP status code 201 for success\n\nRaises:\n NoFileUploadedError: No file provided in request\n TooManyFilesError: Multiple files provided (only one allowed)\n FilenameNotExistsError: File has no filename\n FileTooLargeError: File exceeds size limit\n UnsupportedFileTypeError: File type not supported',
|
||||
@ -384,7 +343,7 @@ export const post9 = oc
|
||||
.output(zPostFilesUploadResponse)
|
||||
|
||||
export const upload = {
|
||||
post: post9,
|
||||
post: post7,
|
||||
}
|
||||
|
||||
export const files = {
|
||||
@ -394,7 +353,7 @@ export const files = {
|
||||
/**
|
||||
* Reset user password with verification token
|
||||
*/
|
||||
export const post10 = oc
|
||||
export const post8 = oc
|
||||
.route({
|
||||
description: 'Reset user password with verification token',
|
||||
inputStructure: 'detailed',
|
||||
@ -407,13 +366,13 @@ export const post10 = oc
|
||||
.output(zPostForgotPasswordResetsResponse)
|
||||
|
||||
export const resets = {
|
||||
post: post10,
|
||||
post: post8,
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify password reset token validity
|
||||
*/
|
||||
export const post11 = oc
|
||||
export const post9 = oc
|
||||
.route({
|
||||
description: 'Verify password reset token validity',
|
||||
inputStructure: 'detailed',
|
||||
@ -426,13 +385,13 @@ export const post11 = oc
|
||||
.output(zPostForgotPasswordValidityResponse)
|
||||
|
||||
export const validity2 = {
|
||||
post: post11,
|
||||
post: post9,
|
||||
}
|
||||
|
||||
/**
|
||||
* Send password reset email
|
||||
*/
|
||||
export const post12 = oc
|
||||
export const post10 = oc
|
||||
.route({
|
||||
description: 'Send password reset email',
|
||||
inputStructure: 'detailed',
|
||||
@ -445,7 +404,7 @@ export const post12 = oc
|
||||
.output(zPostForgotPasswordResponse)
|
||||
|
||||
export const forgotPassword = {
|
||||
post: post12,
|
||||
post: post10,
|
||||
resets,
|
||||
validity: validity2,
|
||||
}
|
||||
@ -455,7 +414,7 @@ export const forgotPassword = {
|
||||
*
|
||||
* POST /api/form/human_input/<form_token>/upload-token
|
||||
*/
|
||||
export const post13 = oc
|
||||
export const post11 = oc
|
||||
.route({
|
||||
description: 'POST /api/form/human_input/<form_token>/upload-token',
|
||||
inputStructure: 'detailed',
|
||||
@ -469,7 +428,7 @@ export const post13 = oc
|
||||
.output(zPostFormHumanInputByFormTokenUploadTokenResponse)
|
||||
|
||||
export const uploadToken = {
|
||||
post: post13,
|
||||
post: post11,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -503,7 +462,7 @@ export const get2 = oc
|
||||
* "action": "Approve"
|
||||
* }
|
||||
*/
|
||||
export const post14 = oc
|
||||
export const post12 = oc
|
||||
.route({
|
||||
description:
|
||||
'POST /api/form/human_input/<form_token>\n\nRequest body:\n{\n "inputs": {\n "content": "User input content"\n },\n "action": "Approve"\n}',
|
||||
@ -524,7 +483,7 @@ export const post14 = oc
|
||||
|
||||
export const byFormToken = {
|
||||
get: get2,
|
||||
post: post14,
|
||||
post: post12,
|
||||
uploadToken,
|
||||
}
|
||||
|
||||
@ -539,7 +498,7 @@ export const form = {
|
||||
/**
|
||||
* Upload one local file or remote URL file for a HITL human input form
|
||||
*/
|
||||
export const post15 = oc
|
||||
export const post13 = oc
|
||||
.route({
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
@ -552,7 +511,7 @@ export const post15 = oc
|
||||
.output(zPostHumanInputFormsFilesResponse)
|
||||
|
||||
export const files2 = {
|
||||
post: post15,
|
||||
post: post13,
|
||||
}
|
||||
|
||||
export const humanInputForms = {
|
||||
@ -583,7 +542,7 @@ export const status = {
|
||||
*
|
||||
* Authenticate user for web application access
|
||||
*/
|
||||
export const post16 = oc
|
||||
export const post14 = oc
|
||||
.route({
|
||||
description: 'Authenticate user for web application access',
|
||||
inputStructure: 'detailed',
|
||||
@ -597,14 +556,14 @@ export const post16 = oc
|
||||
.output(zPostLoginResponse)
|
||||
|
||||
export const login = {
|
||||
post: post16,
|
||||
post: post14,
|
||||
status,
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout user from web application
|
||||
*/
|
||||
export const post17 = oc
|
||||
export const post15 = oc
|
||||
.route({
|
||||
description: 'Logout user from web application',
|
||||
inputStructure: 'detailed',
|
||||
@ -616,13 +575,13 @@ export const post17 = oc
|
||||
.output(zPostLogoutResponse)
|
||||
|
||||
export const logout = {
|
||||
post: post17,
|
||||
post: post15,
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit feedback (like/dislike) for a specific message.
|
||||
*/
|
||||
export const post18 = oc
|
||||
export const post16 = oc
|
||||
.route({
|
||||
description: 'Submit feedback (like/dislike) for a specific message.',
|
||||
inputStructure: 'detailed',
|
||||
@ -641,37 +600,13 @@ export const post18 = oc
|
||||
.output(zPostMessagesByMessageIdFeedbacksResponse)
|
||||
|
||||
export const feedbacks = {
|
||||
post: post18,
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new completion similar to an existing message (completion apps only).
|
||||
*/
|
||||
export const get4 = oc
|
||||
.route({
|
||||
description: 'Generate a new completion similar to an existing message (completion apps only).',
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
operationId: 'getMessagesByMessageIdMoreLikeThis',
|
||||
path: '/messages/{message_id}/more-like-this',
|
||||
tags: ['web'],
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
params: zGetMessagesByMessageIdMoreLikeThisPath,
|
||||
query: zGetMessagesByMessageIdMoreLikeThisQuery,
|
||||
}),
|
||||
)
|
||||
.output(zGetMessagesByMessageIdMoreLikeThisResponse)
|
||||
|
||||
export const moreLikeThis = {
|
||||
get: get4,
|
||||
post: post16,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get suggested follow-up questions after a message (chat apps only).
|
||||
*/
|
||||
export const get5 = oc
|
||||
export const get4 = oc
|
||||
.route({
|
||||
description: 'Get suggested follow-up questions after a message (chat apps only).',
|
||||
inputStructure: 'detailed',
|
||||
@ -684,19 +619,18 @@ export const get5 = oc
|
||||
.output(zGetMessagesByMessageIdSuggestedQuestionsResponse)
|
||||
|
||||
export const suggestedQuestions = {
|
||||
get: get5,
|
||||
get: get4,
|
||||
}
|
||||
|
||||
export const byMessageId = {
|
||||
feedbacks,
|
||||
moreLikeThis,
|
||||
suggestedQuestions,
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve paginated list of messages from a conversation in a chat application.
|
||||
*/
|
||||
export const get6 = oc
|
||||
export const get5 = oc
|
||||
.route({
|
||||
description: 'Retrieve paginated list of messages from a conversation in a chat application.',
|
||||
inputStructure: 'detailed',
|
||||
@ -709,7 +643,7 @@ export const get6 = oc
|
||||
.output(zGetMessagesResponse)
|
||||
|
||||
export const messages = {
|
||||
get: get6,
|
||||
get: get5,
|
||||
byMessageId,
|
||||
}
|
||||
|
||||
@ -718,7 +652,7 @@ export const messages = {
|
||||
*
|
||||
* Retrieve the metadata for a specific app.
|
||||
*/
|
||||
export const get7 = oc
|
||||
export const get6 = oc
|
||||
.route({
|
||||
description: 'Retrieve the metadata for a specific app.',
|
||||
inputStructure: 'detailed',
|
||||
@ -731,7 +665,7 @@ export const get7 = oc
|
||||
.output(zGetMetaResponse)
|
||||
|
||||
export const meta = {
|
||||
get: get7,
|
||||
get: get6,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -739,7 +673,7 @@ export const meta = {
|
||||
*
|
||||
* Retrieve the parameters for a specific app.
|
||||
*/
|
||||
export const get8 = oc
|
||||
export const get7 = oc
|
||||
.route({
|
||||
description: 'Retrieve the parameters for a specific app.',
|
||||
inputStructure: 'detailed',
|
||||
@ -752,13 +686,13 @@ export const get8 = oc
|
||||
.output(zGetParametersResponse)
|
||||
|
||||
export const parameters = {
|
||||
get: get8,
|
||||
get: get7,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get authentication passport for web application access
|
||||
*/
|
||||
export const get9 = oc
|
||||
export const get8 = oc
|
||||
.route({
|
||||
description: 'Get authentication passport for web application access',
|
||||
inputStructure: 'detailed',
|
||||
@ -771,7 +705,7 @@ export const get9 = oc
|
||||
.output(zGetPassportResponse)
|
||||
|
||||
export const passport = {
|
||||
get: get9,
|
||||
get: get8,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -797,7 +731,7 @@ export const passport = {
|
||||
* FileTooLargeError: File exceeds size limit
|
||||
* UnsupportedFileTypeError: File type not supported
|
||||
*/
|
||||
export const post19 = oc
|
||||
export const post17 = oc
|
||||
.route({
|
||||
description:
|
||||
'Upload a file from a remote URL\nDownloads a file from the provided remote URL and uploads it\nto the platform storage for use in web applications.\n\nArgs:\n app_model: The associated application model\n end_user: The end user making the request\n\nJSON Parameters:\n url: The remote URL to download the file from (required)\n\nReturns:\n dict: File information including ID, signed URL, and metadata\n int: HTTP status code 201 for success\n\nRaises:\n RemoteFileUploadError: Failed to fetch file from remote URL\n FileTooLargeError: File exceeds size limit\n UnsupportedFileTypeError: File type not supported',
|
||||
@ -813,7 +747,7 @@ export const post19 = oc
|
||||
.output(zPostRemoteFilesUploadResponse)
|
||||
|
||||
export const upload2 = {
|
||||
post: post19,
|
||||
post: post17,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -834,7 +768,7 @@ export const upload2 = {
|
||||
* Raises:
|
||||
* HTTPException: If the remote file cannot be accessed
|
||||
*/
|
||||
export const get10 = oc
|
||||
export const get9 = oc
|
||||
.route({
|
||||
description:
|
||||
'Get information about a remote file\nRetrieves basic information about a file located at a remote URL,\nincluding content type and content length.\n\nArgs:\n app_model: The associated application model\n end_user: The end user making the request\n url: URL-encoded path to the remote file\n\nReturns:\n dict: Remote file information including type and length\n\nRaises:\n HTTPException: If the remote file cannot be accessed',
|
||||
@ -849,7 +783,7 @@ export const get10 = oc
|
||||
.output(zGetRemoteFilesByUrlResponse)
|
||||
|
||||
export const byUrl = {
|
||||
get: get10,
|
||||
get: get9,
|
||||
}
|
||||
|
||||
export const remoteFiles = {
|
||||
@ -880,7 +814,7 @@ export const byMessageId2 = {
|
||||
/**
|
||||
* Retrieve paginated list of saved messages for a completion application.
|
||||
*/
|
||||
export const get11 = oc
|
||||
export const get10 = oc
|
||||
.route({
|
||||
description: 'Retrieve paginated list of saved messages for a completion application.',
|
||||
inputStructure: 'detailed',
|
||||
@ -895,7 +829,7 @@ export const get11 = oc
|
||||
/**
|
||||
* Save a specific message for later reference.
|
||||
*/
|
||||
export const post20 = oc
|
||||
export const post18 = oc
|
||||
.route({
|
||||
description: 'Save a specific message for later reference.',
|
||||
inputStructure: 'detailed',
|
||||
@ -908,8 +842,8 @@ export const post20 = oc
|
||||
.output(zPostSavedMessagesResponse)
|
||||
|
||||
export const savedMessages = {
|
||||
get: get11,
|
||||
post: post20,
|
||||
get: get10,
|
||||
post: post18,
|
||||
byMessageId: byMessageId2,
|
||||
}
|
||||
|
||||
@ -918,7 +852,7 @@ export const savedMessages = {
|
||||
*
|
||||
* Retrieve app site information and configuration.
|
||||
*/
|
||||
export const get12 = oc
|
||||
export const get11 = oc
|
||||
.route({
|
||||
description: 'Retrieve app site information and configuration.',
|
||||
inputStructure: 'detailed',
|
||||
@ -931,7 +865,7 @@ export const get12 = oc
|
||||
.output(zGetSiteResponse)
|
||||
|
||||
export const site = {
|
||||
get: get12,
|
||||
get: get11,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -954,7 +888,7 @@ export const site = {
|
||||
*
|
||||
* Only non-sensitive configuration data should be returned by this endpoint.
|
||||
*/
|
||||
export const get13 = oc
|
||||
export const get12 = oc
|
||||
.route({
|
||||
description:
|
||||
'Get system feature flags and configuration\nReturns the current system feature flags and configuration\nthat control various functionalities across the platform.\n\nReturns:\n dict: System feature configuration object\n\nThis endpoint is akin to the `SystemFeatureApi` endpoint in api/controllers/console/feature.py,\nexcept it is intended for use by the web app, instead of the console dashboard.\n\nNOTE: This endpoint is unauthenticated by design, as it provides system features\ndata required for webapp initialization.\n\nAuthentication would create circular dependency (can\'t authenticate without webapp loading).\n\nOnly non-sensitive configuration data should be returned by this endpoint.',
|
||||
@ -968,7 +902,7 @@ export const get13 = oc
|
||||
.output(zGetSystemFeaturesResponse)
|
||||
|
||||
export const systemFeatures = {
|
||||
get: get13,
|
||||
get: get12,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -976,7 +910,7 @@ export const systemFeatures = {
|
||||
*
|
||||
* Convert text to audio using text-to-speech service.
|
||||
*/
|
||||
export const post21 = oc
|
||||
export const post19 = oc
|
||||
.route({
|
||||
description: 'Convert text to audio using text-to-speech service.',
|
||||
inputStructure: 'detailed',
|
||||
@ -990,13 +924,13 @@ export const post21 = oc
|
||||
.output(zPostTextToAudioResponse)
|
||||
|
||||
export const textToAudio = {
|
||||
post: post21,
|
||||
post: post19,
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the access mode for a web application (public or restricted).
|
||||
*/
|
||||
export const get14 = oc
|
||||
export const get13 = oc
|
||||
.route({
|
||||
description: 'Retrieve the access mode for a web application (public or restricted).',
|
||||
inputStructure: 'detailed',
|
||||
@ -1009,13 +943,13 @@ export const get14 = oc
|
||||
.output(zGetWebappAccessModeResponse)
|
||||
|
||||
export const accessMode = {
|
||||
get: get14,
|
||||
get: get13,
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has permission to access a web application.
|
||||
*/
|
||||
export const get15 = oc
|
||||
export const get14 = oc
|
||||
.route({
|
||||
description: 'Check if user has permission to access a web application.',
|
||||
inputStructure: 'detailed',
|
||||
@ -1028,7 +962,7 @@ export const get15 = oc
|
||||
.output(zGetWebappPermissionResponse)
|
||||
|
||||
export const permission = {
|
||||
get: get15,
|
||||
get: get14,
|
||||
}
|
||||
|
||||
export const webapp = {
|
||||
@ -1043,7 +977,7 @@ export const webapp = {
|
||||
*
|
||||
* Returns Server-Sent Events stream.
|
||||
*/
|
||||
export const get16 = oc
|
||||
export const get15 = oc
|
||||
.route({
|
||||
description: 'GET /api/workflow/<task_id>/events\n\nReturns Server-Sent Events stream.',
|
||||
inputStructure: 'detailed',
|
||||
@ -1057,7 +991,7 @@ export const get16 = oc
|
||||
.output(zGetWorkflowByTaskIdEventsResponse)
|
||||
|
||||
export const events = {
|
||||
get: get16,
|
||||
get: get15,
|
||||
}
|
||||
|
||||
export const byTaskId3 = {
|
||||
@ -1068,34 +1002,12 @@ export const workflow = {
|
||||
byTaskId: byTaskId3,
|
||||
}
|
||||
|
||||
/**
|
||||
* Run workflow
|
||||
*
|
||||
* Execute a workflow with provided inputs and files.
|
||||
*/
|
||||
export const post22 = oc
|
||||
.route({
|
||||
description: 'Execute a workflow with provided inputs and files.',
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postWorkflowsRun',
|
||||
path: '/workflows/run',
|
||||
summary: 'Run workflow',
|
||||
tags: ['web'],
|
||||
})
|
||||
.input(z.object({ body: zPostWorkflowsRunBody }))
|
||||
.output(zPostWorkflowsRunResponse)
|
||||
|
||||
export const run = {
|
||||
post: post22,
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop workflow task
|
||||
*
|
||||
* Stop a running workflow task.
|
||||
*/
|
||||
export const post23 = oc
|
||||
export const post20 = oc
|
||||
.route({
|
||||
description: 'Stop a running workflow task.',
|
||||
inputStructure: 'detailed',
|
||||
@ -1109,7 +1021,7 @@ export const post23 = oc
|
||||
.output(zPostWorkflowsTasksByTaskIdStopResponse)
|
||||
|
||||
export const stop3 = {
|
||||
post: post23,
|
||||
post: post20,
|
||||
}
|
||||
|
||||
export const byTaskId4 = {
|
||||
@ -1121,7 +1033,6 @@ export const tasks = {
|
||||
}
|
||||
|
||||
export const workflows = {
|
||||
run,
|
||||
tasks,
|
||||
}
|
||||
|
||||
|
||||
@ -256,8 +256,6 @@ export type FormInputConfig
|
||||
type: 'file-list'
|
||||
} & FileListInputConfig)
|
||||
|
||||
export type GeneratedAppResponse = JsonValue
|
||||
|
||||
export type HumanInputContent = {
|
||||
form_definition?: HumanInputFormDefinition | null
|
||||
form_submission_data?: HumanInputFormSubmissionData | null
|
||||
@ -329,16 +327,7 @@ export type JsonObject = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export type JsonValue
|
||||
= | string
|
||||
| number
|
||||
| number
|
||||
| boolean
|
||||
| {
|
||||
[key: string]: unknown
|
||||
}
|
||||
| Array<unknown>
|
||||
| null
|
||||
export type JsonValue = unknown
|
||||
|
||||
export type JsonValueType = unknown
|
||||
|
||||
@ -674,27 +663,6 @@ export type PostAudioToTextResponses = {
|
||||
|
||||
export type PostAudioToTextResponse = PostAudioToTextResponses[keyof PostAudioToTextResponses]
|
||||
|
||||
export type PostChatMessagesData = {
|
||||
body: ChatMessagePayload
|
||||
path?: never
|
||||
query?: never
|
||||
url: '/chat-messages'
|
||||
}
|
||||
|
||||
export type PostChatMessagesErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type PostChatMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostChatMessagesResponse = PostChatMessagesResponses[keyof PostChatMessagesResponses]
|
||||
|
||||
export type PostChatMessagesByTaskIdStopData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -719,28 +687,6 @@ export type PostChatMessagesByTaskIdStopResponses = {
|
||||
export type PostChatMessagesByTaskIdStopResponse
|
||||
= PostChatMessagesByTaskIdStopResponses[keyof PostChatMessagesByTaskIdStopResponses]
|
||||
|
||||
export type PostCompletionMessagesData = {
|
||||
body: CompletionMessagePayload
|
||||
path?: never
|
||||
query?: never
|
||||
url: '/completion-messages'
|
||||
}
|
||||
|
||||
export type PostCompletionMessagesErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type PostCompletionMessagesResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostCompletionMessagesResponse
|
||||
= PostCompletionMessagesResponses[keyof PostCompletionMessagesResponses]
|
||||
|
||||
export type PostCompletionMessagesByTaskIdStopData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -1174,32 +1120,6 @@ export type PostMessagesByMessageIdFeedbacksResponses = {
|
||||
export type PostMessagesByMessageIdFeedbacksResponse
|
||||
= PostMessagesByMessageIdFeedbacksResponses[keyof PostMessagesByMessageIdFeedbacksResponses]
|
||||
|
||||
export type GetMessagesByMessageIdMoreLikeThisData = {
|
||||
body?: never
|
||||
path: {
|
||||
message_id: string
|
||||
}
|
||||
query: {
|
||||
response_mode: 'blocking' | 'streaming'
|
||||
}
|
||||
url: '/messages/{message_id}/more-like-this'
|
||||
}
|
||||
|
||||
export type GetMessagesByMessageIdMoreLikeThisErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type GetMessagesByMessageIdMoreLikeThisResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type GetMessagesByMessageIdMoreLikeThisResponse
|
||||
= GetMessagesByMessageIdMoreLikeThisResponses[keyof GetMessagesByMessageIdMoreLikeThisResponses]
|
||||
|
||||
export type GetMessagesByMessageIdSuggestedQuestionsData = {
|
||||
body?: never
|
||||
path: {
|
||||
@ -1518,27 +1438,6 @@ export type GetWorkflowByTaskIdEventsResponses = {
|
||||
export type GetWorkflowByTaskIdEventsResponse
|
||||
= GetWorkflowByTaskIdEventsResponses[keyof GetWorkflowByTaskIdEventsResponses]
|
||||
|
||||
export type PostWorkflowsRunData = {
|
||||
body: WorkflowRunPayload
|
||||
path?: never
|
||||
query?: never
|
||||
url: '/workflows/run'
|
||||
}
|
||||
|
||||
export type PostWorkflowsRunErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type PostWorkflowsRunResponses = {
|
||||
200: GeneratedAppResponse
|
||||
}
|
||||
|
||||
export type PostWorkflowsRunResponse = PostWorkflowsRunResponses[keyof PostWorkflowsRunResponses]
|
||||
|
||||
export type PostWorkflowsTasksByTaskIdStopData = {
|
||||
body?: never
|
||||
path: {
|
||||
|
||||
@ -347,16 +347,7 @@ export const zHumanInputUploadTokenResponse = z.object({
|
||||
|
||||
export const zJsonObject = z.record(z.string(), z.unknown())
|
||||
|
||||
export const zJsonValue = z
|
||||
.union([
|
||||
z.string(),
|
||||
z.int(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.record(z.string(), z.unknown()),
|
||||
z.array(z.unknown()),
|
||||
])
|
||||
.nullable()
|
||||
export const zJsonValue = z.unknown()
|
||||
|
||||
/**
|
||||
* AgentThought
|
||||
@ -375,11 +366,6 @@ export const zAgentThought = z.object({
|
||||
tool_labels: zJsonValue,
|
||||
})
|
||||
|
||||
/**
|
||||
* GeneratedAppResponse
|
||||
*/
|
||||
export const zGeneratedAppResponse = zJsonValue
|
||||
|
||||
export const zJsonValueType = z.unknown()
|
||||
|
||||
export const zJsonValue2 = z.unknown()
|
||||
@ -926,13 +912,6 @@ export const zWorkflowRunPayload = z.object({
|
||||
*/
|
||||
export const zPostAudioToTextResponse = zAudioTranscriptResponse
|
||||
|
||||
export const zPostChatMessagesBody = zChatMessagePayload
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostChatMessagesResponse = zGeneratedAppResponse
|
||||
|
||||
export const zPostChatMessagesByTaskIdStopPath = z.object({
|
||||
task_id: z.string(),
|
||||
})
|
||||
@ -942,13 +921,6 @@ export const zPostChatMessagesByTaskIdStopPath = z.object({
|
||||
*/
|
||||
export const zPostChatMessagesByTaskIdStopResponse = zSimpleResultResponse
|
||||
|
||||
export const zPostCompletionMessagesBody = zCompletionMessagePayload
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostCompletionMessagesResponse = zGeneratedAppResponse
|
||||
|
||||
export const zPostCompletionMessagesByTaskIdStopPath = z.object({
|
||||
task_id: z.string(),
|
||||
})
|
||||
@ -1139,19 +1111,6 @@ export const zPostMessagesByMessageIdFeedbacksQuery = z.object({
|
||||
*/
|
||||
export const zPostMessagesByMessageIdFeedbacksResponse = zResultResponse
|
||||
|
||||
export const zGetMessagesByMessageIdMoreLikeThisPath = z.object({
|
||||
message_id: z.uuid(),
|
||||
})
|
||||
|
||||
export const zGetMessagesByMessageIdMoreLikeThisQuery = z.object({
|
||||
response_mode: z.enum(['blocking', 'streaming']),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zGetMessagesByMessageIdMoreLikeThisResponse = zGeneratedAppResponse
|
||||
|
||||
export const zGetMessagesByMessageIdSuggestedQuestionsPath = z.object({
|
||||
message_id: z.uuid(),
|
||||
})
|
||||
@ -1271,13 +1230,6 @@ export const zGetWorkflowByTaskIdEventsPath = z.object({
|
||||
*/
|
||||
export const zGetWorkflowByTaskIdEventsResponse = zEventStreamResponse
|
||||
|
||||
export const zPostWorkflowsRunBody = zWorkflowRunPayload
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zPostWorkflowsRunResponse = zGeneratedAppResponse
|
||||
|
||||
export const zPostWorkflowsTasksByTaskIdStopPath = z.object({
|
||||
task_id: z.string(),
|
||||
})
|
||||
|
||||
@ -10,13 +10,21 @@ type SwaggerSchema = JsonObject & {
|
||||
$ref?: string
|
||||
}
|
||||
|
||||
type OpenApiMediaType = JsonObject & {
|
||||
schema?: SwaggerSchema
|
||||
}
|
||||
|
||||
type OpenApiResponse = JsonObject & {
|
||||
content?: Record<string, OpenApiMediaType>
|
||||
}
|
||||
|
||||
type OpenApiComponents = JsonObject & {
|
||||
schemas?: Record<string, SwaggerSchema>
|
||||
}
|
||||
|
||||
type SwaggerOperation = JsonObject & {
|
||||
operationId?: string
|
||||
responses?: Record<string, unknown>
|
||||
responses?: Record<string, OpenApiResponse>
|
||||
}
|
||||
|
||||
type SwaggerDocument = JsonObject & {
|
||||
@ -52,6 +60,17 @@ const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const apiOpenApiDir = path.resolve(currentDir, 'openapi')
|
||||
|
||||
const operationMethods = new Set(['delete', 'get', 'patch', 'post', 'put'])
|
||||
const pydanticDecimalStringPattern = '^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$'
|
||||
const codegenSafeDecimalStringPattern = '^(?![-+.]*$)[+-]?0*\\d*\\.?\\d*$'
|
||||
|
||||
const opaqueJsonContent = (): Record<string, OpenApiMediaType> => ({
|
||||
'application/json': {
|
||||
schema: {
|
||||
additionalProperties: true,
|
||||
type: 'object',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const apiSpecs: ApiSpec[] = [
|
||||
{ filename: 'console-openapi.json', name: 'console' },
|
||||
@ -182,6 +201,46 @@ const addOperationIds = (document: SwaggerDocument) => {
|
||||
}
|
||||
}
|
||||
|
||||
const isOpaqueContractResponse = (response: OpenApiResponse) => {
|
||||
const content = response.content
|
||||
if (!isObject(content))
|
||||
return false
|
||||
|
||||
return Object.entries(content).some(([mediaType, media]) => {
|
||||
if (!isObject(media))
|
||||
return false
|
||||
|
||||
return (mediaType === 'application/json' || mediaType === 'text/event-stream') && !('schema' in media)
|
||||
})
|
||||
}
|
||||
|
||||
const hasOpaqueContractSuccessResponse = (operation: SwaggerOperation) => {
|
||||
return Object.entries(operation.responses ?? {}).some(([status, response]) => {
|
||||
return /^2\d\d$/.test(status) && isObject(response) && isOpaqueContractResponse(response)
|
||||
})
|
||||
}
|
||||
|
||||
const normalizeOpaqueContractResponses = (document: SwaggerDocument) => {
|
||||
// Some backend endpoints has no schema (e.g. external) and will trap heyapi here
|
||||
// So we forge an opaque schema here
|
||||
for (const pathItem of Object.values(document.paths ?? {})) {
|
||||
for (const [method, operation] of Object.entries(pathItem)) {
|
||||
if (!operationMethods.has(method) || !isObject(operation))
|
||||
continue
|
||||
|
||||
const swaggerOperation = operation as SwaggerOperation
|
||||
if (!hasOpaqueContractSuccessResponse(swaggerOperation))
|
||||
continue
|
||||
|
||||
Object.values(swaggerOperation.responses ?? {})
|
||||
.filter(response => isObject(response) && isOpaqueContractResponse(response))
|
||||
.forEach((response) => {
|
||||
response.content = opaqueJsonContent()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const hasSuccessResponse = (operation: SwaggerOperation) => {
|
||||
return Object.entries(operation.responses ?? {}).some(([status, response]) => {
|
||||
if (!/^2\d\d$/.test(status))
|
||||
@ -215,6 +274,7 @@ const filterContractOperations = (document: SwaggerDocument) => {
|
||||
}
|
||||
|
||||
const normalizeApiSwagger = (document: SwaggerDocument) => {
|
||||
normalizeOpaqueContractResponses(document)
|
||||
filterContractOperations(document)
|
||||
addOperationIds(document)
|
||||
|
||||
@ -380,10 +440,20 @@ const createApiConfig = (job: ApiJob): UserConfig => ({
|
||||
'name': 'zod',
|
||||
'~resolvers': {
|
||||
string: (ctx) => {
|
||||
if (ctx.schema.format !== 'binary')
|
||||
return undefined
|
||||
if (ctx.schema.format === 'binary')
|
||||
return $(ctx.symbols.z).attr('custom').call().generic($.type.or($.type('Blob'), $.type('File')))
|
||||
|
||||
return $(ctx.symbols.z).attr('custom').call().generic($.type.or($.type('Blob'), $.type('File')))
|
||||
if (ctx.schema.pattern === pydanticDecimalStringPattern) {
|
||||
// the pydantic generated regex will emit error like
|
||||
// regexp/no-useless-assertions, so patch the regex here
|
||||
return $(ctx.symbols.z)
|
||||
.attr('string')
|
||||
.call()
|
||||
.attr('regex')
|
||||
.call($.regexp(codegenSafeDecimalStringPattern))
|
||||
}
|
||||
|
||||
return undefined
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -217,14 +217,8 @@ const toFeedback = (feedback: NonNullable<MessageDetailResponse['feedbacks']>[nu
|
||||
}
|
||||
}
|
||||
|
||||
type AgentDebugMessageWithLegacyAnswer = MessageDetailResponse & {
|
||||
answer?: string | null
|
||||
}
|
||||
|
||||
const getAgentDebugMessageAnswer = (message: MessageDetailResponse) => {
|
||||
const legacyAnswer = (message as AgentDebugMessageWithLegacyAnswer).answer
|
||||
|
||||
return message.re_sign_file_url_answer ?? legacyAnswer ?? ''
|
||||
return message.answer ?? ''
|
||||
}
|
||||
|
||||
function getFormattedAgentDebugChatTree(messages: MessageDetailResponse[]): ChatItemInTree[] {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user