fix(rectification): resolve typed focus answers deterministically
This commit is contained in:
@@ -293,25 +293,21 @@ export function applyHoldoutAnswer(
|
||||
};
|
||||
}
|
||||
|
||||
export function classifyChoiceAnswer(key: string, schema?: unknown): AnswerClass {
|
||||
if (key === "A") return "yes";
|
||||
if (key === "B") return "weak_yes";
|
||||
if (key === "C") {
|
||||
if (schemaMapsCToUnsure(schema)) return "unsure";
|
||||
return "no";
|
||||
}
|
||||
return "unsure";
|
||||
}
|
||||
|
||||
function schemaMapsCToUnsure(schema: unknown): boolean {
|
||||
if (!schema || typeof schema !== "object") return false;
|
||||
export function classifyChoiceAnswer(key: string, schema?: unknown): AnswerClass | null {
|
||||
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return null;
|
||||
const row = schema as Record<string, unknown>;
|
||||
if (row.choice_kind !== "varga_style") return false;
|
||||
const choice = row.choice && typeof row.choice === "object" && !Array.isArray(row.choice)
|
||||
? row.choice as Record<string, unknown>
|
||||
: row;
|
||||
const optionC = typeof choice.option_c === "string" ? choice.option_c : "";
|
||||
return optionC.includes("都不像");
|
||||
if (!Array.isArray(choice.options)) return null;
|
||||
const option = choice.options.find((item) => (
|
||||
item && typeof item === "object" && !Array.isArray(item) && (item as { key?: unknown }).key === key
|
||||
));
|
||||
if (!option || typeof option !== "object") return null;
|
||||
const answerClass = (option as { answer_class?: unknown }).answer_class;
|
||||
return answerClass === "yes" || answerClass === "weak_yes" || answerClass === "no" || answerClass === "unsure"
|
||||
? answerClass
|
||||
: null;
|
||||
}
|
||||
|
||||
function rebuildWithAnswers(state: InferenceState, incoming: readonly ProbeAnswer[]): InferenceState {
|
||||
|
||||
Reference in New Issue
Block a user