fix: streaming tool call parsing, error handling, and fake HA state mutation
- Fix Gemini streaming tool call merge bug: multiple tool calls with same index but different IDs are now parsed as separate calls instead of concatenating names (e.g. ha_call_serviceha_call_service) - Handle partial results in voice mode: show error and stop continuous mode when agent returns partial/failed results with empty response - Fix error display during streaming TTS: error messages are shown in full response box even when streaming box was already opened - Add duplicate sentence filter in TTS: skip near-duplicate sentences from LLM repetition - Fix fake HA server state mutation: turn_on/turn_off/set_temperature correctly update entity states; temperature sensor simulates change when thermostat is adjusted
This commit is contained in:
@@ -275,12 +275,25 @@ class FakeHAServer:
|
||||
affected = []
|
||||
entity_id = body.get("entity_id")
|
||||
if entity_id:
|
||||
new_state = "on" if service == "turn_on" else "off"
|
||||
for s in ENTITY_STATES:
|
||||
if s["entity_id"] == entity_id:
|
||||
if service == "turn_on":
|
||||
s["state"] = "on"
|
||||
elif service == "turn_off":
|
||||
s["state"] = "off"
|
||||
elif service == "set_temperature" and "temperature" in body:
|
||||
s["attributes"]["temperature"] = body["temperature"]
|
||||
# Keep current state or set to heat if off
|
||||
if s["state"] == "off":
|
||||
s["state"] = "heat"
|
||||
# Simulate temperature sensor approaching the target
|
||||
for ts in ENTITY_STATES:
|
||||
if ts["entity_id"] == "sensor.temperature":
|
||||
ts["state"] = str(body["temperature"] - 0.5)
|
||||
break
|
||||
affected.append({
|
||||
"entity_id": entity_id,
|
||||
"state": new_state,
|
||||
"state": s["state"],
|
||||
"attributes": s.get("attributes", {}),
|
||||
})
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user