chore: retire zen-backed summarization

Disable the active Zen summarization flow because the unauthenticated/free Zen provider is no longer available and now returns usage-limit errors for this feature.

Keep /api/text/summarize as an API-compatible stub that returns local sanitized or distilled fallback text with summarized=false, rather than attempting external model calls.

Remove notification and voice playback summary behavior from runtime paths. Notification {last_message} now always uses normalized truncated text, and TTS playback ignores historical summarize request fields.

Hide the notification summary settings and voice summarize-before-playback controls while preserving legacy persisted settings for compatibility. Also disable Zen model startup validation and make Zen model list routes return empty results.

Update module documentation and tests to describe the retired provider behavior and the remaining compatibility stubs.
This commit is contained in:
Bohdan Triapitsyn
2026-05-19 02:06:52 +03:00
parent a57b02a308
commit 174fa4e96d
27 changed files with 137 additions and 1136 deletions
+6 -41
View File
@@ -1,8 +1,8 @@
import express from 'express';
import { normalizeCustomOpenAIBaseURL } from './base-url.js';
import { summarizeText, sanitizeForTTS, sanitizeForNote, sanitizeForNotification } from '../text/summarization.js';
import { summarizeText, sanitizeForTTS, sanitizeForNote } from '../text/summarization.js';
export function registerTtsRoutes(app, { resolveZenModel, sayTTSCapability }) {
export function registerTtsRoutes(app, { sayTTSCapability }) {
let ttsModulePromise = null;
const getTtsModule = async () => {
if (!ttsModulePromise) {
@@ -44,7 +44,7 @@ export function registerTtsRoutes(app, { resolveZenModel, sayTTSCapability }) {
// Server-side TTS endpoint - streams audio from OpenAI TTS API
app.post('/api/tts/speak', async (req, res) => {
try {
const { text, voice = 'nova', model = 'gpt-4o-mini-tts', speed = 0.9, instructions, summarize = false, providerId, modelId, threshold = 200, maxLength = 500, apiKey, baseURL } = req.body || {};
const { text, voice = 'nova', model = 'gpt-4o-mini-tts', speed = 0.9, instructions, providerId, modelId, apiKey, baseURL } = req.body || {};
const normalizedBaseURLResult = normalizeCustomOpenAIBaseURL(baseURL);
if (normalizedBaseURLResult.error) {
@@ -74,20 +74,8 @@ export function registerTtsRoutes(app, { resolveZenModel, sayTTSCapability }) {
let textToSpeak = text.trim();
// Optionally summarize long text before speaking using zen API
if (summarize && textToSpeak.length > threshold) {
try {
const speakZenModel = await resolveZenModel(typeof req.body?.zenModel === 'string' ? req.body.zenModel : undefined);
const result = await summarizeText({ text: textToSpeak, threshold, maxLength, zenModel: speakZenModel, mode: 'tts' });
if (result.summarized && result.summary) {
textToSpeak = result.summary;
}
} catch (summarizeError) {
console.error('[TTS/speak] Summarization failed:', summarizeError);
// Continue with original text if summarization fails
}
}
// Historical summarize request fields are intentionally ignored. The
// model-backed summarization provider is retired.
const result = await ttsService.generateSpeechStream({
text: textToSpeak,
@@ -123,36 +111,13 @@ export function registerTtsRoutes(app, { resolveZenModel, sayTTSCapability }) {
return res.status(400).json({ error: 'Text is required' });
}
const sumZenModel = await resolveZenModel(typeof req.body?.zenModel === 'string' ? req.body.zenModel : undefined);
let result = await summarizeText({
const result = await summarizeText({
text,
threshold,
maxLength,
zenModel: sumZenModel,
mode: typeof mode === 'string' ? mode : 'tts',
});
if (mode === 'note' && !result.summarized) {
const notificationResult = await summarizeText({
text,
threshold,
maxLength,
zenModel: sumZenModel,
mode: 'notification',
});
if (notificationResult.summarized && notificationResult.summary) {
result = {
...notificationResult,
summary: sanitizeForNote(sanitizeForNotification(notificationResult.summary)),
};
} else {
return res.status(502).json({
error: 'Note summarization failed',
reason: notificationResult.reason || result.reason || 'No distilled result from model',
});
}
}
return res.json(result);
} catch (error) {
console.error('[Summarize] Error:', error);