Simplify tool approval chat flow
This commit is contained in:
@@ -110,9 +110,12 @@ def test_stream_chat_endpoint_executes_tool_before_streaming_answer(tmp_path, mo
|
||||
|
||||
def test_continue_stream_executes_approved_tool_and_streams_answer(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("DUCK_DB_PATH", str(tmp_path / "duck.sqlite3"))
|
||||
action_calls = 0
|
||||
|
||||
async def fake_chat(self, role, messages, temperature=None, max_output_tokens=None, response_format=None):
|
||||
nonlocal action_calls
|
||||
assert role == "action"
|
||||
action_calls += 1
|
||||
if any("tool_observations" in message["content"] for message in messages):
|
||||
actions = []
|
||||
else:
|
||||
@@ -173,6 +176,7 @@ def test_continue_stream_executes_approved_tool_and_streams_answer(tmp_path, mon
|
||||
assert "event: content_delta" in body
|
||||
assert "continued after approval" in body
|
||||
assert "event: done" in body
|
||||
assert action_calls == 1
|
||||
conversation_id = re.search(r'"conversation_id"\s*:\s*"([^"]+)"', initial_body).group(1)
|
||||
conversation = client.get(f"/v1/conversations/{conversation_id}").json()
|
||||
assert conversation["messages"][-1]["content"] == "continued after approval"
|
||||
|
||||
Reference in New Issue
Block a user