Add presence probe configuration to Assistant model and API. Introduce new fields for enabling presence probes, idle and cooldown durations, maximum prompts, context inclusion, and custom questions. Update schemas, routers, and frontend components to support these features, along with corresponding tests to ensure functionality.
This commit is contained in:
@@ -307,6 +307,37 @@ class TestAssistantAPI:
|
||||
assert tts["apiKey"] == "dashscope-key"
|
||||
assert tts["baseUrl"] == "wss://dashscope.aliyuncs.com/api-ws/v1/realtime"
|
||||
|
||||
def test_presence_probe_config_is_persisted_and_exposed(self, client, sample_assistant_data):
|
||||
sample_assistant_data.update({
|
||||
"presenceProbeEnabled": True,
|
||||
"presenceProbeIdleSeconds": 18,
|
||||
"presenceProbeCooldownSeconds": 52,
|
||||
"presenceProbeMaxPrompts": 3,
|
||||
"presenceProbeIncludeContext": False,
|
||||
"presenceProbeQuestion": "你还在吗?",
|
||||
})
|
||||
assistant_resp = client.post("/api/assistants", json=sample_assistant_data)
|
||||
assert assistant_resp.status_code == 200
|
||||
payload = assistant_resp.json()
|
||||
assistant_id = payload["id"]
|
||||
assert payload["presenceProbeEnabled"] is True
|
||||
assert payload["presenceProbeIdleSeconds"] == 18
|
||||
assert payload["presenceProbeCooldownSeconds"] == 52
|
||||
assert payload["presenceProbeMaxPrompts"] == 3
|
||||
assert payload["presenceProbeIncludeContext"] is False
|
||||
assert payload["presenceProbeQuestion"] == "你还在吗?"
|
||||
|
||||
runtime_resp = client.get(f"/api/assistants/{assistant_id}/runtime-config")
|
||||
assert runtime_resp.status_code == 200
|
||||
metadata = runtime_resp.json()["sessionStartMetadata"]
|
||||
probe = metadata["presenceProbe"]
|
||||
assert probe["enabled"] is True
|
||||
assert probe["idleSeconds"] == 18
|
||||
assert probe["cooldownSeconds"] == 52
|
||||
assert probe["maxPrompts"] == 3
|
||||
assert probe["includeContext"] is False
|
||||
assert probe["question"] == "你还在吗?"
|
||||
|
||||
def test_assistant_interrupt_and_generated_opener_flags(self, client, sample_assistant_data):
|
||||
sample_assistant_data.update({
|
||||
"firstTurnMode": "user_first",
|
||||
|
||||
Reference in New Issue
Block a user