AOSSIE-Org / AOSSIE-Org/Ell-ena
feat: AI task creation from natural language has no duplicate detection — saying "remind me to review the PR" twice creates two identical tasks with no warning
- Lenguaje dominante
- Dart
- Estrellas
- 54
- Forks
- 110
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
## 🚀 Problem Statement
Ell-ena's core value is: *"Generate to-do items and tickets using natural language commands."* The chat interface processes user messages via the Gemini NLU pipeline and creates tasks/tickets in the PostgreSQL database. However, there is no duplicate detection — if a user sends the same natural language command twice (common with voice input, network retries, or forgetfulness), two identical tasks are created silently.
For a project management AI assistant, duplicate tasks corrupt the workflow — a developer who sees "Review PR #42" twice on their task list doesn't know which one to check off, and checking off one doesn't remove the other.
## Proposed Fix
**1. Add semantic deduplication in the AI task creation flow:**
When a new task is about to be created, check the vector similarity between the new task's embedding and existing open tasks for the same user:
```typescript
// lib/screens/chat/ or services/ai_service.dart
async function createTaskWithDuplicateCheck(
taskData: TaskInput,
userId: string,
db: SupabaseClient
): Promise<{ task: Task; isDuplicate: boolean; similarTask?: Task }> {
// Generate embedding for new task
const newEmbedding = await generateEmbedding(taskData.title + ' ' + taskData.description);
// Search for semantically similar open tasks (threshold: 0.92 similarity)
const { data: similarTasks } = await db.rpc('find_similar_tasks', {
p_user_id: userId,
p_embedding: newEmbedding,
p_threshold: 0.92,
p_limit: 1,
});
if (similarTasks && similarTasks.length > 0) {
return { task: similarTasks[0], isDuplicate: true, similarTask: similarTasks[0] };
}
// No duplicate found — create the task
const { data: newTask } = await db.from('tasks').insert(taskData).select().single();
return { task: newTask, isDuplicate: false };
}
```
**2. In the Flutter chat UI** — when a duplicate is detected, show a confirmation dialog:
```dart
// lib/screens/chat/chat_screen.dart
if (result.isDuplicate) {
showDialog(
context: context,
builder: (_) => AlertDialog(
title: Text('Similar Task Found'),
content: Text(
'A similar task already exists: "${result.similarTask!.title}". '
'Would you like to create a new one anyway?'
),
actions: [
TextButton(onPressed: () => Navigator.pop(context), child: Text('No, use existing')),
TextButton(
onPressed: () { Navigator.pop(context); _forceCreateTask(taskData); },
child: Text('Yes, create new')
),
],
),
);
}
```
## Files to Create/Modify
| File | Change |
|---|---|
| `supabase/` | Add `find_similar_tasks` SQL RPC function |
| `lib/services/ai_service.dart` | Add `createTaskWithDuplicateCheck()` |
| `lib/screens/chat/` | Handle duplicate result and show confirmation dialog |
**Suggested labels:** `enhancement`, `frontend`, `backend`, `level: intermediate`
I would like to work on this. Could you please assign it to me?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Start by tracing task creation in lib/services/ai_service.dart and the chat flow in lib/screens/chat/, then inspect the existing Supabase schema and functions under supabase/. Done means open tasks for the same user are checked for semantic similarity before creation, and the chat UI clearly handles the existing-task and create-anyway choices.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- dart, flutter, postgresql, sql, supabase
- Área
- ai, backend, databases, mobile
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100