Skip to content

Conversation

@asukaminato0721
Copy link
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

part of #24421 , _ns has better typing support

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@asukaminato0721
Copy link
Contributor Author

/gemini review

@asukaminato0721 asukaminato0721 marked this pull request as ready for review November 15, 2025 07:12
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. 💪 enhancement New feature or request labels Nov 15, 2025
Copilot finished reviewing on behalf of asukaminato0721 November 15, 2025 07:13
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a large-scale refactoring that replaces the use of api with console_ns across numerous controller files. The goal is to improve typing support, which is a valuable enhancement for the codebase's maintainability. The changes are consistent and have been applied correctly throughout all the modified files. Additionally, some minor style improvements and type-hinting fixes have been included, which further polish the code. Overall, this is a solid refactoring effort.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the console API controllers to use console_ns instead of api for better typing support, as part of issue #24421. The change is purely a namespace/identifier replacement to improve type checking capabilities.

  • Removes the unused api import from all console controller files
  • Replaces all api.* decorator and method calls with console_ns.* equivalents
  • Includes minor refactoring of some RequestParser declarations to use method chaining

Reviewed Changes

Copilot reviewed 55 out of 55 changed files in this pull request and generated no comments.

Show a summary per file
File Description
workspace/workspace.py Updated decorator usage from api to console_ns
workspace/trigger_providers.py Replaced api with console_ns, refactored parser declarations
workspace/tool_providers.py Updated all api references to console_ns
workspace/plugin.py Replaced decorators and refactored parser
workspace/models.py Updated namespace references
workspace/model_providers.py Replaced api with console_ns
workspace/members.py Updated decorator namespace
workspace/endpoint.py Replaced all API documentation decorators
workspace/agent_providers.py Updated namespace usage
workspace/account.py Replaced api with console_ns
version.py Updated namespace and model references
tag/tags.py Replaced decorator namespace
setup.py Updated API documentation decorators
remote_files.py Replaced api usage
ping.py Updated namespace references
init_validate.py Replaced model and response decorators
feature.py Updated namespace usage
extension.py Replaced api with console_ns, updated payload reference
explore/recommended_app.py Updated decorator namespace
datasets/* Multiple dataset-related files updated to use console_ns
auth/* Authentication-related files updated
app/* All app controller files refactored to use console_ns
apikey.py Updated decorators and added type ignore comments
admin.py Replaced api with console_ns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@asukaminato0721
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a large-scale refactoring that replaces the usage of api with console_ns across numerous controller files. This change improves code consistency and leverages the better typing support offered by console_ns. The refactoring is well-executed, with consistent search-and-replace changes, along with some minor style improvements like chained reqparse calls. I have reviewed the changes and found no issues. The codebase is now more consistent in its use of flask-restx namespaces.

crazywoola
crazywoola previously approved these changes Nov 21, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 21, 2025
@asukaminato0721
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a large-scale refactoring to replace the api object with console_ns for better typing support. The changes are mostly mechanical and look correct. I've found a few places where type: ignore was used to suppress type errors. I've suggested adding proper type hints instead, which aligns with the goal of this PR. Overall, this is a great improvement.

@asukaminato0721
Copy link
Contributor Author

cc @crazywoola

@asukaminato0721 asukaminato0721 removed the lgtm This PR has been approved by a maintainer label Nov 21, 2025
@asukaminato0721
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a large-scale refactoring to consistently use console_ns instead of api for flask-restx decorators and helpers across the console controllers. This is a great improvement for code consistency and also enables better typing support, as stated in the PR description.

The changes have been applied correctly and consistently across all modified files. I've reviewed the replacements of @api.doc, @api.expect, @api.response, api.payload, api.add_resource, and api.abort with their console_ns equivalents, and they are all correct.

I particularly appreciate the refactoring of the get_rag_pipeline decorator in api/controllers/console/datasets/wraps.py to use ParamSpec and TypeVar, which is a modern and clean way to type decorators in Python.

Overall, this is a solid refactoring that improves the codebase's quality and maintainability. I don't see any issues with the changes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 57 out of 57 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants