Skip to content

armgit / dify

Public Imported from GitHub
0

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

fix: querying and setting the system default model (#28743)

Willb786e101e52a
diff --git a/api/controllers/console/workspace/models.py b/api/controllers/console/workspace/models.py
index 8e402b4bae7..c820a8d1f29 100644
--- a/api/controllers/console/workspace/models.py
+++ b/api/controllers/console/workspace/models.py
@@ -1,5 +1,5 @@
import logging
-from typing import Any
+from typing import Any, cast
from flask import request
from flask_restx import Resource
@@ -26,7 +26,7 @@ class ParserGetDefault(BaseModel):
class ParserPostDefault(BaseModel):
class Inner(BaseModel):
model_type: ModelType
- model: str
+ model: str | None = None
provider: str | None = None
model_settings: list[Inner]
@@ -150,7 +150,7 @@ console_ns.schema_model(
@console_ns.route("/workspaces/current/default-model")
class DefaultModelApi(Resource):
- @console_ns.expect(console_ns.models[ParserGetDefault.__name__], validate=True)
+ @console_ns.expect(console_ns.models[ParserGetDefault.__name__])
@setup_required
@login_required
@account_initialization_required
@@ -186,7 +186,7 @@ class DefaultModelApi(Resource):
tenant_id=tenant_id,
model_type=model_setting.model_type,
provider=model_setting.provider,
- model=model_setting.model,
+ model=cast(str, model_setting.model),
)
except Exception as ex:
logger.exception(