[PR #23786] Add web search app by API_KEY #30397

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

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

State: closed
Merged: No


fix #23724

Backend Changes:

  1. API Controller (/Users/apple/code/dify/api/controllers/console/app/app.py):
    - Added api_key parameter to the GET request parser
  2. App Service (/Users/apple/code/dify/api/services/app_service.py):
    - Imported ApiToken model
    - Added API-Key filtering logic that:
    • Searches for API tokens with matching prefix using LIKE query
    • Filters by tenant ID and token type ("app")
    • Returns empty results if no matches found

Frontend Changes:

  1. Query State Hook (/Users/apple/code/dify/web/app/components/apps/hooks/use-apps-query-state.ts):
    - Added apiKey to the query state type
    - Updated URL parameter parsing and serialization
  2. Apps List Component (/Users/apple/code/dify/web/app/components/apps/list.tsx):
    - Added apiKey state and handler functions
    - Updated API key fetching to include the api_key parameter
    - Added a new search input field with key icon
    - Implemented debounced search for API-Key input
  3. Input Component (`/Users/apple/code/dify/web/app/components/base/input/index.tsx):
    - Added leftIcon prop to support custom icons
    - Updated icon rendering logic to use custom icon when provided

Features:

  • Prefix Search: Users can search by entering the beginning of an API-Key (e.g., "app-abc" will match "app-abcdef123456")
  • Full Key Search: Users can paste the complete API-Key for exact matching
  • Combined Filters: API-Key search works with all existing filters (app type, tags, name, "Created by me")

Screenshots

image

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/23786 **State:** closed **Merged:** No --- fix #23724 Backend Changes: 1. API Controller (/Users/apple/code/dify/api/controllers/console/app/app.py): - Added api_key parameter to the GET request parser 2. App Service (/Users/apple/code/dify/api/services/app_service.py): - Imported ApiToken model - Added API-Key filtering logic that: - Searches for API tokens with matching prefix using LIKE query - Filters by tenant ID and token type ("app") - Returns empty results if no matches found Frontend Changes: 1. Query State Hook (/Users/apple/code/dify/web/app/components/apps/hooks/use-apps-query-state.ts): - Added apiKey to the query state type - Updated URL parameter parsing and serialization 2. Apps List Component (/Users/apple/code/dify/web/app/components/apps/list.tsx): - Added apiKey state and handler functions - Updated API key fetching to include the api_key parameter - Added a new search input field with key icon - Implemented debounced search for API-Key input 3. Input Component (`/Users/apple/code/dify/web/app/components/base/input/index.tsx): - Added leftIcon prop to support custom icons - Updated icon rendering logic to use custom icon when provided Features: - Prefix Search: Users can search by entering the beginning of an API-Key (e.g., "app-abc" will match "app-abcdef123456") - Full Key Search: Users can paste the complete API-Key for exact matching - Combined Filters: API-Key search works with all existing filters (app type, tags, name, "Created by me") ## Screenshots <img width="1920" height="937" alt="image" src="https://github.com/user-attachments/assets/cf8c27b9-4c0a-4663-b609-6701d134f328" /> ## 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:47:25 -05:00
yindo closed this issue 2026-02-21 20:47:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30397