Actions
dev #2888
opendev #2838: [Module] Sprint 12
[BE] Recommended Task API
Description
Features¶
1. Implement Task Recommendation API¶
-
Endpoint:
GET /api/v1/recommended-task - Exclude already-selected tasks to focus on new discoveries.
- Perform semantic matching to find related tasks using keyword analysis.
- Use a dual algorithm to provide personalized recommendations with a popular task fallback.
- Optimize performance by executing queries in parallel and conditionally including fields.
2. Add Newsletter Integration Function¶
-
Function:
getRecommendedTasksForNewsletter() - Provide task recommendations for email campaigns.
- Integrate with the existing newsletter worker system.
- Implement robust error handling with JSON response format.
Example Usage¶
Use Recommended Task API¶
Endpoint: GET /api/v1/recommended-task
Query Parameters:
{
limit?: string, // Default: "10"
page?: string, // Default: "1", Min: 1
includeToolCount?: string // Default: "false", Options: "true"|"false"
}
Expected Response:
{
"success": true,
"data": {
"tasks": [
{
"id": "9355a678-60e9-4e85-92fe-ef567bc77ff0",
"taskName": "academic research",
"recommendationScore": 11,
"toolCount": 17
},
{
"id": "af444c96-8382-4758-8f8f-6229be50f5a3",
"taskName": "research assistance",
"recommendationScore": 11,
"toolCount": 11
},
{
"id": "bdc696de-6ddf-4442-8693-10f6a7b7d526",
"taskName": "market research",
"recommendationScore": 11,
"toolCount": 24
}
],
"recommendation_type": "personalized"
},
"pagination": {
"page": 1,
"limit": 3,
"totalCount": 2715,
"totalPages": 905
}
}
Use Recommended Task Function¶
Function : getRecommendedTasksForNewsletter(limit, page, includeToolCount)
Function Parameters :
{
limit?: string, // Default: "10"
page?: string, // Default: "1", Min: 1
includeToolCount?: boolean // Default: false
}
Expected Response :
Return the same structure as the Recommended Task API response.
Actions