[PR #27153] fix Version 2.0.0-beta.2: Chat annotations Api Error #25506 #31697

Closed
opened 2026-02-21 20:49:57 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/27153

State: closed
Merged: No


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

fix #25506
I think the reasons may be as follows:
1.Management endpoints (/v1/apps/annotations) require Account context.
2.The annotation list uses @ validate_app_token (without fetch_user_arg), while the annotation service layer internally calls Current_Countw_ith_tenant(), forcing that Current_user is Account and has already loaded Current_tenant. This is the root cause of 500.
3. using @ validate_app_token (fetch_user_arg=...), it will set the current user to EndUser based on the user parameter, and the service layer does not require an Account.

GET/v1/apps/annotations originally had 500 because it required an Account, but using only @ validate_app_token would not automatically set the Account; I have fixed it to automatically log in to the owner account before calling, now it won't be 500.

Screenshots

| Before | After |
|
微信图片_20251020152055_301_32
|
微信图片_20251017150711_299_32
|
| ... | ... |

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
**Original Pull Request:** https://github.com/langgenius/dify/pull/27153 **State:** closed **Merged:** No --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary fix #25506 I think the reasons may be as follows: 1.Management endpoints (/v1/apps/annotations) require Account context. 2.The annotation list uses @ validate_app_token (without fetch_user_arg), while the annotation service layer internally calls Current_Countw_ith_tenant(), forcing that Current_user is Account and has already loaded Current_tenant. This is the root cause of 500. 3. using @ validate_app_token (fetch_user_arg=...), it will set the current user to EndUser based on the user parameter, and the service layer does not require an Account. GET/v1/apps/annotations originally had 500 because it required an Account, but using only @ validate_app_token would not automatically set the Account; I have fixed it to automatically log in to the owner account before calling, now it won't be 500. ## Screenshots | Before | After | | <img width="1068" height="782" alt="微信图片_20251020152055_301_32" src="https://github.com/user-attachments/assets/55dca1d9-8856-4a23-933a-548f1e93f778" /> | <img width="1113" height="831" alt="微信图片_20251017150711_299_32" src="https://github.com/user-attachments/assets/9a7b32f6-bc62-4328-8b60-d5671ed9c6e5" /> | | ... | ... | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:49:57 -05:00
yindo closed this issue 2026-02-21 20:49:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31697