Implementation:Langgenius Dify Service Explore
| Knowledge Sources | |
|---|---|
| Domains | Frontend, API_Service |
| Last Updated | 2026-02-12 07:00 GMT |
Overview
Explore page API service module providing functions to fetch, install, uninstall, and manage recommended and installed applications in the Dify explore marketplace.
Description
explore.ts provides API service functions for the Dify Explore page, which serves as an application marketplace and discovery interface. The module exposes: fetchAppList to retrieve both the list of app categories and recommended applications sorted by position; fetchAppDetail to get detailed information about a specific explore app; fetchInstalledAppList to list all apps the user has installed (with optional filtering by app_id); uninstallApp to remove an installed app; updatePinStatus to pin or unpin an installed app using a PATCH request; getAppAccessModeByAppId to check the enterprise access mode (public vs. restricted) for a specific app; and fetchBanners to retrieve promotional banners for the explore page, with optional language filtering. All functions use the HTTP method wrappers from base.ts and return typed Promises.
Usage
Use this module in explore page components for listing, installing, and managing applications. These functions are typically consumed by the React Query hooks in use-explore.ts for cached data fetching.
Code Reference
Source Location
- Repository: Langgenius_Dify
- File: web/service/explore.ts
- Lines: 1-41
Signature
export const fetchAppList = () => Promise<{
categories: AppCategory[]
recommended_apps: App[]
}>
export const fetchAppDetail = (id: string): Promise<any>
export const fetchInstalledAppList = (app_id?: string | null) => Promise<any>
export const uninstallApp = (id: string) => Promise<any>
export const updatePinStatus = (id: string, isPinned: boolean) => Promise<any>
export const getAppAccessModeByAppId = (appId: string) => Promise<{ accessMode: AccessMode }>
export const fetchBanners = (language?: string): Promise<Banner[]>
Import
import {
fetchAppList,
fetchAppDetail,
fetchInstalledAppList,
uninstallApp,
updatePinStatus,
getAppAccessModeByAppId,
fetchBanners,
} from '@/service/explore'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Varies | App ID for detail, uninstall, or pin operations |
| app_id | string or null | No | Optional app ID filter for installed app list |
| isPinned | boolean | Yes (updatePinStatus) | Whether to pin (true) or unpin (false) the app |
| appId | string | Yes (getAppAccessModeByAppId) | App ID to check access mode for |
| language | string | No | Language code for filtering banners |
Outputs
| Name | Type | Description |
|---|---|---|
| categories | AppCategory[] | List of app categories for the explore page |
| recommended_apps | App[] | List of recommended applications |
| accessMode | AccessMode | The access mode (public, restricted) for the specified app |
| Banner[] | Banner[] | List of promotional banners for the explore page |
Usage Examples
Fetch Explore App List
import { fetchAppList } from '@/service/explore'
const { categories, recommended_apps } = await fetchAppList()
const sorted = recommended_apps.sort((a, b) => a.position - b.position)
Pin an Installed App
import { updatePinStatus } from '@/service/explore'
await updatePinStatus('installed-app-id', true) // Pin the app
Fetch Banners
import { fetchBanners } from '@/service/explore'
const banners = await fetchBanners('en-US')
Related Pages
- Principle:Langgenius_Dify_Explore_Feature
- Langgenius_Dify_Service_Base - HTTP method wrappers used by all functions
- Langgenius_Dify_Use_Explore - React Query hooks that consume these service functions