Path for audio-logs' folder is now obtained from obsidian_settings
This commit is contained in:
parent
a6053b3be6
commit
e07de60438
|
|
@ -382,7 +382,7 @@ obsidian_settings_fetched = False
|
|||
def get_voice_status():
|
||||
# 2. Вызываем метод у экземпляра voice_inst, а не у модуля
|
||||
return jsonify({
|
||||
"transcription": voice_inst.get_context_by_limit(3000, order='reversed'),
|
||||
"transcription": voice_inst.get_context_by_limit(current_obsidian_settings.get('voiceDisplayLimit', 0), order='reversed'),
|
||||
"response1": list(voice_inst.responses["regular"]),
|
||||
"response2": list(voice_inst.responses["commands"]),
|
||||
"is_running": voice_inst.is_running,
|
||||
|
|
@ -405,6 +405,13 @@ def sync_settings():
|
|||
if data:
|
||||
current_obsidian_settings.update(data)
|
||||
|
||||
# Передаем настройки в voice_service
|
||||
if data.get('absoluteLogsPath'):
|
||||
# Если фронт прислал вычисленный абсолютный путь
|
||||
voice_inst.update_logs_config(
|
||||
abs_path=data.get('absoluteLogsPath')
|
||||
)
|
||||
|
||||
# TODO: Скорее всего, здесь нужно какое-то событие эмитировать об изменении настроек, и в другом месте ловить
|
||||
graph_history_manager.title_generator.llm = get_llm(current_obsidian_settings['summarizationModel'])
|
||||
graph_history_manager.title_generator.voice_llm = get_llm(current_obsidian_settings['voiceCommandModel'])
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ class VoiceService:
|
|||
}
|
||||
self.lock = threading.Lock()
|
||||
self._stop_event = threading.Event()
|
||||
self.abs_logs_path = None
|
||||
|
||||
def update_logs_config(self, abs_path):
|
||||
"""Обновление путей из настроек Obsidian."""
|
||||
self.abs_logs_path = abs_path
|
||||
|
||||
def _load_history_from_file(self):
|
||||
"""Парсит существующий файл лога в коллекцию self.history."""
|
||||
|
|
@ -59,11 +64,11 @@ class VoiceService:
|
|||
def start_session(self, continue_last=False):
|
||||
if self.is_running: return
|
||||
|
||||
log_dir = "audio-logs"
|
||||
log_dir = self.abs_logs_path if self.abs_logs_path else "audio-logs"
|
||||
if not os.path.exists(log_dir): os.makedirs(log_dir)
|
||||
|
||||
if continue_last:
|
||||
files = sorted([f for f in os.listdir(log_dir) if f.endswith(".txt")])
|
||||
files = sorted([f for f in os.listdir(log_dir) if f.endswith(".md")])
|
||||
if files:
|
||||
self.current_file = os.path.join(log_dir, files[-1])
|
||||
# Загружаем старые реплики в память
|
||||
|
|
@ -80,7 +85,7 @@ class VoiceService:
|
|||
threading.Thread(target=self._run_transcription, daemon=True).start()
|
||||
|
||||
def _create_new_file(self, log_dir):
|
||||
name = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S.txt")
|
||||
name = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S.md")
|
||||
path = os.path.join(log_dir, name)
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
f.write(f"--- Session Start: {name} ---\n\n")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user