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
@@ -46,6 +46,12 @@ type AIService interface {
|
||||
Write(ctx context.Context, c access.Caller, wsID string, in ai.WriteInput, onDelta func(string)) error
|
||||
|
||||
MCP(ctx context.Context, c access.Caller, canWrite bool, body []byte, onWrite func(tool, page string)) ([]byte, error)
|
||||
|
||||
Usage(ctx context.Context, c access.Caller, wsID string) (ai.UsageView, error)
|
||||
AllUsage(ctx context.Context, c access.Caller) ([]ai.UsageView, error)
|
||||
GetInstanceSettings(ctx context.Context, c access.Caller) (ai.InstanceSettings, error)
|
||||
SaveInstanceSettings(ctx context.Context, c access.Caller, in ai.InstanceSettings) (ai.InstanceSettings, error)
|
||||
Transcribe(ctx context.Context, c access.Caller, fileID string, summarize bool) (ai.Transcript, error)
|
||||
}
|
||||
|
||||
var errNoAI = apperr.NotFound("AI is not available on this server")
|
||||
@@ -166,6 +172,40 @@ func (a *api) aiRoutes(mux *routeMux) {
|
||||
a.respond(w, v, err)
|
||||
}))
|
||||
|
||||
// Monthly usage and its caps.
|
||||
mux.HandleFunc("GET "+ws("/usage"), a.withAI(func(w http.ResponseWriter, r *http.Request) {
|
||||
v, err := a.ai.Usage(r.Context(), caller(r), r.PathValue("id"))
|
||||
a.respond(w, v, err)
|
||||
}))
|
||||
mux.HandleFunc("GET /api/v1/admin/ai/usage", a.withAI(func(w http.ResponseWriter, r *http.Request) {
|
||||
v, err := a.ai.AllUsage(r.Context(), caller(r))
|
||||
a.respond(w, v, err)
|
||||
}))
|
||||
mux.HandleFunc("GET /api/v1/admin/ai/settings", a.withAI(func(w http.ResponseWriter, r *http.Request) {
|
||||
v, err := a.ai.GetInstanceSettings(r.Context(), caller(r))
|
||||
a.respond(w, v, err)
|
||||
}))
|
||||
mux.HandleFunc("PUT /api/v1/admin/ai/settings", a.withAI(func(w http.ResponseWriter, r *http.Request) {
|
||||
var in ai.InstanceSettings
|
||||
if !a.decode(w, r, &in) {
|
||||
return
|
||||
}
|
||||
v, err := a.ai.SaveInstanceSettings(r.Context(), caller(r), in)
|
||||
a.respond(w, v, err)
|
||||
}))
|
||||
|
||||
// Audio and video attachments → transcript and summary.
|
||||
mux.HandleFunc("POST /api/v1/files/{id}/transcribe", a.withAI(func(w http.ResponseWriter, r *http.Request) {
|
||||
var in struct {
|
||||
Summarize bool `json:"summarize"`
|
||||
}
|
||||
if !a.decode(w, r, &in) {
|
||||
return
|
||||
}
|
||||
v, err := a.ai.Transcribe(r.Context(), caller(r), r.PathValue("id"), in.Summarize)
|
||||
a.respond(w, v, err)
|
||||
}))
|
||||
|
||||
// Embeddings index and extra files.
|
||||
mux.HandleFunc("GET "+ws("/index"), a.withAI(func(w http.ResponseWriter, r *http.Request) {
|
||||
v, err := a.ai.IndexStatus(r.Context(), caller(r), r.PathValue("id"))
|
||||
|
||||
@@ -44,6 +44,7 @@ var unaudited = map[string]bool{
|
||||
"POST /api/v1/workspaces/{id}/ai/write": true,
|
||||
"POST /api/v1/workspaces/{id}/ai/sessions": true,
|
||||
"POST /api/v1/ai/sessions/{id}/fork": true,
|
||||
"POST /api/v1/files/{id}/transcribe": true,
|
||||
"PATCH /api/v1/ai/sessions/{id}": true,
|
||||
"DELETE /api/v1/ai/sessions/{id}": true,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user