Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(improve-api-endpoints): Added Datasets and Annotation APIs #12237

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jasonfish568
Copy link

@jasonfish568 jasonfish568 commented Dec 30, 2024

  • Added AnnotationReplyActionApi, AnnotationListApi, AnnotationUpdateDeleteApi
  • Added GET and PATCH endpoints to DatasetApi
  • Applied current_user in validate_app_token just like what it is done in validate_dataset_token
  • Added available model API

Close #11727

Summary

Basically copied the functions from console to the service api. Also added clear_partial_member_list() to Dataset Delete endpoint as what has been added in the console api.

I will keep working on this feature until it fulfills my needs. More endpoints will be added.

Checklist

Important

Please review the checklist below before submitting your pull request.

  • 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

- Added AnnotationReplyActionApi, AnnotationListApi, AnnotationUpdateDeleteApi
- Added GET and PATCH endpoints to DatasetApi
- Applied current_user in validate_app_token just like what it is done in validate_dataset_token

Related to: langgenius#11727
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 💪 enhancement New feature or request labels Dec 30, 2024
This API endpoint shares the same API token with Dataset API.
It is essential for patching the knowledge base in terms of embedding model.

Related to: langgenius#11727
@jasonfish568 jasonfish568 marked this pull request as draft December 31, 2024 05:43
jasonfish568 added a commit to jasonfish568/dify-docs that referenced this pull request Dec 31, 2024
Because app token is assigned to a specific app, the validate_app_token decorator has already validated the app_id.
The returned app_model is the app targeted. Therefore there is no need to pass app_id separately.
Simply use app_model.id instead. So app_id is removed from the api routes.

Related to: langgenius#11727
@jasonfish568 jasonfish568 marked this pull request as ready for review December 31, 2024 07:11
@dosubot dosubot bot added the 📚 documentation Improvements or additions to documentation label Dec 31, 2024
@crazywoola
Copy link
Member

Please fix the errors in CI.

@jasonfish568
Copy link
Author

Please fix the errors in CI.

Errors fixed.

@crazywoola
Copy link
Member

Please fix the errors in CI.

Errors fixed.

Please run dev/reformat to resolve the errors in the CI.

@jasonfish568
Copy link
Author

Please fix the errors in CI.

Errors fixed.

Please run dev/reformat to resolve the errors in the CI.

Sorry for the trouble. Code has now been reformated.

@crazywoola
Copy link
Member

crazywoola commented Jan 3, 2025

The code part LGTM, however you should add according docs to the API Access as well in CN, EN & JA.

@jasonfish568
Copy link
Author

The code part LGTM, however you should add according docs to the API Access as well in CN, EN & JA.

langgenius/dify-docs#424

The relevant docs have been added and amended outdated part.

I have included both Chinese and English versions. However as I do not speak Japanese, I wouldn't be able to verify the translated version therefore I would wait for a Japanese contributor get it translated in a later time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation 💪 enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Annotation API
2 participants