Remove unused jsonrepair module

This commit is contained in:
Tony Frazier 2026-02-02 21:34:56 -05:00
parent 4c5d590cf6
commit 9d86054d45
4 changed files with 0 additions and 38 deletions

10
package-lock.json generated
View file

@ -29,7 +29,6 @@
"gpt-tokenizer": "^3.4.0",
"harper.js": "^1.2.0",
"html5-qrcode": "^2.3.8",
"jsonrepair": "^3.13.2",
"jszip": "^3.10.1",
"lucide-svelte": "^0.468.0",
"marked": "^17.0.1",
@ -2293,15 +2292,6 @@
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
"license": "(AFL-2.1 OR BSD-3-Clause)"
},
"node_modules/jsonrepair": {
"version": "3.13.2",
"resolved": "https://registry.npmjs.org/jsonrepair/-/jsonrepair-3.13.2.tgz",
"integrity": "sha512-Leuly0nbM4R+S5SVJk3VHfw1oxnlEK9KygdZvfUtEtTawNDyzB4qa1xWTmFt1aeoA7sXZkVTRuIixJ8bAvqVUg==",
"license": "ISC",
"bin": {
"jsonrepair": "bin/cli.js"
}
},
"node_modules/jszip": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",

View file

@ -33,7 +33,6 @@
"gpt-tokenizer": "^3.4.0",
"harper.js": "^1.2.0",
"html5-qrcode": "^2.3.8",
"jsonrepair": "^3.13.2",
"jszip": "^3.10.1",
"lucide-svelte": "^0.468.0",
"marked": "^17.0.1",

View file

@ -2,13 +2,10 @@
* AI Utilities Module
*
* Utility services and helpers for AI operations:
* - JSON healing: Parse and repair malformed JSON from LLM responses
* - Translation: Multi-language translation service
* - TTS: Text-to-speech service
*/
export { tryParseJsonWithHealing, parseJsonWithHealing } from './jsonHealing';
export { TranslationService, type TranslationResult, type UITranslationItem } from './TranslationService';
export {

View file

@ -1,24 +0,0 @@
import { jsonrepair } from 'jsonrepair';
/**
* Parses JSON with automatic repair for common LLM output issues.
* Handles: missing quotes, trailing commas, markdown code blocks,
* truncation, single quotes, Python constants, and more.
*
* @throws {SyntaxError} If JSON cannot be repaired
*/
export function parseJsonWithHealing<T>(content: string): T {
const repaired = jsonrepair(content.trim());
return JSON.parse(repaired) as T;
}
/**
* Safe version that returns null on failure instead of throwing.
*/
export function tryParseJsonWithHealing<T>(content: string): T | null {
try {
return parseJsonWithHealing<T>(content);
} catch {
return null;
}
}