Add category management tools to AI chat (list, create, delete)
Three new tools: list_categories shows all categories with type and parent, create_category adds a new one with optional parent nesting, delete_category removes non-system categories by name. Frontend renders category tables, success alerts for creation, and warning alerts for deletion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,44 @@
|
||||
from "{{ data.oldCategory }}" to "{{ data.newCategory }}"
|
||||
</v-alert>
|
||||
</div>
|
||||
|
||||
<!-- Categories List -->
|
||||
<div v-else-if="type === 'categories' && Array.isArray(data)">
|
||||
<v-table density="compact" class="text-caption rounded-lg mb-2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Parent</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="cat in data" :key="cat.id">
|
||||
<td>{{ cat.name }}</td>
|
||||
<td>
|
||||
<v-chip size="x-small" :color="cat.type === 'Income' ? 'success' : cat.type === 'Expense' ? 'error' : 'info'" variant="tonal">
|
||||
{{ cat.type }}
|
||||
</v-chip>
|
||||
</td>
|
||||
<td class="text-medium-emphasis">{{ cat.parentName || '-' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-table>
|
||||
</div>
|
||||
|
||||
<!-- Category Created -->
|
||||
<div v-else-if="type === 'category_created'">
|
||||
<v-alert type="success" variant="tonal" density="compact" class="mb-2 text-caption">
|
||||
Created {{ data.type }} category "{{ data.name }}"{{ data.parentName ? ` under "${data.parentName}"` : '' }}
|
||||
</v-alert>
|
||||
</div>
|
||||
|
||||
<!-- Category Deleted -->
|
||||
<div v-else-if="type === 'category_deleted'">
|
||||
<v-alert type="warning" variant="tonal" density="compact" class="mb-2 text-caption">
|
||||
Deleted {{ data.type }} category "{{ data.name }}"
|
||||
</v-alert>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
Reference in New Issue
Block a user