Add audio transcripts, monthly AI limits, PDF sources and AI chat on phones
CI / go (Server) (push) Failing after 25m5s
CI / go (Web-App) (push) Canceled after 0s
CI / frontend (push) Failing after 8m38s
CI / desktop (ubuntu-latest) (push) Successful in 1h41m20s
CI / mobile (push) Failing after 4m19s
CI / docker (push) Failing after 44m8s
Docs / build (push) Successful in 17m11s
Docs / deploy (push) Skipped
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
CI / go (Server) (push) Failing after 25m5s
CI / go (Web-App) (push) Canceled after 0s
CI / frontend (push) Failing after 8m38s
CI / desktop (ubuntu-latest) (push) Successful in 1h41m20s
CI / mobile (push) Failing after 4m19s
CI / docker (push) Failing after 44m8s
Docs / build (push) Successful in 17m11s
Docs / deploy (push) Skipped
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Follow-ups to Phase E (ADR-15):
- Transcription (E2): OpenAI-compatible profiles can name a speech-to-text
model; POST /files/{id}/transcribe turns an audio or video attachment
(up to 25 MB) into text and a summary with key points and action items.
The editor gets a Transcribe button on media files that inserts the
summary and the transcript in a toggle.
- Monthly token limits: ai_usage counts requests and tokens per workspace
and month. Workspace admins can cap their workspace; superadmins can cap
what each workspace uses through the server's providers, after which
the workspace's own providers keep working. The admin panel lists usage.
- PDF text for extra retrieval files (ledongthuc/pdf, pure Go).
- Phone app: an AI chat screen for the workspace or a page, with streamed
answers and sources that open the cited block.
- OpenAPI, generated clients, migration, translations and docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
78b7710090
commit
0ebf064173
50 files changed
+2724
-79
No files matched your search
@@ -307,6 +307,17 @@
|
||||
"effortDefault": "Standard des Modells",
|
||||
"add": "Anbieter hinzufügen",
|
||||
"mcpTitle": "MCP-Server",
|
||||
"mcpHint": "KI-Agenten und Werkzeuge verbinden sich mit /mcp auf diesem Server über ein persönliches API-Token (lesen oder lesen und schreiben). Sie handeln als Besitzer des Tokens, mit dessen Rechten."
|
||||
"mcpHint": "KI-Agenten und Werkzeuge verbinden sich mit /mcp auf diesem Server über ein persönliches API-Token (lesen oder lesen und schreiben). Sie handeln als Besitzer des Tokens, mit dessen Rechten.",
|
||||
"speech": "Sprache",
|
||||
"transcribeModel": "Sprache-zu-Text-Modell",
|
||||
"usageTitle": "Verbrauch in diesem Monat",
|
||||
"limitHint": "Begrenzt, wie viel jeder Arbeitsbereich pro Monat (UTC) über die Anbieter oben verbrauchen darf. Danach nutzen Arbeitsbereiche weiter ihre eigenen Anbieter.",
|
||||
"limit": "Tokens pro Arbeitsbereich und Monat",
|
||||
"noLimit": "Kein Limit",
|
||||
"workspace": "Arbeitsbereich",
|
||||
"requests": "Anfragen",
|
||||
"tokens": "Tokens",
|
||||
"serverTokens": "Über den Server",
|
||||
"noUsage": "In diesem Monat noch keine KI-Nutzung."
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,17 @@
|
||||
"effortDefault": "Model default",
|
||||
"add": "Add a provider",
|
||||
"mcpTitle": "MCP server",
|
||||
"mcpHint": "AI agents and tools connect to /mcp on this server with a personal API token (read, or read and write). They act as the token's owner, with that person's rights."
|
||||
"mcpHint": "AI agents and tools connect to /mcp on this server with a personal API token (read, or read and write). They act as the token's owner, with that person's rights.",
|
||||
"speech": "speech",
|
||||
"transcribeModel": "Speech-to-text model",
|
||||
"usageTitle": "Usage this month",
|
||||
"limitHint": "Cap what each workspace may use through the providers above per month (UTC). Workspaces keep using their own providers after that.",
|
||||
"limit": "Tokens per workspace per month",
|
||||
"noLimit": "No limit",
|
||||
"workspace": "Workspace",
|
||||
"requests": "Requests",
|
||||
"tokens": "Tokens",
|
||||
"serverTokens": "Through the server",
|
||||
"noUsage": "No AI use this month yet."
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,17 @@
|
||||
"effortDefault": "El del modelo",
|
||||
"add": "Añadir un proveedor",
|
||||
"mcpTitle": "Servidor MCP",
|
||||
"mcpHint": "Los agentes y herramientas de IA se conectan a /mcp en este servidor con un token de API personal (lectura, o lectura y escritura). Actúan como el dueño del token, con sus permisos."
|
||||
"mcpHint": "Los agentes y herramientas de IA se conectan a /mcp en este servidor con un token de API personal (lectura, o lectura y escritura). Actúan como el dueño del token, con sus permisos.",
|
||||
"speech": "voz",
|
||||
"transcribeModel": "Modelo de voz a texto",
|
||||
"usageTitle": "Consumo este mes",
|
||||
"limitHint": "Limita lo que cada espacio de trabajo puede consumir al mes (UTC) con los proveedores de arriba. Después, los espacios siguen con sus propios proveedores.",
|
||||
"limit": "Tokens por espacio de trabajo y mes",
|
||||
"noLimit": "Sin límite",
|
||||
"workspace": "Espacio de trabajo",
|
||||
"requests": "Solicitudes",
|
||||
"tokens": "Tokens",
|
||||
"serverTokens": "Con el servidor",
|
||||
"noUsage": "Aún no hay uso de IA este mes."
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,17 @@
|
||||
"effortDefault": "Valeur du modèle",
|
||||
"add": "Ajouter un fournisseur",
|
||||
"mcpTitle": "Serveur MCP",
|
||||
"mcpHint": "Les agents et outils d’IA se connectent à /mcp sur ce serveur avec un jeton d’API personnel (lecture, ou lecture et écriture). Ils agissent comme le propriétaire du jeton, avec ses droits."
|
||||
"mcpHint": "Les agents et outils d’IA se connectent à /mcp sur ce serveur avec un jeton d’API personnel (lecture, ou lecture et écriture). Ils agissent comme le propriétaire du jeton, avec ses droits.",
|
||||
"speech": "parole",
|
||||
"transcribeModel": "Modèle de transcription",
|
||||
"usageTitle": "Consommation ce mois-ci",
|
||||
"limitHint": "Plafonne ce que chaque espace de travail peut consommer par mois (UTC) via les fournisseurs ci-dessus. Ensuite, les espaces de travail continuent avec leurs propres fournisseurs.",
|
||||
"limit": "Jetons par espace de travail et par mois",
|
||||
"noLimit": "Aucune limite",
|
||||
"workspace": "Espace de travail",
|
||||
"requests": "Requêtes",
|
||||
"tokens": "Jetons",
|
||||
"serverTokens": "Via le serveur",
|
||||
"noUsage": "Aucune utilisation de l’IA ce mois-ci."
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,17 @@
|
||||
"effortDefault": "Domyślny modelu",
|
||||
"add": "Dodaj dostawcę",
|
||||
"mcpTitle": "Serwer MCP",
|
||||
"mcpHint": "Agenci i narzędzia AI łączą się z /mcp na tym serwerze za pomocą osobistego tokenu API (odczyt albo odczyt i zapis). Działają jako właściciel tokenu, z jego uprawnieniami."
|
||||
"mcpHint": "Agenci i narzędzia AI łączą się z /mcp na tym serwerze za pomocą osobistego tokenu API (odczyt albo odczyt i zapis). Działają jako właściciel tokenu, z jego uprawnieniami.",
|
||||
"speech": "mowa",
|
||||
"transcribeModel": "Model zamiany mowy na tekst",
|
||||
"usageTitle": "Zużycie w tym miesiącu",
|
||||
"limitHint": "Ogranicza, ile każdy obszar roboczy może zużyć miesięcznie (UTC) przez dostawców powyżej. Potem obszary nadal korzystają z własnych dostawców.",
|
||||
"limit": "Tokeny na obszar roboczy miesięcznie",
|
||||
"noLimit": "Bez limitu",
|
||||
"workspace": "Obszar roboczy",
|
||||
"requests": "Zapytania",
|
||||
"tokens": "Tokeny",
|
||||
"serverTokens": "Przez serwer",
|
||||
"noUsage": "W tym miesiącu nie użyto jeszcze AI."
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|
||||
<script setup lang="ts">
|
||||
import type { AiProfile, AiProfileInput, AiProviderKind, AiTestResult } from "@docwell/api-client";
|
||||
import type { AiProfile, AiProfileInput, AiProviderKind, AiTestResult, AiUsage } from "@docwell/api-client";
|
||||
import { DwButton, DwCallout } from "@docwell/ui";
|
||||
import { computed, onMounted, reactive, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
@@ -25,8 +25,12 @@ const form = reactive({
|
||||
apiKey: "",
|
||||
chatModel: "",
|
||||
embedModel: "",
|
||||
transcribeModel: "",
|
||||
effort: "",
|
||||
});
|
||||
const usage = ref<AiUsage[]>([]);
|
||||
const limitInput = ref("");
|
||||
const limitSaved = ref(false);
|
||||
|
||||
async function run(action: () => Promise<unknown>) {
|
||||
busy.value = true;
|
||||
@@ -43,11 +47,34 @@ async function run(action: () => Promise<unknown>) {
|
||||
const load = () =>
|
||||
run(async () => {
|
||||
profiles.value = await api.ai.profiles("");
|
||||
const inst = await api.ai.instanceSettings();
|
||||
limitInput.value = inst.workspaceTokenLimit ? String(inst.workspaceTokenLimit) : "";
|
||||
usage.value = await api.ai.allUsage();
|
||||
});
|
||||
onMounted(load);
|
||||
|
||||
const saveLimit = () =>
|
||||
run(async () => {
|
||||
const n = Math.max(0, Math.round(Number(limitInput.value) || 0));
|
||||
await api.ai.saveInstanceSettings({ workspaceTokenLimit: n });
|
||||
limitInput.value = n ? String(n) : "";
|
||||
usage.value = await api.ai.allUsage();
|
||||
limitSaved.value = true;
|
||||
setTimeout(() => (limitSaved.value = false), 2000);
|
||||
});
|
||||
const num = (n: number) => new Intl.NumberFormat(locale.value).format(n);
|
||||
|
||||
function startNew() {
|
||||
Object.assign(form, { name: "", kind: "openai", baseUrl: "", apiKey: "", chatModel: "", embedModel: "", effort: "" });
|
||||
Object.assign(form, {
|
||||
name: "",
|
||||
kind: "openai",
|
||||
baseUrl: "",
|
||||
apiKey: "",
|
||||
chatModel: "",
|
||||
embedModel: "",
|
||||
transcribeModel: "",
|
||||
effort: "",
|
||||
});
|
||||
keyTouched.value = false;
|
||||
editing.value = "new";
|
||||
}
|
||||
@@ -62,6 +89,7 @@ function setKind(kind: AiProviderKind) {
|
||||
if (form.chatModel === DEFAULT_CHAT[form.kind]) form.chatModel = DEFAULT_CHAT[kind];
|
||||
if (kind === "anthropic") form.embedModel = "";
|
||||
else form.effort = "";
|
||||
if (kind !== "openai") form.transcribeModel = "";
|
||||
form.kind = kind;
|
||||
}
|
||||
|
||||
@@ -73,6 +101,7 @@ const save = () =>
|
||||
baseUrl: form.baseUrl.trim(),
|
||||
chatModel: form.chatModel.trim(),
|
||||
embedModel: form.embedModel.trim(),
|
||||
transcribeModel: form.transcribeModel.trim(),
|
||||
effort: form.effort as AiProfileInput["effort"],
|
||||
};
|
||||
if (editing.value === "new" || keyTouched.value) input.apiKey = form.apiKey.trim();
|
||||
@@ -149,6 +178,7 @@ const total = computed(() =>
|
||||
{{ $t(`ai.kinds.${p.kind}`) }}
|
||||
<template v-if="p.chatModel"> · {{ p.chatModel }}</template>
|
||||
<template v-if="p.embedModel"> · {{ $t("ai.embeddings") }}: {{ p.embedModel }}</template>
|
||||
<template v-if="p.transcribeModel"> · {{ $t("ai.speech") }}: {{ p.transcribeModel }}</template>
|
||||
· {{ p.keySet ? $t("ai.keySet") : $t("ai.noKey") }}
|
||||
</p>
|
||||
<p class="text-ui-xs text-ink-faint">
|
||||
@@ -220,6 +250,10 @@ const total = computed(() =>
|
||||
<span class="text-ui-sm font-semibold">{{ $t("ai.embedModel") }}</span>
|
||||
<input v-model="form.embedModel" class="dw-input" :disabled="form.kind === 'anthropic'" />
|
||||
</label>
|
||||
<label v-if="form.kind === 'openai'" class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">{{ $t("ai.transcribeModel") }}</span>
|
||||
<input v-model="form.transcribeModel" class="dw-input" placeholder="whisper-1" />
|
||||
</label>
|
||||
<label v-if="form.kind === 'anthropic'" class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">{{ $t("ai.effort") }}</span>
|
||||
<select v-model="form.effort" class="dw-input">
|
||||
@@ -237,6 +271,57 @@ const total = computed(() =>
|
||||
<DwButton v-else class="mt-4" size="sm" icon="plus" @click="startNew">{{ $t("ai.add") }}</DwButton>
|
||||
</section>
|
||||
|
||||
<section class="mt-6 max-w-3xl dw-card" data-testid="admin-ai-usage">
|
||||
<h2 class="text-ui-lg">{{ $t("ai.usageTitle") }}</h2>
|
||||
<p class="mt-1 text-ui-sm text-ink-muted">{{ $t("ai.limitHint") }}</p>
|
||||
<form class="mt-3 flex flex-wrap items-end gap-2" @submit.prevent="saveLimit">
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">{{ $t("ai.limit") }}</span>
|
||||
<input
|
||||
v-model="limitInput"
|
||||
type="number"
|
||||
min="0"
|
||||
step="1000"
|
||||
class="dw-input w-56"
|
||||
:placeholder="$t('ai.noLimit')"
|
||||
/>
|
||||
</label>
|
||||
<DwButton type="submit" variant="secondary" :disabled="busy">{{ $t("common.save") }}</DwButton>
|
||||
<span v-if="limitSaved" class="text-ui-sm text-ink-muted">{{ $t("common.saved") }}</span>
|
||||
</form>
|
||||
<div class="mt-4 overflow-x-auto">
|
||||
<table class="w-full text-left text-ui-sm">
|
||||
<thead class="text-ink-muted">
|
||||
<tr>
|
||||
<th class="py-1 pr-3 font-medium">{{ $t("ai.workspace") }}</th>
|
||||
<th class="py-1 pr-3 text-right font-medium">{{ $t("ai.requests") }}</th>
|
||||
<th class="py-1 pr-3 text-right font-medium">{{ $t("ai.tokens") }}</th>
|
||||
<th class="py-1 text-right font-medium">{{ $t("ai.serverTokens") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-line">
|
||||
<tr v-for="u in usage" :key="u.workspace">
|
||||
<td class="py-1.5 pr-3">{{ u.name || u.workspace }}</td>
|
||||
<td class="py-1.5 pr-3 text-right tabular-nums">{{ num(u.requests) }}</td>
|
||||
<td class="py-1.5 pr-3 text-right tabular-nums">
|
||||
{{ num(u.inputTokens + u.outputTokens) }}
|
||||
<span v-if="u.limit" class="text-ink-muted">/ {{ num(u.limit) }}</span>
|
||||
</td>
|
||||
<td
|
||||
class="py-1.5 text-right tabular-nums"
|
||||
:class="{ 'text-danger': u.instanceLimit && u.instanceTokens >= u.instanceLimit }"
|
||||
>
|
||||
{{ num(u.instanceTokens) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!usage.length">
|
||||
<td colspan="4" class="py-2 text-ink-muted">{{ $t("ai.noUsage") }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mt-6 max-w-3xl dw-card">
|
||||
<h2 class="text-ui-lg">{{ $t("ai.mcpTitle") }}</h2>
|
||||
<p class="mt-1 text-ui-sm text-ink-muted">{{ $t("ai.mcpHint") }}</p>
|
||||
|
||||
Reference in new issue
Block a user