- Remove Anki apkg import/export functionality - Remove OCR feature module - Remove note and note-type modules - Simplify card/deck modules (remove spaced repetition complexity) - Update translator and dictionary features - Clean up unused translations and update i18n files - Simplify prisma schema
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
"use server";
|
|
|
|
import { executeDictionaryLookup } from "@/lib/bigmodel/dictionary/orchestrator";
|
|
import { createLogger } from "@/lib/logger";
|
|
import { LookUpError } from "@/lib/errors";
|
|
import {
|
|
ActionInputLookUpDictionary,
|
|
ActionOutputLookUpDictionary,
|
|
validateActionInputLookUpDictionary,
|
|
} from "./dictionary-action-dto";
|
|
|
|
const log = createLogger("dictionary-action");
|
|
|
|
export async function actionLookUpDictionary(
|
|
input: unknown,
|
|
): Promise<ActionOutputLookUpDictionary> {
|
|
try {
|
|
const validated = validateActionInputLookUpDictionary(input);
|
|
|
|
const result = await executeDictionaryLookup(
|
|
validated.text,
|
|
validated.queryLang,
|
|
validated.definitionLang
|
|
);
|
|
|
|
return {
|
|
success: true,
|
|
message: "Lookup successful",
|
|
data: result,
|
|
};
|
|
} catch (e) {
|
|
if (e instanceof LookUpError) {
|
|
return { success: false, message: e.message };
|
|
}
|
|
log.error("Dictionary lookup failed", { error: e instanceof Error ? e.message : String(e) });
|
|
return { success: false, message: "Lookup failed" };
|
|
}
|
|
}
|