[Update] Save and register -able.
This commit is contained in:
@@ -533,6 +533,19 @@ class Config:
|
||||
self._MIC_WORD_FILTER = sorted(set(value), key=value.index)
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('HOTKEYS')
|
||||
def HOTKEYS(self):
|
||||
return self._HOTKEYS
|
||||
|
||||
@HOTKEYS.setter
|
||||
def HOTKEYS(self, value):
|
||||
if isinstance(value, dict) and set(value.keys()) == set(self.HOTKEYS.keys()):
|
||||
for key, value in value.items():
|
||||
if isinstance(value, list) or value is None:
|
||||
self._HOTKEYS[key] = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, self.HOTKEYS, immediate_save=True)
|
||||
|
||||
@property
|
||||
@json_serializable('MIC_AVG_LOGPROB')
|
||||
def MIC_AVG_LOGPROB(self):
|
||||
@@ -1026,6 +1039,9 @@ class Config:
|
||||
self._MIC_PHRASE_TIMEOUT = 3
|
||||
self._MIC_MAX_PHRASES = 10
|
||||
self._MIC_WORD_FILTER = []
|
||||
self._HOTKEYS = {
|
||||
"toggle_active_vrct": None,
|
||||
}
|
||||
self._MIC_AVG_LOGPROB = -0.8
|
||||
self._MIC_NO_SPEECH_PROB = 0.6
|
||||
self._AUTO_SPEAKER_SELECT = True
|
||||
|
||||
@@ -996,6 +996,15 @@ class Controller:
|
||||
response = {"status":200, "result":config.SPEAKER_MAX_PHRASES}
|
||||
return response
|
||||
|
||||
@staticmethod
|
||||
def getHotkeys(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.HOTKEYS}
|
||||
|
||||
@staticmethod
|
||||
def setHotkeys(data, *args, **kwargs) -> dict:
|
||||
config.HOTKEYS = data
|
||||
return {"status":200, "result":config.HOTKEYS}
|
||||
|
||||
@staticmethod
|
||||
def getSpeakerAvgLogprob(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.SPEAKER_AVG_LOGPROB}
|
||||
|
||||
@@ -183,6 +183,9 @@ mapping = {
|
||||
"/get/data/mic_max_phrases": {"status": True, "variable":controller.getMicMaxPhrases},
|
||||
"/set/data/mic_max_phrases": {"status": True, "variable":controller.setMicMaxPhrases},
|
||||
|
||||
"/get/data/hotkeys": {"status": True, "variable":controller.getHotkeys},
|
||||
"/set/data/hotkeys": {"status": True, "variable":controller.setHotkeys},
|
||||
|
||||
"/get/data/mic_avg_logprob": {"status": True, "variable":controller.getMicAvgLogprob},
|
||||
"/set/data/mic_avg_logprob": {"status": True, "variable":controller.setMicAvgLogprob},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user