Add workflow support and enhance runtime configuration in models and services
- Introduce RuntimeModelResource and RuntimeKnowledgeBase classes to manage workflow resources. - Update AssistantConfig to include workflow_model_resources and workflow_knowledge_bases for better integration. - Refactor validation and processing logic in routes and services to accommodate workflow types. - Implement dynamic variable support for workflow assistants and enhance graph normalization. - Add ToolExecutor for reusable tool execution across different assistant types. - Update various services to ensure compatibility with new workflow features and improve error handling.
This commit is contained in:
@@ -109,6 +109,17 @@ def clear_auth_cookie(response: Response) -> None:
|
||||
|
||||
async def require_admin(request: Request) -> AdminUser:
|
||||
user = verify_admin_token(request.cookies.get(settings.AUTH_COOKIE_NAME))
|
||||
if not user:
|
||||
authorization = request.headers.get("authorization", "")
|
||||
scheme, _, encoded_credentials = authorization.partition(" ")
|
||||
if scheme.lower() == "basic" and encoded_credentials:
|
||||
try:
|
||||
credentials = base64.b64decode(encoded_credentials).decode("utf-8")
|
||||
username, separator, password = credentials.partition(":")
|
||||
if separator:
|
||||
user = authenticate_admin(username, password)
|
||||
except (ValueError, UnicodeDecodeError):
|
||||
user = None
|
||||
if not user:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
|
||||
Reference in New Issue
Block a user