4 Commits
v0.3.7 ... main

Author SHA1 Message Date
ebeb62f72d 性能改进 2025-10-07 23:30:16 +08:00
d71d8eb1ec 更新 2025-10-07 23:23:17 +08:00
4ac12479cc 修改 2025-10-07 03:00:42 +08:00
7fc53e4113 算法与交互改进, 以及同步原型 2025-10-07 02:49:26 +08:00
5 changed files with 14 additions and 8 deletions

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
ver = "0.3.7" ver = "0.3.8"
stage = "production" stage = "production"

View File

@@ -41,7 +41,7 @@ class Glimpse():
class Apparatus(): class Apparatus():
"""反应器对象, 决策一个原子的不同记忆方式, 并反馈到布局""" """反应器对象, 决策一个原子的不同记忆方式, 并反馈到布局"""
def __init__(self, screen, reactor, atom): def __init__(self, screen, reactor, atom, is_review = 0):
self.electron: pt.Electron = atom[0] self.electron: pt.Electron = atom[0]
self.nucleon: pt.Nucleon = atom[1] self.nucleon: pt.Nucleon = atom[1]
self.positron: dict = atom[2] self.positron: dict = atom[2]
@@ -56,11 +56,14 @@ class Apparatus():
continue continue
if i == "fill_blank_test": # 加深 if i == "fill_blank_test": # 加深
self.procession.append(comps.registry[i](screen, reactor, atom)) self.procession.append(comps.registry[i](screen, reactor, atom))
self.procession.append(comps.registry[i](screen, reactor, atom)) # self.procession.append(comps.registry[i](screen, reactor, atom))
self.procession.append(comps.registry[i](screen, reactor, atom)) self.procession.append(comps.registry[i](screen, reactor, atom))
# self.procession.reverse() # self.procession.reverse()
random.shuffle(self.procession) random.shuffle(self.procession)
if self.positron["is_new_activation"] == 0:
self.procession.append(comps.registry['recognition'](screen, reactor, atom))
if is_review == 1:
self.procession = [self.procession[-2], self.procession[-1]]
def iterator(self): def iterator(self):
yield from self.procession yield from self.procession
@@ -69,6 +72,7 @@ class Reactor():
"""反应堆对象, 处理和分配一次文件记忆流程的资源与策略""" """反应堆对象, 处理和分配一次文件记忆流程的资源与策略"""
def __init__(self, nucleon_file: pt.NucleonUnion, electron_file: pt.ElectronUnion, screen, tasked_num): def __init__(self, nucleon_file: pt.NucleonUnion, electron_file: pt.ElectronUnion, screen, tasked_num):
# 导入原子对象 # 导入原子对象
self.stage = 0
self.nucleon_file = nucleon_file self.nucleon_file = nucleon_file
self.electron_file = electron_file self.electron_file = electron_file
self.tasked_num = tasked_num self.tasked_num = tasked_num
@@ -132,6 +136,7 @@ class Reactor():
2: self.atoms_new, 2: self.atoms_new,
3: (self.atoms_new + self.atoms_review) 3: (self.atoms_new + self.atoms_review)
} }
self.stage = stage
ret = 1 ret = 1
if stage == 1 and len(processions[1]) == 0: if stage == 1 and len(processions[1]) == 0:
stage = 2 stage = 2
@@ -163,7 +168,7 @@ class Reactor():
return -1 # 此轮已完成 return -1 # 此轮已完成
self.index += step self.index += step
self.current_atom = self.procession[self.index] self.current_atom = self.procession[self.index]
self.current_appar = Apparatus(self.screen, self, self.current_atom).iterator() self.current_appar = Apparatus(self.screen, self, self.current_atom, (self.stage == 1)).iterator()
return 0 return 0
def save(self): def save(self):

View File

@@ -19,7 +19,6 @@ from textual.screen import Screen
from textual.worker import Worker, get_current_worker from textual.worker import Worker, get_current_worker
import pathlib import pathlib
import threading import threading
import edge_tts as tts
from playsound import playsound from playsound import playsound
import particles as pt import particles as pt
from reactor import Reactor, Apparatus, Glimpse from reactor import Reactor, Apparatus, Glimpse
@@ -95,6 +94,7 @@ class PrecachingScreen(Screen):
cache = cache_dir / f"{aux.get_md5(text)}.wav" cache = cache_dir / f"{aux.get_md5(text)}.wav"
if not cache.exists(): if not cache.exists():
try: try:
import edge_tts as tts
communicate = tts.Communicate(text, "zh-CN-XiaoxiaoNeural") communicate = tts.Communicate(text, "zh-CN-XiaoxiaoNeural")
communicate.save_sync(str(cache)) communicate.save_sync(str(cache))
return True return True
@@ -216,7 +216,6 @@ class PrecachingScreen(Screen):
self.precache_worker.cancel() self.precache_worker.cancel()
self.app.exit() self.app.exit()
class MemScreen(Screen): class MemScreen(Screen):
BINDINGS = [ BINDINGS = [
("d", "toggle_dark", "改变色调"), ("d", "toggle_dark", "改变色调"),
@@ -331,6 +330,7 @@ class MemScreen(Screen):
cache_dir.mkdir(parents=True, exist_ok=True) cache_dir.mkdir(parents=True, exist_ok=True)
cache = cache_dir / f"{aux.get_md5(self.reactor.current_atom[1].content.replace('/',''))}.wav" cache = cache_dir / f"{aux.get_md5(self.reactor.current_atom[1].content.replace('/',''))}.wav"
if not cache.exists(): if not cache.exists():
import edge_tts as tts
communicate = tts.Communicate( communicate = tts.Communicate(
self.reactor.current_atom[1].content.replace("/", ""), self.reactor.current_atom[1].content.replace("/", ""),
"zh-CN-XiaoxiaoNeural", "zh-CN-XiaoxiaoNeural",
@@ -475,7 +475,7 @@ class DashboardScreen(Screen):
Label("选择待学习或待修改的记忆单元集:", classes="title-label"), Label("选择待学习或待修改的记忆单元集:", classes="title-label"),
ListView(id="file-list", classes="file-list-view"), ListView(id="file-list", classes="file-list-view"),
#Button("新建空的单元集", id="new_nucleon_button"), #Button("新建空的单元集", id="new_nucleon_button"),
Button("预缓存所有音频", id="precache_all_button", variant="success"), Button("音频预缓存实用程序", id="precache_all_button"),
Label(f"\"潜进\" 开放源代码软件项目 | 版本 {metadata.ver} {metadata.stage.capitalize()} | Wang Zhiyu 2025"), Label(f"\"潜进\" 开放源代码软件项目 | 版本 {metadata.ver} {metadata.stage.capitalize()} | Wang Zhiyu 2025"),
) )
yield Footer() yield Footer()

1
sync_t.py Normal file
View File

@@ -0,0 +1 @@
# 同步工具 原型