@realtimex/folio 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,8 @@ type VisionCapabilityMap = Record<string, StoredVisionCapability>;
23
23
  interface SettingsLike {
24
24
  llm_provider?: string | null;
25
25
  llm_model?: string | null;
26
+ ingestion_llm_provider?: string | null;
27
+ ingestion_llm_model?: string | null;
26
28
  vision_model_capabilities?: unknown;
27
29
  }
28
30
 
@@ -59,8 +61,16 @@ export class ModelCapabilityService {
59
61
  settingsRow: SettingsLike | null | undefined,
60
62
  modality: VisionCapabilityModality = "image"
61
63
  ): VisionResolution {
62
- const provider = (settingsRow?.llm_provider || SDKService.DEFAULT_LLM_PROVIDER).trim();
63
- const model = (settingsRow?.llm_model || SDKService.DEFAULT_LLM_MODEL).trim();
64
+ const provider = (
65
+ settingsRow?.ingestion_llm_provider ||
66
+ settingsRow?.llm_provider ||
67
+ SDKService.DEFAULT_LLM_PROVIDER
68
+ ).trim();
69
+ const model = (
70
+ settingsRow?.ingestion_llm_model ||
71
+ settingsRow?.llm_model ||
72
+ SDKService.DEFAULT_LLM_MODEL
73
+ ).trim();
64
74
  const state = this.getVisionState(settingsRow?.vision_model_capabilities, provider, model, modality);
65
75
  return {
66
76
  provider,
@@ -242,6 +252,19 @@ export class ModelCapabilityService {
242
252
 
243
253
  const now = new Date();
244
254
  const key = this.capabilityKey(provider, model, modality);
255
+ const existingEntry = map[key];
256
+ if (this.isManualOverrideActive(existingEntry) && reason !== "manual_override") {
257
+ logger.info(
258
+ `Skipping auto capability update for ${provider}/${model} (${modality}) because manual override is active`,
259
+ {
260
+ requestedState: state,
261
+ requestedReason: reason,
262
+ currentState: existingEntry?.state,
263
+ currentReason: existingEntry?.reason,
264
+ }
265
+ );
266
+ return;
267
+ }
245
268
 
246
269
  const nextEntry: StoredVisionCapability = {
247
270
  state,
@@ -347,6 +370,12 @@ export class ModelCapabilityService {
347
370
  return Number.isFinite(expiryTs) && expiryTs <= Date.now();
348
371
  }
349
372
 
373
+ private static isManualOverrideActive(entry: StoredVisionCapability | undefined): boolean {
374
+ if (!entry) return false;
375
+ if (entry.reason !== "manual_override") return false;
376
+ return !this.isExpired(entry);
377
+ }
378
+
350
379
  private static nextFailureCount(entry: StoredVisionCapability | undefined, nowTs: number): number {
351
380
  if (!entry || entry.state !== "pending_unsupported" || this.isExpired(entry)) {
352
381
  return 1;
@@ -687,7 +716,7 @@ export class ModelCapabilityService {
687
716
  this.providerCapabilityHints(provider, modality)
688
717
  );
689
718
  if (providerSpecificMatches.length > 0) {
690
- score += 2;
719
+ score += 3;
691
720
  evidence.push(...providerSpecificMatches.map((match) => `provider:${match}`));
692
721
  }
693
722
 
@@ -761,7 +790,6 @@ export class ModelCapabilityService {
761
790
  if (normalized.includes("realtimex")) {
762
791
  return [
763
792
  "unsupported file input",
764
- "invalid model",
765
793
  ];
766
794
  }
767
795
  return [];
@@ -790,7 +818,6 @@ export class ModelCapabilityService {
790
818
 
791
819
  if (normalized.includes("realtimex")) {
792
820
  return [
793
- "invalid model",
794
821
  "text-only model",
795
822
  ];
796
823
  }
@@ -94,6 +94,8 @@ export interface UserSettings {
94
94
  user_id: string;
95
95
  llm_provider: string | null;
96
96
  llm_model: string | null;
97
+ ingestion_llm_provider: string | null;
98
+ ingestion_llm_model: string | null;
97
99
  vision_model_capabilities: Record<string, unknown> | null;
98
100
  sync_interval_minutes: number;
99
101
  created_at: string;
@@ -158,13 +158,10 @@ router.post("/:id/summarize", asyncHandler(async (req, res) => {
158
158
  }
159
159
  const { data: settingsRow } = await req.supabase
160
160
  .from("user_settings")
161
- .select("llm_provider, llm_model")
161
+ .select("llm_provider, llm_model, ingestion_llm_provider, ingestion_llm_model")
162
162
  .eq("user_id", req.user.id)
163
163
  .maybeSingle();
164
- const llmSettings = {
165
- llm_provider: settingsRow?.llm_provider ?? undefined,
166
- llm_model: settingsRow?.llm_model ?? undefined,
167
- };
164
+ const llmSettings = IngestionService.resolveIngestionLlmSettings(settingsRow);
168
165
  const summary = await IngestionService.summarize(req.params["id"], req.supabase, req.user.id, llmSettings);
169
166
  res.json({ success: true, summary });
170
167
  }));
@@ -29,6 +29,8 @@ router.patch("/", asyncHandler(async (req, res) => {
29
29
  const payload = {
30
30
  llm_provider: body.llm_provider,
31
31
  llm_model: body.llm_model,
32
+ ingestion_llm_provider: body.ingestion_llm_provider,
33
+ ingestion_llm_model: body.ingestion_llm_model,
32
34
  sync_interval_minutes: body.sync_interval_minutes,
33
35
  tts_auto_play: body.tts_auto_play,
34
36
  tts_provider: body.tts_provider,