This commit is contained in:
2025-11-06 01:25:41 +08:00
parent b63813f84d
commit 1a53c53e38
10 changed files with 67 additions and 17 deletions

View File

@@ -1,5 +1,8 @@
"""Kernel 操作辅助函数库"""
import random
import heurams.kernel.particles as pt
import heurams.kernel.puzzles as pz
import heurams.interface.widgets as pzw
staging = {} # 细粒度缓存区, 是 ident -> quality 的封装
def report_to_staging(atom: pt.Atom, quality):
staging[atom.ident] = min(quality, staging[atom.ident])
@@ -11,4 +14,10 @@ def deploy_to_electron():
pt.atom_registry[atom_ident].register['electron'].revisor(quality=quality)
else:
pt.atom_registry[atom_ident].register['electron'].revisor(quality=quality, is_new_activation=True)
clear()
clear()
puzzle2widget = {
pz.RecognitionPuzzle: pzw.Recognition,
pz.ClozePuzzle: pzw.ClozePuzzle,
pz.MCQPuzzle: pzw.MCQPuzzle,
pz.BasePuzzle: pzw.BasePuzzleWidget,
}