Add CalDAV calendar integration, LLM-suggested tags, and settings refinements

- CalDAV integration: per-user calendar config, create/list/search events
  via caldav library, LLM tools for calendar operations from chat
- LLM-suggested tags: new tag_suggestions service prompts LLM with existing
  tags and note content to suggest 3-5 relevant tags; exposed via API
  endpoints (suggest-tags, append-tag); integrated into editor views
  (suggest button + clickable pills) and chat tool calls (pills in
  ToolCallCard with one-click apply)
- Settings/model UI refinements, generation task improvements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 22:40:20 -05:00
parent 8996b45e50
commit d7bc3f3222
22 changed files with 1158 additions and 837 deletions
+145 -572
View File
@@ -1,10 +1,9 @@
<script setup lang="ts">
import { ref, computed, onMounted } from "vue";
import { ref, onMounted } from "vue";
import { useSettingsStore } from "@/stores/settings";
import { useAuthStore } from "@/stores/auth";
import { useToastStore } from "@/stores/toast";
import { apiGet, apiPost, apiPut } from "@/api/client";
import type { ModelInfo } from "@/types/settings";
const store = useSettingsStore();
const authStore = useAuthStore();
@@ -16,9 +15,6 @@ const confirmNewPassword = ref("");
const changingPassword = ref(false);
const saving = ref(false);
const saved = ref(false);
const pullProgress = ref<{ model: string; percent: number } | null>(null);
const deleting = ref<string | null>(null);
const confirmDelete = ref<string | null>(null);
const exporting = ref(false);
const restoring = ref(false);
const restoreFileInput = ref<HTMLInputElement | null>(null);
@@ -29,6 +25,18 @@ const notifySecurityAlerts = ref(true);
const savingNotifications = ref(false);
const notificationsSaved = ref(false);
// CalDAV settings (per-user)
const caldav = ref({
caldav_url: "",
caldav_username: "",
caldav_password: "",
caldav_calendar_name: "",
});
const savingCaldav = ref(false);
const caldavSaved = ref(false);
const testingCaldav = ref(false);
const caldavTestResult = ref<{ success: boolean; message?: string; error?: string; calendars?: string[] } | null>(null);
// SMTP settings (admin only)
const smtp = ref({
smtp_host: "",
@@ -44,187 +52,14 @@ const smtpSaved = ref(false);
const testRecipient = ref("");
const sendingTest = ref(false);
const MODEL_CATALOG: ModelInfo[] = [
// — General Purpose —
{
name: "llama3.2",
description: "Meta's Llama 3.2 — lightweight models (1B/3B) with 128K context. Great for low-resource setups.",
size: "2.0 GB",
bestFor: "Light tasks, fast responses, low RAM",
category: "General Purpose",
},
{
name: "llama3.1",
description: "Meta's Llama 3.1 8B — strong general-purpose model with good instruction following. 128K context.",
size: "4.9 GB",
bestFor: "General chat, writing, Q&A",
category: "General Purpose",
},
{
name: "llama3.3",
description: "Meta's Llama 3.3 70B — 405B-level performance in a 70B model. 128K context. Top tier open model.",
size: "43 GB",
bestFor: "Complex reasoning, detailed analysis",
category: "General Purpose",
},
{
name: "gemma3",
description: "Google's Gemma 3 — multimodal (vision + text), 1B to 27B. 128K context, 140+ languages.",
size: "5.2 GB",
bestFor: "Multilingual, vision, general tasks",
category: "General Purpose",
},
{
name: "qwen3",
description: "Alibaba's Qwen 3 — latest generation, 0.6B to 235B. Up to 256K context. Hybrid thinking modes.",
size: "4.7 GB",
bestFor: "Multilingual, reasoning, code, math",
category: "General Purpose",
},
{
name: "qwen2.5",
description: "Alibaba's Qwen 2.5 7B — multilingual model with strong coding and math skills. 32K context.",
size: "4.7 GB",
bestFor: "Multilingual, code, math",
category: "General Purpose",
},
{
name: "mistral",
description: "Mistral 7B v0.3 — fast and efficient with function calling support. 32K context.",
size: "4.1 GB",
bestFor: "Fast responses, general tasks",
category: "General Purpose",
},
{
name: "phi4",
description: "Microsoft Phi-4 14B — strong reasoning and math for its size. Successor to Phi-3.",
size: "9.1 GB",
bestFor: "Reasoning, math, structured tasks",
category: "General Purpose",
},
{
name: "command-r",
description: "Cohere's Command R 35B — enterprise-grade model with 128K context and light content filtering.",
size: "20 GB",
bestFor: "RAG, conversation, creative tasks",
category: "General Purpose",
},
// — Reasoning —
{
name: "deepseek-r1",
description: "DeepSeek R1 — chain-of-thought reasoning model. Distilled versions from 1.5B to 70B run locally.",
size: "4.7 GB",
bestFor: "Step-by-step reasoning, math, logic",
category: "Reasoning",
},
// — Coding —
{
name: "qwen2.5-coder",
description: "Alibaba's Qwen 2.5 Coder — 0.5B to 32B. 32B version rivals GPT-4o on coding benchmarks.",
size: "4.7 GB",
bestFor: "Code generation, refactoring, debugging",
category: "Coding",
},
{
name: "deepseek-coder-v2",
description: "DeepSeek Coder V2 16B — strong coding model with 160K context and math ability.",
size: "8.9 GB",
bestFor: "Code, math, technical problem solving",
category: "Coding",
},
// — Uncensored / Creative Writing —
{
name: "dolphin3",
description: "Eric Hartford's Dolphin 3 — next-gen uncensored model based on Llama 3.1 8B. 128K context.",
size: "4.9 GB",
bestFor: "Uncensored chat, coding, creative writing",
category: "Uncensored / Creative Writing",
},
{
name: "dolphin-mistral",
description: "Dolphin fine-tune of Mistral 7B. Safety/refusal data removed from training. 32K context.",
size: "4.1 GB",
bestFor: "Uncensored general chat, creative writing",
category: "Uncensored / Creative Writing",
},
{
name: "dolphin-llama3",
description: "Dolphin fine-tune of Llama 3 8B. Uncensored training on a strong base model.",
size: "4.7 GB",
bestFor: "Uncensored chat, strong reasoning",
category: "Uncensored / Creative Writing",
},
{
name: "dolphin-mixtral",
description: "Dolphin fine-tune of Mixtral 8x7B MoE. Uncensored with mixture-of-experts architecture.",
size: "26 GB",
bestFor: "Uncensored + high capability (needs RAM)",
category: "Uncensored / Creative Writing",
},
{
name: "nous-hermes2",
description: "Nous Research's Hermes 2 — trained on diverse synthetic data with minimal refusal behavior.",
size: "4.1 GB",
bestFor: "Instruction following, few refusals",
category: "Uncensored / Creative Writing",
},
{
name: "openhermes",
description: "Community fine-tune focused on helpfulness. Based on Mistral 7B without refusal patterns.",
size: "4.1 GB",
bestFor: "Helpful assistant, minimal filtering",
category: "Uncensored / Creative Writing",
},
];
const selectedModel = ref("");
const modelTab = ref<"installed" | "available">("installed");
// Base URL setting (admin only)
const baseUrl = ref("");
const savingBaseUrl = ref(false);
const baseUrlSaved = ref(false);
const modelStatuses = computed(() => {
const installed = new Set(
store.installedModels.map((m) => m.replace(/:latest$/, ""))
);
return MODEL_CATALOG.map((m) => ({
...m,
installed: installed.has(m.name) || installed.has(m.name.replace(/:.*$/, "")),
active: isActiveModel(m.name),
}));
});
const installedModels = computed(() =>
modelStatuses.value.filter((m) => m.installed)
);
const categories = computed(() => {
const cats: string[] = [];
for (const m of modelStatuses.value) {
if (!cats.includes(m.category)) cats.push(m.category);
}
return cats;
});
function modelsInCategory(category: string) {
return modelStatuses.value.filter((m) => m.category === category);
}
function isActiveModel(name: string): boolean {
const current = selectedModel.value || store.defaultModel;
if (!current) return false;
const cleanCurrent = current.replace(/:latest$/, "");
const cleanName = name.replace(/:latest$/, "");
return cleanCurrent === cleanName;
}
onMounted(async () => {
await store.fetchSettings();
assistantName.value = store.assistantName;
selectedModel.value = store.defaultModel;
store.fetchInstalledModels();
// Load notification preferences from user settings
const allSettings = await apiGet<Record<string, string>>("/api/settings");
@@ -235,6 +70,14 @@ onMounted(async () => {
notifySecurityAlerts.value = allSettings.notify_security_alerts !== "false";
}
// Load CalDAV settings
try {
const caldavConfig = await apiGet<Record<string, string>>("/api/settings/caldav");
caldav.value = { ...caldav.value, ...caldavConfig };
} catch {
// CalDAV not configured yet
}
// Load admin settings
if (authStore.isAdmin) {
try {
@@ -291,63 +134,6 @@ async function saveAssistant() {
}
}
async function selectModel(name: string) {
selectedModel.value = name;
saving.value = true;
try {
await store.updateSettings({ default_model: name });
} finally {
saving.value = false;
}
}
async function pullModel(name: string) {
pullProgress.value = { model: name, percent: 0 };
try {
await store.pullModel(name, (data) => {
if (data.error) {
pullProgress.value = null;
return;
}
const completed = data.completed as number | undefined;
const total = data.total as number | undefined;
if (completed != null && total && total > 0) {
pullProgress.value = {
model: name,
percent: Math.round((completed / total) * 100),
};
}
});
await store.fetchInstalledModels();
} catch {
// error already handled
} finally {
pullProgress.value = null;
}
}
async function removeModel(name: string) {
if (confirmDelete.value !== name) {
confirmDelete.value = name;
return;
}
confirmDelete.value = null;
deleting.value = name;
try {
await store.deleteModel(name);
// If the deleted model was active, clear the selection
if (isActiveModel(name)) {
selectedModel.value = "";
}
} finally {
deleting.value = null;
}
}
function cancelDelete() {
confirmDelete.value = null;
}
async function exportData(scope: "user" | "full") {
exporting.value = true;
try {
@@ -393,6 +179,38 @@ async function saveNotifications() {
}
}
async function saveCaldav() {
savingCaldav.value = true;
caldavSaved.value = false;
try {
await apiPut("/api/settings/caldav", caldav.value);
caldavSaved.value = true;
setTimeout(() => (caldavSaved.value = false), 2000);
} catch {
toastStore.show("Failed to save CalDAV settings", "error");
} finally {
savingCaldav.value = false;
}
}
async function testCaldav() {
testingCaldav.value = true;
caldavTestResult.value = null;
try {
const result = await apiPost<{ success: boolean; message?: string; error?: string; calendars?: string[] }>("/api/settings/caldav/test", {});
caldavTestResult.value = result;
} catch (e: unknown) {
if (e && typeof e === "object" && "body" in e) {
const body = (e as { body?: { error?: string } }).body;
caldavTestResult.value = { success: false, error: body?.error || "Connection test failed" };
} else {
caldavTestResult.value = { success: false, error: "Connection test failed" };
}
} finally {
testingCaldav.value = false;
}
}
async function saveSmtp() {
savingSmtp.value = true;
smtpSaved.value = false;
@@ -576,6 +394,55 @@ async function handleRestoreFile(event: Event) {
</div>
</section>
<section class="settings-section">
<h2>Calendar (CalDAV)</h2>
<p class="section-desc">
Connect to a CalDAV server (Nextcloud, iCloud, Radicale, Baikal) to create and view calendar events from chat.
</p>
<div class="caldav-grid">
<div class="field">
<label for="caldav-url">CalDAV URL</label>
<input id="caldav-url" v-model="caldav.caldav_url" type="url" placeholder="https://cloud.example.com/remote.php/dav" class="input" />
</div>
<div class="field">
<label for="caldav-username">Username</label>
<input id="caldav-username" v-model="caldav.caldav_username" type="text" class="input" />
</div>
<div class="field">
<label for="caldav-password">Password</label>
<input id="caldav-password" v-model="caldav.caldav_password" type="password" class="input" />
</div>
<div class="field">
<label for="caldav-calendar-name">Calendar Name</label>
<input id="caldav-calendar-name" v-model="caldav.caldav_calendar_name" type="text" placeholder="Leave empty to use first available" class="input" />
<p class="field-hint">Optional. The exact name of the calendar to use.</p>
</div>
</div>
<div class="actions" style="margin-bottom: 1rem;">
<button class="btn-save" @click="saveCaldav" :disabled="savingCaldav">
{{ savingCaldav ? "Saving..." : "Save" }}
</button>
<span v-if="caldavSaved" class="saved-msg">Saved!</span>
<button class="btn-save btn-test" @click="testCaldav" :disabled="testingCaldav">
{{ testingCaldav ? "Testing..." : "Test Connection" }}
</button>
</div>
<div v-if="caldavTestResult" class="test-result" :class="{ success: caldavTestResult.success, error: !caldavTestResult.success }">
<template v-if="caldavTestResult.success">
{{ caldavTestResult.message }}
<div v-if="caldavTestResult.calendars?.length" class="test-calendars">
Calendars: {{ caldavTestResult.calendars.join(", ") }}
</div>
</template>
<template v-else>
{{ caldavTestResult.error }}
</template>
</div>
</section>
<section v-if="authStore.isAdmin" class="settings-section">
<h2>Application URL</h2>
<p class="section-desc">
@@ -664,126 +531,6 @@ async function handleRestoreFile(event: Event) {
</div>
</section>
<section class="settings-section">
<h2>Model</h2>
<div class="model-tabs">
<button
class="model-tab"
:class="{ active: modelTab === 'installed' }"
@click="modelTab = 'installed'"
>
Installed
</button>
<button
class="model-tab"
:class="{ active: modelTab === 'available' }"
@click="modelTab = 'available'"
>
Available
</button>
</div>
<!-- Installed tab -->
<template v-if="modelTab === 'installed'">
<p class="section-desc">
Models currently downloaded and ready to use.
</p>
<div v-if="installedModels.length === 0" class="empty-state">
No models installed. Browse the Available tab to download one.
</div>
<div v-else class="model-list">
<div
v-for="model in installedModels"
:key="model.name"
class="model-card"
:class="{ active: model.active }"
>
<div class="model-info">
<div class="model-name-row">
<span class="model-name">{{ model.name }}</span>
<span class="model-size">{{ model.size }}</span>
</div>
</div>
<div class="model-actions">
<button
v-if="!model.active"
class="btn-select"
@click="selectModel(model.name)"
:disabled="saving"
>
Select
</button>
<span v-else class="active-badge">Active</span>
<template v-if="confirmDelete === model.name">
<button
class="btn-confirm-delete"
@click="removeModel(model.name)"
:disabled="deleting !== null"
>
{{ deleting === model.name ? "Removing..." : "Confirm" }}
</button>
<button class="btn-cancel-delete" @click="cancelDelete">
Cancel
</button>
</template>
<button
v-else
class="btn-remove"
@click="removeModel(model.name)"
:disabled="deleting !== null || model.active"
:title="model.active ? 'Cannot remove the active model' : 'Remove model'"
>
Remove
</button>
</div>
</div>
</div>
</template>
<!-- Available tab -->
<template v-if="modelTab === 'available'">
<p class="section-desc">
Browse and download models. Models need to be downloaded before use.
</p>
<div v-for="cat in categories" :key="cat" class="model-category">
<h3 class="category-label">{{ cat }}</h3>
<div class="model-list">
<div
v-for="model in modelsInCategory(cat)"
:key="model.name"
class="model-card"
:class="{ active: model.active }"
>
<div class="model-info">
<div class="model-name-row">
<span class="model-name">{{ model.name }}</span>
<span class="model-size">{{ model.size }}</span>
</div>
<p class="model-desc">{{ model.description }}</p>
<p class="model-best-for">
<strong>Best for:</strong> {{ model.bestFor }}
</p>
</div>
<div class="model-actions">
<template v-if="model.installed">
<span class="installed-badge">Installed</span>
</template>
<button
v-else
class="btn-pull"
@click="pullModel(model.name)"
:disabled="pullProgress !== null"
>
{{ pullProgress?.model === model.name ? `Downloading ${pullProgress.percent}%` : "Download" }}
</button>
</div>
</div>
</div>
</div>
</template>
</section>
<section class="settings-section">
<h2>Data</h2>
<p class="section-desc">Export your data or restore from a backup.</p>
@@ -917,223 +664,6 @@ async function handleRestoreFile(event: Event) {
color: var(--color-danger);
}
/* Model list */
.model-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.model-card {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
padding: 1rem;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: var(--color-bg);
transition: border-color 0.15s;
}
.model-card.active {
border-color: var(--color-primary);
background: color-mix(in srgb, var(--color-primary) 5%, var(--color-bg));
}
.model-info {
flex: 1;
min-width: 0;
}
.model-name-row {
display: flex;
align-items: baseline;
gap: 0.5rem;
margin-bottom: 0.3rem;
}
.model-name {
font-weight: 600;
font-size: 0.95rem;
font-family: monospace;
}
.model-size {
font-size: 0.75rem;
color: var(--color-text-muted);
white-space: nowrap;
}
.model-desc {
margin: 0 0 0.25rem;
font-size: 0.85rem;
color: var(--color-text-secondary);
line-height: 1.4;
}
.model-best-for {
margin: 0;
font-size: 0.8rem;
color: var(--color-text-muted);
}
.model-best-for strong {
color: var(--color-text-secondary);
}
.btn-select {
padding: 0.35rem 0.9rem;
background: var(--color-primary);
color: #fff;
border: none;
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 0.85rem;
}
.btn-select:hover:not(:disabled) {
opacity: 0.9;
}
.btn-select:disabled {
opacity: 0.6;
cursor: default;
}
.btn-pull {
padding: 0.35rem 0.9rem;
background: var(--color-bg-secondary);
color: var(--color-text);
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 0.85rem;
}
.btn-pull:hover:not(:disabled) {
border-color: var(--color-primary);
color: var(--color-primary);
}
.btn-pull:disabled {
opacity: 0.6;
cursor: default;
}
.active-badge {
padding: 0.25rem 0.75rem;
background: var(--color-primary);
color: #fff;
border-radius: var(--radius-lg);
font-size: 0.8rem;
font-weight: 600;
}
/* Model tabs */
.model-tabs {
display: flex;
gap: 0.5rem;
margin-bottom: 1rem;
}
.model-tab {
padding: 0.4rem 1rem;
background: transparent;
color: var(--color-text-muted);
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
}
.model-tab.active {
background: var(--color-primary);
color: #fff;
border-color: var(--color-primary);
}
.model-tab:hover:not(.active) {
border-color: var(--color-text-muted);
color: var(--color-text);
}
/* Installed badge on available tab */
.installed-badge {
padding: 0.25rem 0.75rem;
background: var(--color-success);
color: #fff;
border-radius: var(--radius-lg);
font-size: 0.8rem;
font-weight: 600;
white-space: nowrap;
}
/* Empty state */
.empty-state {
padding: 2rem 1rem;
text-align: center;
color: var(--color-text-muted);
font-size: 0.9rem;
border: 1px dashed var(--color-border);
border-radius: var(--radius-md);
}
/* Category headers */
.model-category {
margin-bottom: 1.5rem;
}
.model-category:last-child {
margin-bottom: 0;
}
.category-label {
margin: 0 0 0.5rem;
font-size: 0.85rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--color-text-muted);
}
/* Model actions layout */
.model-actions {
display: flex;
align-items: center;
flex-shrink: 0;
gap: 0.4rem;
}
/* Remove button */
.btn-remove {
padding: 0.25rem 0.6rem;
background: transparent;
color: var(--color-text-muted);
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 0.75rem;
}
.btn-remove:hover:not(:disabled) {
border-color: var(--color-danger);
color: var(--color-danger);
}
.btn-remove:disabled {
opacity: 0.4;
cursor: default;
}
.btn-confirm-delete {
padding: 0.25rem 0.6rem;
background: var(--color-danger);
color: #fff;
border: none;
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 0.75rem;
font-weight: 600;
}
.btn-confirm-delete:hover:not(:disabled) {
filter: brightness(0.9);
}
.btn-confirm-delete:disabled {
opacity: 0.6;
cursor: default;
}
.btn-cancel-delete {
padding: 0.25rem 0.6rem;
background: transparent;
color: var(--color-text-muted);
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 0.75rem;
}
.btn-cancel-delete:hover {
color: var(--color-text);
border-color: var(--color-text-muted);
}
/* Data section */
.data-actions {
display: flex;
@@ -1196,6 +726,49 @@ async function handleRestoreFile(event: Event) {
accent-color: var(--color-primary);
}
/* CalDAV grid */
.caldav-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0 1rem;
}
@media (max-width: 480px) {
.caldav-grid {
grid-template-columns: 1fr;
}
}
.btn-test {
background: var(--color-bg-secondary);
color: var(--color-text);
border: 1px solid var(--color-border);
}
.btn-test:hover:not(:disabled) {
border-color: var(--color-primary);
color: var(--color-primary);
opacity: 1;
}
.test-result {
padding: 0.75rem 1rem;
border-radius: var(--radius-sm);
font-size: 0.9rem;
line-height: 1.4;
}
.test-result.success {
background: color-mix(in srgb, var(--color-success) 10%, var(--color-bg));
border: 1px solid var(--color-success);
color: var(--color-success);
}
.test-result.error {
background: color-mix(in srgb, var(--color-danger) 10%, var(--color-bg));
border: 1px solid var(--color-danger);
color: var(--color-danger);
}
.test-calendars {
margin-top: 0.35rem;
font-size: 0.85rem;
opacity: 0.85;
}
/* SMTP grid */
.smtp-grid {
display: grid;