fix: language selector mutual exclusion with preset buttons
- When "Other" is selected, preset language buttons are deselected - Only one option can be selected at a time - Refactor dictionary page with zustand store - Add custom language input option to dictionary - Fix multiple issues in dictionary bigmodel pipeline
This commit is contained in:
@@ -19,12 +19,12 @@ export async function executeDictionaryLookup(
|
||||
|
||||
if (!analysis.isValid) {
|
||||
log.debug("[Stage 1] Invalid input", { reason: analysis.reason });
|
||||
throw analysis.reason || "无效输入";
|
||||
throw new LookUpError(analysis.reason || "无效输入");
|
||||
}
|
||||
|
||||
if (analysis.isEmpty) {
|
||||
log.debug("[Stage 1] Empty input");
|
||||
throw "输入为空";
|
||||
throw new LookUpError("输入为空");
|
||||
}
|
||||
|
||||
log.debug("[Stage 1] Analysis complete", { analysis });
|
||||
@@ -33,7 +33,7 @@ export async function executeDictionaryLookup(
|
||||
const semanticMapping = await determineSemanticMapping(
|
||||
text,
|
||||
queryLang,
|
||||
analysis.inputLanguage || text
|
||||
analysis.inputLanguage ?? text
|
||||
);
|
||||
|
||||
log.debug("[Stage 2] Semantic mapping complete", { semanticMapping });
|
||||
|
||||
@@ -74,7 +74,7 @@ b) 输入是明确、基础、可词典化的语义概念
|
||||
role: "user",
|
||||
content: prompt,
|
||||
},
|
||||
]).then(parseAIGeneratedJSON<any>);
|
||||
]).then(parseAIGeneratedJSON<SemanticMappingResult>);
|
||||
|
||||
// 代码层面的数据验证
|
||||
if (typeof result.shouldMap !== "boolean") {
|
||||
|
||||
@@ -66,7 +66,7 @@ ${originalInput ? `
|
||||
role: "user",
|
||||
content: prompt,
|
||||
},
|
||||
]).then(parseAIGeneratedJSON<any>);
|
||||
]).then(parseAIGeneratedJSON<StandardFormResult>);
|
||||
|
||||
// 代码层面的数据验证
|
||||
if (!result.standardForm || result.standardForm.trim().length === 0) {
|
||||
|
||||
@@ -98,10 +98,6 @@ ${isWord ? `
|
||||
if (isWord && !entry.partOfSpeech) {
|
||||
throw new Error("阶段4:单词条目缺少 partOfSpeech");
|
||||
}
|
||||
|
||||
if (isWord && !entry.ipa) {
|
||||
throw new Error("阶段4:单词条目缺少 ipa");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user