feat: real-time reasoning speech, dynamic voice tags, and unified web UI bubbles
This commit is contained in:
+9
-2
@@ -169,9 +169,9 @@ class MacOSLLM(FrameProcessor):
|
||||
async def _connect(self):
|
||||
available, reason = probe_apple_llm()
|
||||
logger.info(f"macOS LLM engine: {reason}")
|
||||
if LLM_HELPER_PATH.exists() and "FoundationModels available" in reason:
|
||||
if LLM_HELPER_PATH.exists() and available and ("FoundationModels" in reason or "Apple Intelligence" in reason):
|
||||
self._use_swift = True
|
||||
logger.info("Using Swift FoundationModels engine.")
|
||||
logger.info("Using native Swift macOS Apple Intelligence / FoundationModels engine.")
|
||||
else:
|
||||
self._use_swift = False
|
||||
logger.info(f"Loading MLX model {self._model_name} on Apple Silicon...")
|
||||
@@ -199,6 +199,9 @@ class MacOSLLM(FrameProcessor):
|
||||
await self.cancel_task(task)
|
||||
|
||||
async def _run_turn(self, utterance: str):
|
||||
if not self._use_swift and (self._mlx_model is None or self._mlx_tokenizer is None):
|
||||
await self._connect()
|
||||
|
||||
self._history.append({"role": "user", "content": utterance})
|
||||
|
||||
await self.push_frame(LLMFullResponseStartFrame())
|
||||
@@ -224,6 +227,10 @@ class MacOSLLM(FrameProcessor):
|
||||
chunk = data["delta"]
|
||||
chunks.append(chunk)
|
||||
await self.push_frame(LLMTextFrame(chunk))
|
||||
elif "content" in data and not chunks:
|
||||
chunk = data["content"]
|
||||
chunks.append(chunk)
|
||||
await self.push_frame(LLMTextFrame(chunk))
|
||||
elif "text" in data and not chunks:
|
||||
chunk = data["text"]
|
||||
chunks.append(chunk)
|
||||
|
||||
Reference in New Issue
Block a user