Files
FabledCurator/frontend/src/components/modal/SuggestionsCategoryGroup.vue
T
bvandeusen 5c3f8ebd70
CI / lint (push) Successful in 3s
CI / frontend-build (push) Successful in 22s
CI / backend-lint-and-test (push) Successful in 35s
CI / integration (push) Successful in 3m7s
fix(aliases): store modal alias under raw model key + make aliases visible/manageable
The headline bug: aliases created from the modal NEVER resolved. Create
sent the normalized display name ('Sword', 'Uchiha Sasuke') while
resolution keys on the raw booru model key ('sword', 'uchiha_sasuke',
case-sensitive) — so the mapping was stored under a key nothing looks up,
and the prediction kept reappearing unaliased. The raw key wasn't even in
the /suggestions response, so the modal couldn't send it.

- Suggestion now carries raw_name (the model key an alias must use) and
  via_alias (surfaced via an operator alias); both serialized by the API.
- Modal alias-create sends raw_name, not display_name (the fix). Aliased
  suggestions show an 'alias' badge and a 'Remove alias' action; 'Treat as
  alias for…' is hidden for centroid hits (no model key) and already-aliased
  rows.
- Tag-side management: TagCard ⋮ → 'Aliases…' opens a dialog listing the
  model keys that fold into a tag, with remove (GET /api/tags/<id>/aliases +
  AliasService.list_for_tag). Creation stays in the modal suggestion flow.

Tests: full API round-trip locking the raw-key contract (raw_name exposed →
alias authored with it → resolves + via_alias on a later image);
list_for_tag (service + API); via_alias/raw_name on the existing service
suggestion tests. No migration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 13:05:58 -04:00

57 lines
1.7 KiB
Vue

<template>
<div class="fc-sgroup">
<button
v-if="collapsible"
class="fc-sgroup__header fc-sgroup__header--btn"
@click="open = !open"
>
<v-icon size="small">{{ open ? 'mdi-chevron-down' : 'mdi-chevron-right' }}</v-icon>
{{ label }} ({{ items.length }})
</button>
<div v-else class="fc-sgroup__header">{{ label }}</div>
<div v-show="open" class="fc-sgroup__items">
<SuggestionItem
v-for="(s, i) in items" :key="`${s.display_name}-${i}`"
:suggestion="s"
@accept="$emit('accept', $event)"
@alias="$emit('alias', $event)"
@remove-alias="$emit('remove-alias', $event)"
@dismiss="$emit('dismiss', $event)"
/>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
import SuggestionItem from './SuggestionItem.vue'
const props = defineProps({
label: { type: String, required: true },
items: { type: Array, required: true },
collapsible: { type: Boolean, default: false },
defaultOpen: { type: Boolean, default: true }
})
defineEmits(['accept', 'alias', 'remove-alias', 'dismiss'])
const open = ref(props.collapsible ? props.defaultOpen : true)
</script>
<style scoped>
.fc-sgroup { margin-bottom: 10px; }
.fc-sgroup__header {
font-family: 'Inter', sans-serif;
font-size: 11px; font-weight: 600;
text-transform: uppercase; letter-spacing: 0.06em;
color: rgb(var(--v-theme-on-surface-variant, var(--v-theme-on-surface)));
margin-bottom: 4px;
}
.fc-sgroup__header--btn {
display: flex; align-items: center; gap: 4px;
background: none; border: none; cursor: pointer;
padding: 0; width: 100%; text-align: left;
font: inherit; text-transform: uppercase; letter-spacing: 0.06em;
}
</style>