2025-09-28 13:37:06 +08:00
|
|
|
from importlib import import_module
|
|
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
from flask import Blueprint
|
2025-09-10 12:15:47 +08:00
|
|
|
from flask_restx import Namespace
|
2024-04-18 20:24:05 +08:00
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
from libs.external_api import ExternalApi
|
|
|
|
|
|
2024-08-26 15:29:10 +08:00
|
|
|
bp = Blueprint("console", __name__, url_prefix="/console/api")
|
2025-09-10 12:15:47 +08:00
|
|
|
|
|
|
|
|
api = ExternalApi(
|
|
|
|
|
bp,
|
|
|
|
|
version="1.0",
|
|
|
|
|
title="Console API",
|
|
|
|
|
description="Console management APIs for app configuration, monitoring, and administration",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
console_ns = Namespace("console", description="Console management API operations", path="/")
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2025-09-28 13:37:06 +08:00
|
|
|
RESOURCE_MODULES = (
|
|
|
|
|
"controllers.console.app.app_import",
|
|
|
|
|
"controllers.console.explore.audio",
|
|
|
|
|
"controllers.console.explore.completion",
|
|
|
|
|
"controllers.console.explore.conversation",
|
|
|
|
|
"controllers.console.explore.message",
|
|
|
|
|
"controllers.console.explore.workflow",
|
|
|
|
|
"controllers.console.files",
|
|
|
|
|
"controllers.console.remote_files",
|
|
|
|
|
)
|
2024-11-01 15:51:22 +08:00
|
|
|
|
2025-09-28 13:37:06 +08:00
|
|
|
for module_name in RESOURCE_MODULES:
|
|
|
|
|
import_module(module_name)
|
2024-11-22 15:05:04 +08:00
|
|
|
|
2025-09-28 13:37:06 +08:00
|
|
|
# Ensure resource modules are imported so route decorators are evaluated.
|
2023-05-25 15:54:45 +08:00
|
|
|
# Import other controllers
|
2025-09-10 12:15:47 +08:00
|
|
|
from . import (
|
2025-09-15 07:15:35 +05:30
|
|
|
admin,
|
|
|
|
|
apikey,
|
|
|
|
|
extension,
|
|
|
|
|
feature,
|
|
|
|
|
init_validate,
|
|
|
|
|
ping,
|
|
|
|
|
setup,
|
2025-09-18 12:49:10 +08:00
|
|
|
spec,
|
2025-09-15 07:15:35 +05:30
|
|
|
version,
|
2025-09-10 12:15:47 +08:00
|
|
|
)
|
2024-04-18 20:24:05 +08:00
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
# Import app controllers
|
2024-04-18 20:24:05 +08:00
|
|
|
from .app import (
|
2025-09-15 07:15:35 +05:30
|
|
|
advanced_prompt_template,
|
|
|
|
|
agent,
|
|
|
|
|
annotation,
|
|
|
|
|
app,
|
|
|
|
|
audio,
|
|
|
|
|
completion,
|
|
|
|
|
conversation,
|
|
|
|
|
conversation_variables,
|
|
|
|
|
generator,
|
|
|
|
|
mcp_server,
|
|
|
|
|
message,
|
|
|
|
|
model_config,
|
|
|
|
|
ops_trace,
|
|
|
|
|
site,
|
|
|
|
|
statistic,
|
|
|
|
|
workflow,
|
|
|
|
|
workflow_app_log,
|
|
|
|
|
workflow_draft_variable,
|
|
|
|
|
workflow_run,
|
|
|
|
|
workflow_statistic,
|
2025-11-12 17:59:37 +08:00
|
|
|
workflow_trigger,
|
2024-04-18 20:24:05 +08:00
|
|
|
)
|
|
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
# Import auth controllers
|
2025-09-10 01:54:26 +08:00
|
|
|
from .auth import (
|
2025-09-15 07:15:35 +05:30
|
|
|
activate,
|
|
|
|
|
data_source_bearer_auth,
|
|
|
|
|
data_source_oauth,
|
|
|
|
|
email_register,
|
|
|
|
|
forgot_password,
|
|
|
|
|
login,
|
|
|
|
|
oauth,
|
|
|
|
|
oauth_server,
|
2025-09-10 01:54:26 +08:00
|
|
|
)
|
2024-04-18 20:24:05 +08:00
|
|
|
|
2024-02-01 18:11:57 +08:00
|
|
|
# Import billing controllers
|
2025-09-15 07:15:35 +05:30
|
|
|
from .billing import billing, compliance
|
2024-04-18 20:24:05 +08:00
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
# Import datasets controllers
|
2024-09-30 15:38:43 +08:00
|
|
|
from .datasets import (
|
2025-09-15 07:15:35 +05:30
|
|
|
data_source,
|
|
|
|
|
datasets,
|
|
|
|
|
datasets_document,
|
|
|
|
|
datasets_segments,
|
|
|
|
|
external,
|
|
|
|
|
hit_testing,
|
|
|
|
|
metadata,
|
|
|
|
|
website,
|
2024-09-30 15:38:43 +08:00
|
|
|
)
|
2025-09-18 12:49:10 +08:00
|
|
|
from .datasets.rag_pipeline import (
|
|
|
|
|
datasource_auth,
|
|
|
|
|
datasource_content_preview,
|
|
|
|
|
rag_pipeline,
|
|
|
|
|
rag_pipeline_datasets,
|
|
|
|
|
rag_pipeline_draft_variable,
|
|
|
|
|
rag_pipeline_import,
|
|
|
|
|
rag_pipeline_workflow,
|
|
|
|
|
)
|
2024-04-18 20:24:05 +08:00
|
|
|
|
2023-05-25 15:54:45 +08:00
|
|
|
# Import explore controllers
|
2024-04-18 20:24:05 +08:00
|
|
|
from .explore import (
|
2025-09-15 07:15:35 +05:30
|
|
|
installed_app,
|
|
|
|
|
parameter,
|
|
|
|
|
recommended_app,
|
|
|
|
|
saved_message,
|
2024-12-24 18:38:51 +08:00
|
|
|
)
|
|
|
|
|
|
2025-09-10 12:15:47 +08:00
|
|
|
# Import tag controllers
|
2025-09-15 07:15:35 +05:30
|
|
|
from .tag import tags
|
2025-09-10 12:15:47 +08:00
|
|
|
|
|
|
|
|
# Import workspace controllers
|
|
|
|
|
from .workspace import (
|
2025-09-15 07:15:35 +05:30
|
|
|
account,
|
|
|
|
|
agent_providers,
|
|
|
|
|
endpoint,
|
|
|
|
|
load_balancing_config,
|
|
|
|
|
members,
|
|
|
|
|
model_providers,
|
|
|
|
|
models,
|
|
|
|
|
plugin,
|
|
|
|
|
tool_providers,
|
2025-11-12 17:59:37 +08:00
|
|
|
trigger_providers,
|
2025-09-15 07:15:35 +05:30
|
|
|
workspace,
|
2025-09-10 12:15:47 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
api.add_namespace(console_ns)
|
2025-09-15 07:15:35 +05:30
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
|
"account",
|
|
|
|
|
"activate",
|
|
|
|
|
"admin",
|
|
|
|
|
"advanced_prompt_template",
|
|
|
|
|
"agent",
|
|
|
|
|
"agent_providers",
|
|
|
|
|
"annotation",
|
|
|
|
|
"api",
|
|
|
|
|
"apikey",
|
|
|
|
|
"app",
|
|
|
|
|
"audio",
|
|
|
|
|
"billing",
|
|
|
|
|
"bp",
|
|
|
|
|
"completion",
|
|
|
|
|
"compliance",
|
|
|
|
|
"console_ns",
|
|
|
|
|
"conversation",
|
|
|
|
|
"conversation_variables",
|
|
|
|
|
"data_source",
|
|
|
|
|
"data_source_bearer_auth",
|
|
|
|
|
"data_source_oauth",
|
|
|
|
|
"datasets",
|
|
|
|
|
"datasets_document",
|
|
|
|
|
"datasets_segments",
|
2025-09-18 12:49:10 +08:00
|
|
|
"datasource_auth",
|
|
|
|
|
"datasource_content_preview",
|
2025-09-15 07:15:35 +05:30
|
|
|
"email_register",
|
|
|
|
|
"endpoint",
|
|
|
|
|
"extension",
|
|
|
|
|
"external",
|
|
|
|
|
"feature",
|
|
|
|
|
"forgot_password",
|
|
|
|
|
"generator",
|
|
|
|
|
"hit_testing",
|
|
|
|
|
"init_validate",
|
|
|
|
|
"installed_app",
|
|
|
|
|
"load_balancing_config",
|
|
|
|
|
"login",
|
|
|
|
|
"mcp_server",
|
|
|
|
|
"members",
|
|
|
|
|
"message",
|
|
|
|
|
"metadata",
|
|
|
|
|
"model_config",
|
|
|
|
|
"model_providers",
|
|
|
|
|
"models",
|
|
|
|
|
"oauth",
|
|
|
|
|
"oauth_server",
|
|
|
|
|
"ops_trace",
|
|
|
|
|
"parameter",
|
|
|
|
|
"ping",
|
|
|
|
|
"plugin",
|
2025-09-18 12:49:10 +08:00
|
|
|
"rag_pipeline",
|
|
|
|
|
"rag_pipeline_datasets",
|
|
|
|
|
"rag_pipeline_draft_variable",
|
|
|
|
|
"rag_pipeline_import",
|
|
|
|
|
"rag_pipeline_workflow",
|
2025-09-15 07:15:35 +05:30
|
|
|
"recommended_app",
|
|
|
|
|
"saved_message",
|
|
|
|
|
"setup",
|
|
|
|
|
"site",
|
2025-09-18 12:49:10 +08:00
|
|
|
"spec",
|
2025-09-15 07:15:35 +05:30
|
|
|
"statistic",
|
|
|
|
|
"tags",
|
|
|
|
|
"tool_providers",
|
2025-11-12 17:59:37 +08:00
|
|
|
"trigger_providers",
|
2025-09-15 07:15:35 +05:30
|
|
|
"version",
|
|
|
|
|
"website",
|
|
|
|
|
"workflow",
|
|
|
|
|
"workflow_app_log",
|
|
|
|
|
"workflow_draft_variable",
|
|
|
|
|
"workflow_run",
|
|
|
|
|
"workflow_statistic",
|
2025-11-12 17:59:37 +08:00
|
|
|
"workflow_trigger",
|
2025-09-15 07:15:35 +05:30
|
|
|
"workspace",
|
|
|
|
|
]
|