Skip to content

add manual category for memories#3477

Merged
mdmohsin7 merged 3 commits intomainfrom
manual-memories
Nov 21, 2025
Merged

add manual category for memories#3477
mdmohsin7 merged 3 commits intomainfrom
manual-memories

Conversation

@mdmohsin7
Copy link
Copy Markdown
Member

@mdmohsin7 mdmohsin7 commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a 'manual' category for memories, allowing users to create memories that are not automatically categorized. The changes span both the frontend and backend, adding the new category to enums, UI components for filtering and creation, and updating the API to handle this new category.

My review has identified a critical issue in the backend logic that could lead to user-selected categories being incorrectly overridden. I've also pointed out an opportunity to refactor duplicated UI code in the Flutter app to improve maintainability. Please see the detailed comments for suggestions.

Comment on lines +30 to +33
if memory.category != MemoryCategory.manual:
# Only use the two primary categories for auto-categorization
categories = [MemoryCategory.interesting.value, MemoryCategory.system.value]
memory.category = identify_category_for_memory(memory.content, categories)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The current logic for auto-categorization is flawed. If a user manually creates a memory and selects the 'interesting' or 'system' category in the UI, this logic will override their choice by re-running the categorization. Since the client now sends a specific category ('manual', 'interesting', or 'system') when a user creates a memory, this auto-categorization logic is not only redundant but also introduces a bug. The category provided by the client should be trusted. I suggest removing this block.

Comment on lines +456 to +469
PopupMenuItem<FilterOption>(
value: FilterOption.manual,
child: Row(
children: [
const Text(
'Manual',
style: TextStyle(color: Colors.white),
),
const Spacer(),
if (_currentFilter == FilterOption.manual)
const Icon(Icons.check, size: 16, color: Colors.white),
],
),
),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This new PopupMenuItem for the 'Manual' filter option adds to the existing code duplication for creating these menu items. To improve maintainability and reduce redundancy, consider creating a helper method that generates these PopupMenuItem widgets. This would make the code cleaner and easier to update in the future.

For example, you could create a method like this:

PopupMenuItem<FilterOption> _buildFilterMenuItem(FilterOption option, String title) {
  return PopupMenuItem<FilterOption>(
    value: option,
    child: Row(
      children: [
        Text(
          title,
          style: const TextStyle(color: Colors.white),
        ),
        const Spacer(),
        if (_currentFilter == option)
          const Icon(Icons.check, size: 16, color: Colors.white),
      ],
    ),
  );
}

And then use it like this:

itemBuilder: (BuildContext context) => <PopupMenuEntry<FilterOption>>[
  _buildFilterMenuItem(FilterOption.all, 'All'),
  _buildFilterMenuItem(FilterOption.interesting, 'Interesting'),
  _buildFilterMenuItem(FilterOption.system, 'System'),
  _buildFilterMenuItem(FilterOption.manual, 'Manual'),
],

@mdmohsin7 mdmohsin7 merged commit aeb12c2 into main Nov 21, 2025
1 check passed
@mdmohsin7 mdmohsin7 deleted the manual-memories branch November 21, 2025 09:20
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant