Skip to content
1 change: 0 additions & 1 deletion api/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ select = [

ignore = [
"E402", # module-import-not-at-top-of-file
"F841", # unused-variable
"B901", # allow return in yield
"B903", # class-as-data-structure
"B904", # raise-without-from-inside-except
Expand Down
1 change: 0 additions & 1 deletion api/controllers/console/app/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ def post(self, req_data: CreateAnnotationPayload, session: Session, app_id: UUID
@console_ns.response(204, "Annotations deleted successfully")
@with_session
def delete(self, session: Session, app_id: UUID):

# Use request.args.getlist to get annotation_ids array directly
annotation_ids = request.args.getlist("annotation_id")

Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/app/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def _get_text_to_speech_voices(*, tenant_id: str, language: str):
raise CompletionRequestError(e.description)
except ValueError as e:
raise e
except Exception as e:
except Exception:
logger.exception("Failed to handle get request to TextModesApi")
raise InternalServerError()

Expand Down
5 changes: 2 additions & 3 deletions api/controllers/console/app/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def post(self, req_data: CompletionMessagePayload, session: Session, current_use
raise CompletionRequestError(e.description)
except ValueError as e:
raise e
except Exception as e:
except Exception:
logger.exception("internal server error.")
raise InternalServerError()

Expand All @@ -222,7 +222,6 @@ class CompletionMessageStopApi(Resource):
@with_current_user_id
@get_app_model(mode=AppMode.COMPLETION)
def post(self, current_user_id: str, app_model: App, task_id: str):

AppTaskService.stop_task(
task_id=task_id,
invoke_from=InvokeFrom.DEBUGGER,
Expand Down Expand Up @@ -589,7 +588,7 @@ def _generate_chat_message(
raise CompletionRequestError(e.description)
except ValueError as e:
raise e
except Exception as e:
except Exception:
logger.exception("internal server error.")
raise InternalServerError()

Expand Down
2 changes: 0 additions & 2 deletions api/controllers/console/app/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class CompletionConversationApi(Resource):
@get_app_model(mode=AppMode.COMPLETION)
@model_validate(CompletionConversationQuery)
def get(self, req_data: CompletionConversationQuery, session: Session, current_user: Account, app_model: App):

query = sa.select(Conversation).where(
Conversation.app_id == app_model.id, Conversation.mode == "completion", Conversation.is_deleted.is_(False)
)
Expand Down Expand Up @@ -241,7 +240,6 @@ class ChatConversationApi(Resource):
@get_app_model(mode=[AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT, AppMode.AGENT])
@model_validate(ChatConversationQuery)
def get(self, req_data: ChatConversationQuery, session: Session, current_user: Account, app_model: App):

subquery = (
sa.select(Conversation.id.label("conversation_id"), EndUser.session_id.label("from_end_user_session_id"))
.outerjoin(EndUser, Conversation.from_end_user_id == EndUser.id)
Expand Down
5 changes: 0 additions & 5 deletions api/controllers/console/app/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ class RuleGenerateApi(Resource):
@with_current_tenant_id
@model_validate(RuleGeneratePayload)
def post(self, req_data: RuleGeneratePayload, current_tenant_id: str):

try:
rules = LLMGenerator.generate_rule_config(tenant_id=current_tenant_id, args=req_data)
except ProviderTokenNotInitError as ex:
Expand Down Expand Up @@ -294,7 +293,6 @@ class RuleCodeGenerateApi(Resource):
@with_current_tenant_id
@model_validate(RuleCodeGeneratePayload)
def post(self, req_data: RuleCodeGeneratePayload, current_tenant_id: str):

try:
code_result = LLMGenerator.generate_code(
tenant_id=current_tenant_id,
Expand Down Expand Up @@ -331,7 +329,6 @@ class RuleStructuredOutputGenerateApi(Resource):
@with_current_tenant_id
@model_validate(RuleStructuredOutputPayload)
def post(self, req_data: RuleStructuredOutputPayload, current_tenant_id: str):

try:
structured_output = LLMGenerator.generate_structured_output(
tenant_id=current_tenant_id,
Expand Down Expand Up @@ -545,7 +542,6 @@ class WorkflowGenerateApi(Resource):
@with_current_tenant_id
@model_validate(WorkflowGeneratePayload)
def post(self, req_data: WorkflowGeneratePayload, current_tenant_id: str):

# Reject empty / over-length instructions at the boundary (shared with
# the streaming endpoint) before spending a planner+builder roundtrip.
guard = _workflow_instruction_guard(req_data)
Expand Down Expand Up @@ -638,7 +634,6 @@ class WorkflowGenerateStreamApi(Resource):
@with_current_tenant_id
@model_validate(WorkflowGeneratePayload)
def post(self, req_data: WorkflowGeneratePayload, current_tenant_id: str):

# Same boundary guards as the blocking endpoint — return a normal 400
# JSON for these BEFORE opening the stream.
guard = _workflow_instruction_guard(req_data)
Expand Down
1 change: 0 additions & 1 deletion api/controllers/console/app/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ def _update_message_feedback(
def _get_message_suggested_questions(
*, context: RequestContext, app_id: str, app_mode: str, message_id: UUID
) -> dict[str, object]:

try:
questions = application_services().message_suggested_questions.get_suggested_questions(
app_id=app_id,
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/app/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ def post(self, current_user: Account, app_model: App, node_id: str):
files=files,
)
return jsonable_encoder(node_execution)
except Exception as e:
except Exception:
logger.exception("Error running draft workflow trigger node")
return jsonable_encoder(
{"status": "error", "error": "An unexpected error occurred while running the node."}
Expand Down
2 changes: 0 additions & 2 deletions api/controllers/console/app/workflow_draft_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ def get(self, current_user: Account, app_model: App):
@get_app_model(mode=AppMode.ADVANCED_CHAT)
@model_validate(ConversationVariableUpdatePayload)
def post(self, req_data: ConversationVariableUpdatePayload, current_user: Account, app_model: App):

workflow_service = WorkflowService()

conversation_variables_list = [
Expand Down Expand Up @@ -647,7 +646,6 @@ def get(self, _current_user: Account, app_model: App):
@get_app_model(mode=[AppMode.ADVANCED_CHAT, AppMode.WORKFLOW])
@model_validate(EnvironmentVariableUpdatePayload)
def post(self, req_data: EnvironmentVariableUpdatePayload, current_user: Account, app_model: App):

workflow_service = WorkflowService()

environment_variables_list = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,6 @@ class RagPipelineRecommendedPluginApi(Resource):
@with_current_tenant_id
@model_validate(RagPipelineRecommendedPluginQuery)
def get(self, req_data: RagPipelineRecommendedPluginQuery, current_tenant_id: str, current_user: Account):

rag_pipeline_service = RagPipelineService(db.session())
recommended_plugins = rag_pipeline_service.get_recommended_plugins(
req_data.type, current_user, current_tenant_id
Expand Down
2 changes: 0 additions & 2 deletions api/controllers/console/workspace/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ class EndpointListApi(Resource):
@with_current_tenant_id
@model_validate(EndpointListQuery)
def get(self, req_data: EndpointListQuery, tenant_id: str, user_id: str):

endpoints = EndpointService.list_endpoints(
tenant_id=tenant_id,
user_id=user_id,
Expand Down Expand Up @@ -330,7 +329,6 @@ class EndpointListForSinglePluginApi(Resource):
@with_current_tenant_id
@model_validate(EndpointListForPluginQuery)
def get(self, req_data: EndpointListForPluginQuery, tenant_id: str, user_id: str):

endpoints = EndpointService.list_endpoints_for_single_plugin(
tenant_id=tenant_id,
user_id=user_id,
Expand Down
11 changes: 0 additions & 11 deletions api/controllers/console/workspace/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ class DefaultModelApi(Resource):
@with_current_tenant_id
@model_validate(ParserGetDefault)
def get(self, req_data: ParserGetDefault, tenant_id: str):

model_provider_service = ModelProviderService()
default_model_entity = model_provider_service.get_default_model_of_model_type(
tenant_id=tenant_id, model_type=req_data.model_type
Expand Down Expand Up @@ -323,7 +322,6 @@ def post(self, req_data: ParserPostModels, tenant_id: str, provider: str):
@with_current_tenant_id
@model_validate(ParserDeleteModels)
def delete(self, req_data: ParserDeleteModels, tenant_id: str, provider: str):

model_provider_service = ModelProviderService()
model_provider_service.remove_model(
tenant_id=tenant_id, provider=provider, model=req_data.model, model_type=req_data.model_type
Expand All @@ -349,7 +347,6 @@ class ModelProviderModelCredentialApi(Resource):
@with_current_tenant_id
@model_validate(ParserGetCredentials)
def get(self, req_data: ParserGetCredentials, tenant_id: str, user: Account, provider: str):

model_provider_service = ModelProviderService()
current_credential = model_provider_service.get_model_credential(
tenant_id=tenant_id,
Expand Down Expand Up @@ -412,7 +409,6 @@ def get(self, req_data: ParserGetCredentials, tenant_id: str, user: Account, pro
@with_current_tenant_id
@model_validate(ParserCreateCredential)
def post(self, req_data: ParserCreateCredential, tenant_id: str, provider: str):

model_provider_service = ModelProviderService()

try:
Expand Down Expand Up @@ -445,7 +441,6 @@ def post(self, req_data: ParserCreateCredential, tenant_id: str, provider: str):
@with_current_tenant_id
@model_validate(ParserUpdateCredential)
def put(self, req_data: ParserUpdateCredential, current_tenant_id: str, provider: str):

model_provider_service = ModelProviderService()

try:
Expand Down Expand Up @@ -473,7 +468,6 @@ def put(self, req_data: ParserUpdateCredential, current_tenant_id: str, provider
@with_current_tenant_id
@model_validate(ParserDeleteCredential)
def delete(self, req_data: ParserDeleteCredential, current_tenant_id: str, provider: str):

model_provider_service = ModelProviderService()
model_provider_service.remove_model_credential(
tenant_id=current_tenant_id,
Expand All @@ -498,7 +492,6 @@ class ModelProviderModelCredentialSwitchApi(Resource):
@with_current_tenant_id
@model_validate(ParserSwitch)
def post(self, req_data: ParserSwitch, current_tenant_id: str, provider: str):

service = ModelProviderService()
service.add_model_credential_to_model_list(
tenant_id=current_tenant_id,
Expand All @@ -523,7 +516,6 @@ class ModelProviderModelEnableApi(Resource):
@rbac_permission_required(RBACCheck(RBACPermission.PLUGIN_PREFERENCES, Workspace()))
@model_validate(ParserDeleteModels)
def patch(self, req_data: ParserDeleteModels, tenant_id: str, provider: str):

model_provider_service = ModelProviderService()
model_provider_service.enable_model(
tenant_id=tenant_id, provider=provider, model=req_data.model, model_type=req_data.model_type
Expand All @@ -545,7 +537,6 @@ class ModelProviderModelDisableApi(Resource):
@rbac_permission_required(RBACCheck(RBACPermission.PLUGIN_PREFERENCES, Workspace()))
@model_validate(ParserDeleteModels)
def patch(self, req_data: ParserDeleteModels, tenant_id: str, provider: str):

model_provider_service = ModelProviderService()
model_provider_service.disable_model(
tenant_id=tenant_id, provider=provider, model=req_data.model, model_type=req_data.model_type
Expand Down Expand Up @@ -577,7 +568,6 @@ class ModelProviderModelValidateApi(Resource):
@with_current_tenant_id
@model_validate(ParserValidate)
def post(self, req_data: ParserValidate, tenant_id: str, provider: str):

model_provider_service = ModelProviderService()

result = True
Expand Down Expand Up @@ -615,7 +605,6 @@ class ModelProviderModelParameterRuleApi(Resource):
@with_current_tenant_id
@model_validate(ParserParameter)
def get(self, req_data: ParserParameter, tenant_id: str, provider: str):

model_provider_service = ModelProviderService()
parameter_rules = model_provider_service.get_model_parameter_rules(
tenant_id=tenant_id, provider=provider, model=req_data.model
Expand Down
15 changes: 0 additions & 15 deletions api/controllers/console/workspace/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@ class PluginListLatestVersionsApi(Resource):
@account_initialization_required
@model_validate(ParserLatest)
def post(self, req_data: ParserLatest):

try:
versions = PluginService.list_latest_versions(req_data.plugin_ids)
except PluginDaemonClientSideError as e:
Expand All @@ -708,7 +707,6 @@ class PluginListInstallationsFromIdsApi(Resource):
@with_current_tenant_id
@model_validate(ParserLatest)
def post(self, req_data: ParserLatest, tenant_id: str):

try:
plugins = PluginService.list_installations_from_ids(tenant_id, req_data.plugin_ids)
except PluginDaemonClientSideError as e:
Expand All @@ -725,7 +723,6 @@ class PluginIconApi(Resource):
@setup_required
@model_validate(ParserIcon)
def get(self, req_data: ParserIcon):

try:
icon_bytes, mimetype = PluginService.get_asset(req_data.tenant_id, req_data.filename)
except PluginDaemonClientSideError as e:
Expand All @@ -746,7 +743,6 @@ class PluginAssetApi(Resource):
@with_current_tenant_id
@model_validate(ParserAsset)
def get(self, req_data: ParserAsset, tenant_id: str):

try:
binary = PluginService.extract_asset(tenant_id, req_data.plugin_unique_identifier, req_data.file_name)
return send_file(io.BytesIO(binary), mimetype="application/octet-stream")
Expand Down Expand Up @@ -789,7 +785,6 @@ class PluginUploadFromGithubApi(Resource):
@with_current_tenant_id
@model_validate(ParserGithubUpload)
def post(self, req_data: ParserGithubUpload, tenant_id: str):

try:
response = PluginService.upload_pkg_from_github(
tenant_id, req_data.repo, req_data.version, req_data.package
Expand Down Expand Up @@ -833,7 +828,6 @@ class PluginInstallFromPkgApi(Resource):
@with_current_tenant_id
@model_validate(ParserPluginIdentifiers)
def post(self, req_data: ParserPluginIdentifiers, tenant_id: str):

try:
response = PluginService.install_from_local_pkg(tenant_id, req_data.plugin_unique_identifiers)
except PluginDaemonClientSideError as e:
Expand All @@ -855,7 +849,6 @@ class PluginInstallFromGithubApi(Resource):
@with_current_tenant_id
@model_validate(ParserGithubInstall)
def post(self, req_data: ParserGithubInstall, tenant_id: str):

try:
response = PluginService.install_from_github(
tenant_id,
Expand Down Expand Up @@ -883,7 +876,6 @@ class PluginInstallFromMarketplaceApi(Resource):
@with_current_tenant_id
@model_validate(ParserPluginIdentifiers)
def post(self, req_data: ParserPluginIdentifiers, tenant_id: str):

try:
response = PluginService.install_from_marketplace_pkg(tenant_id, req_data.plugin_unique_identifiers)
except PluginDaemonClientSideError as e:
Expand All @@ -905,7 +897,6 @@ class PluginFetchMarketplacePkgApi(Resource):
@with_current_tenant_id
@model_validate(ParserPluginIdentifierQuery)
def get(self, req_data: ParserPluginIdentifierQuery, tenant_id: str):

try:
return jsonable_encoder(
{
Expand All @@ -932,7 +923,6 @@ class PluginFetchManifestApi(Resource):
@with_current_tenant_id
@model_validate(ParserPluginIdentifierQuery)
def get(self, req_data: ParserPluginIdentifierQuery, tenant_id: str):

try:
return jsonable_encoder(
{
Expand All @@ -957,7 +947,6 @@ class PluginFetchInstallTasksApi(Resource):
@with_current_tenant_id
@model_validate(ParserTasks)
def get(self, req_data: ParserTasks, tenant_id: str):

try:
return jsonable_encoder(
{"tasks": PluginService.fetch_install_tasks(tenant_id, req_data.page, req_data.page_size)}
Expand Down Expand Up @@ -1043,7 +1032,6 @@ class PluginUpgradeFromMarketplaceApi(Resource):
@with_current_tenant_id
@model_validate(ParserMarketplaceUpgrade)
def post(self, req_data: ParserMarketplaceUpgrade, tenant_id: str):

try:
return jsonable_encoder(
PluginService.upgrade_plugin_with_marketplace(
Expand All @@ -1067,7 +1055,6 @@ class PluginUpgradeFromGithubApi(Resource):
@with_current_tenant_id
@model_validate(ParserGithubUpgrade)
def post(self, req_data: ParserGithubUpgrade, tenant_id: str):

try:
return jsonable_encoder(
PluginService.upgrade_plugin_with_github(
Expand Down Expand Up @@ -1096,7 +1083,6 @@ class PluginUninstallApi(Resource):
@with_current_tenant_id
@model_validate(ParserUninstall)
def post(self, req_data: ParserUninstall, tenant_id: str):

try:
return {
"success": PluginService.uninstall(
Expand Down Expand Up @@ -1171,7 +1157,6 @@ class PluginFetchDynamicSelectOptionsApi(Resource):
@with_current_tenant_id
@model_validate(ParserDynamicOptions)
def get(self, req_data: ParserDynamicOptions, tenant_id: str, current_user: Account):

try:
options = PluginParameterService.get_dynamic_select_options(
tenant_id=tenant_id,
Expand Down
Loading
Loading