[Update] (Affect to backend) Plugin System. Saveable if the plugin is enabled or not.
Add functions that merge plugins data.
This commit is contained in:
@@ -555,6 +555,18 @@ class Config:
|
||||
self._HOTKEYS[key] = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, self.HOTKEYS, immediate_save=True)
|
||||
|
||||
@property
|
||||
@json_serializable('PLUGINS_STATUS')
|
||||
def PLUGINS_STATUS(self):
|
||||
return self._PLUGINS_STATUS
|
||||
|
||||
@PLUGINS_STATUS.setter
|
||||
def PLUGINS_STATUS(self, value):
|
||||
if isinstance(value, list):
|
||||
if all(isinstance(item, dict) for item in value):
|
||||
self._PLUGINS_STATUS = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, self.PLUGINS_STATUS, immediate_save=True)
|
||||
|
||||
@property
|
||||
@json_serializable('MIC_AVG_LOGPROB')
|
||||
def MIC_AVG_LOGPROB(self):
|
||||
@@ -1068,6 +1080,7 @@ class Config:
|
||||
"toggle_transcription_send": None,
|
||||
"toggle_transcription_receive": None,
|
||||
}
|
||||
self._PLUGINS_STATUS = []
|
||||
self._MIC_AVG_LOGPROB = -0.8
|
||||
self._MIC_NO_SPEECH_PROB = 0.6
|
||||
self._AUTO_SPEAKER_SELECT = True
|
||||
|
||||
@@ -1061,6 +1061,15 @@ class Controller:
|
||||
config.HOTKEYS = data
|
||||
return {"status":200, "result":config.HOTKEYS}
|
||||
|
||||
@staticmethod
|
||||
def getPluginsStatus(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.PLUGINS_STATUS}
|
||||
|
||||
@staticmethod
|
||||
def setPluginsStatus(data, *args, **kwargs) -> dict:
|
||||
config.PLUGINS_STATUS = data
|
||||
return {"status":200, "result":config.PLUGINS_STATUS}
|
||||
|
||||
@staticmethod
|
||||
def getSpeakerAvgLogprob(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.SPEAKER_AVG_LOGPROB}
|
||||
|
||||
@@ -190,6 +190,9 @@ mapping = {
|
||||
"/get/data/hotkeys": {"status": True, "variable":controller.getHotkeys},
|
||||
"/set/data/hotkeys": {"status": True, "variable":controller.setHotkeys},
|
||||
|
||||
"/get/data/plugins_status": {"status": True, "variable":controller.getPluginsStatus},
|
||||
"/set/data/plugins_status": {"status": True, "variable":controller.setPluginsStatus},
|
||||
|
||||
"/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