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

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:
tajniak81andClaude Opus 5.5 committed 2026-11-15 22:26:27 +01:00
1 parent 78b7710090
commit 0ebf064173
50 files changed
+2724 -79

No files matched your search

+121 -3
View File
@@ -3479,6 +3479,91 @@ paths:
schema: { type: object, additionalProperties: true }
"202": { description: A notification was received }
"401": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/ai/usage:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getAiUsage
tags: [ai]
summary: The workspace's AI usage this month, with its caps (workspace admin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiUsage" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/admin/ai/usage:
get:
operationId: listAiUsage
tags: [admin]
summary: Every workspace's AI usage this month, most first (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/AiUsage" } }
"403": { $ref: "#/components/responses/Error" }
/api/v1/admin/ai/settings:
get:
operationId: getInstanceAiSettings
tags: [admin]
summary: The server's AI rules (superadmin)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiInstanceSettings" }
"403": { $ref: "#/components/responses/Error" }
put:
operationId: saveInstanceAiSettings
tags: [admin]
summary: Replace the server's AI rules (superadmin)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/AiInstanceSettings" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiInstanceSettings" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
/api/v1/files/{id}/transcribe:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: transcribeFile
tags: [ai]
summary: Turn an audio or video attachment (up to 25 MB) into text, and optionally a summary (page reader)
description: >-
Uses the first profile of the page's workspace with a speech-to-text model (OpenAI-compatible
/audio/transcriptions). The summary comes from the workspace's chat profiles.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { type: object, properties: { summarize: { type: boolean } } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AiTranscript" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
components:
securitySchemes:
bearer:
@@ -4484,26 +4569,28 @@ components:
ids: { type: array, items: { type: string }, maxItems: 200 }
AiAvailability:
type: object
required: [chat, embeddings, canManage]
required: [chat, embeddings, transcribe, canManage]
properties:
chat: { type: boolean, description: A profile with a chat model is set up and AI is on }
embeddings: { type: boolean, description: The workspace is indexed for retrieval }
transcribe: { type: boolean, description: A profile can turn audio attachments into text }
canManage: { type: boolean, description: The caller may change the workspace's AI settings }
AiSettings:
type: object
required: [enabled, useInstanceProfiles, index, ignored]
required: [enabled, useInstanceProfiles, index, ignored, monthlyTokenLimit]
properties:
enabled: { type: boolean }
useInstanceProfiles: { type: boolean, description: After its own profiles, the workspace uses the instance's }
index: { type: boolean, description: Embed pages for retrieval (sends every page to the embedding provider) }
ignored: { type: array, items: { type: string }, description: Pages (with their subpages) that are neither indexed nor retrieved }
monthlyTokenLimit: { type: integer, minimum: 0, description: Tokens the workspace may use per month; 0 is no cap }
AiProviderKind:
type: string
enum: [openai, anthropic, ollama]
description: openai is any OpenAI-compatible API
AiProfile:
type: object
required: [id, workspace, name, kind, baseUrl, keySet, chatModel, embedModel, effort, enabled, position, usage, lastUsed, lastError, created]
required: [id, workspace, name, kind, baseUrl, keySet, chatModel, embedModel, transcribeModel, effort, enabled, position, usage, lastUsed, lastError, created]
properties:
id: { type: string }
workspace: { type: string, description: Empty for an instance default }
@@ -4513,6 +4600,7 @@ components:
keySet: { type: boolean, description: An API key is stored (keys are never returned) }
chatModel: { type: string }
embedModel: { type: string, description: Empty when the profile is not used for embeddings }
transcribeModel: { type: string, description: Speech-to-text model (OpenAI-compatible); empty when unused }
effort: { type: string, description: Anthropic effort level, empty for the model's default }
enabled: { type: boolean }
position: { type: integer }
@@ -4536,6 +4624,7 @@ components:
apiKey: { type: string, description: "Write-only; an empty string removes the key" }
chatModel: { type: string }
embedModel: { type: string }
transcribeModel: { type: string }
effort: { type: string, enum: ["", low, medium, high, xhigh, max] }
enabled: { type: boolean }
AiTestResult:
@@ -4635,3 +4724,32 @@ components:
before: { type: string, description: Text in front of the selection (continue) }
language: { type: string, description: Target language (translate) }
instruction: { type: string, maxLength: 2000, description: What to do (custom) }
AiUsage:
type: object
required: [workspace, month, requests, inputTokens, outputTokens, instanceTokens, limit, instanceLimit]
properties:
workspace: { type: string }
name: { type: string, description: The workspace's name (admin listing) }
month: { type: string, description: "Calendar month in UTC, e.g. 2026-11" }
requests: { type: integer }
inputTokens: { type: integer }
outputTokens: { type: integer }
instanceTokens: { type: integer, description: Tokens used through the server's own profiles }
limit: { type: integer, description: The workspace's monthly token cap; 0 is none }
instanceLimit: { type: integer, description: The server's cap on instanceTokens; 0 is none }
AiInstanceSettings:
type: object
required: [workspaceTokenLimit]
properties:
workspaceTokenLimit:
type: integer
minimum: 0
description: Tokens one workspace may use through the server's profiles per month; 0 is no cap
AiTranscript:
type: object
required: [name, text, summary]
properties:
name: { type: string }
text: { type: string }
summary: { type: string, description: Markdown; empty when not asked for or when it failed }
summaryError: { type: string }