Skip to content

chore: some match case#36080

Merged
asukaminato0721 merged 2 commits into
langgenius:mainfrom
asukaminato0721:match-case
May 12, 2026
Merged

chore: some match case#36080
asukaminato0721 merged 2 commits into
langgenius:mainfrom
asukaminato0721:match-case

Conversation

@asukaminato0721
Copy link
Copy Markdown
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

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 make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

Copilot AI review requested due to automatic review settings May 12, 2026 11:45
@asukaminato0721 asukaminato0721 enabled auto-merge May 12, 2026 11:45
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 0.00% 43.66% +43.66%
Strict coverage 0.00% 43.19% +43.19%
Typed symbols 0 22,040 +22,040
Untyped symbols 0 28,749 +28,749
Modules 0 2551 +2,551

Copy link
Copy Markdown
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 conditional branching in the backend to use Python match/case for improved readability and structured dispatch in two areas: website extractor selection and advanced prompt rendering.

Changes:

  • Replaced if/elif/else chains with match/case for website provider selection in the RAG extraction processor.
  • Replaced if/elif/else chains with match/case for prompt edition_type and message role handling in advanced prompt transformation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
api/core/rag/extractor/extract_processor.py Refactors website provider dispatch to a match/case statement while keeping extraction behavior the same.
api/core/prompt/advanced_prompt_transform.py Refactors prompt edition/role branching to match/case; introduces a potential behavior change around falsy edition_type values.

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

Comment thread api/core/prompt/advanced_prompt_transform.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@asukaminato0721 asukaminato0721 added this pull request to the merge queue May 12, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 12, 2026
Merged via the queue into langgenius:main with commit 6facd93 May 12, 2026
27 checks passed
@asukaminato0721 asukaminato0721 deleted the match-case branch May 12, 2026 14:55
zhangtaodemama added a commit to zhangtaodemama/langgenius-dify-bfaadcb0c706 that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants