Formatting and linting

This commit is contained in:
2026-04-23 15:21:40 -05:00
parent 7191c68390
commit 47c9648f4a
6 changed files with 3101 additions and 76 deletions

View File

@@ -4,7 +4,6 @@ import { createAnthropic } from '@ai-sdk/anthropic';
import { createOpenAI } from '@ai-sdk/openai';
import { createGoogleGenerativeAI } from '@ai-sdk/google';
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { GoogleGenAI } from '@google/genai';
import { Job } from '../db/models.js';
import { broadcast } from '../ws/broadcast.js';
import { findModel, DEFAULT_MODEL_ID, normalizeModelId } from '../models.js';
@@ -24,10 +23,6 @@ const google = createGoogleGenerativeAI({
apiKey: process.env.GOOGLE_API_KEY,
});
const geminiApi = new GoogleGenAI({
apiKey: process.env.GOOGLE_API_KEY,
});
// Ollama Cloud exposes an OpenAI-compatible /v1 endpoint.
// Using @ai-sdk/openai-compatible avoids the local-Ollama schema validation
// in ollama-ai-provider which requires fields (eval_duration etc.) that
@@ -59,23 +54,6 @@ function resolveModelMeta(modelId) {
return { normalized, meta };
}
function dataUrlToInlineData(dataUrl) {
if (!dataUrl || typeof dataUrl !== 'string') return null;
// Expected: data:<mime>;base64,<data>
if (!dataUrl.startsWith('data:')) return null;
const comma = dataUrl.indexOf(',');
if (comma < 0) return null;
const header = dataUrl.slice(5, comma); // drop "data:"
const data = dataUrl.slice(comma + 1);
const isBase64 = header.includes(';base64');
const mimeType = header.split(';')[0] || 'application/octet-stream';
if (!isBase64 || !data) return null;
return { mimeType, data };
}
// ---------------------------------------------------------------------------
// p-queue: in-process queue, no external server needed
// ---------------------------------------------------------------------------
@@ -110,7 +88,7 @@ async function runJob(jobId) {
await setStatus(job, 'running');
try {
const { meta } = resolveModelMeta(job.model);
resolveModelMeta(job.model);
const { text, usage } = await generateText({
model: resolveModel(job.model),