feat: add deepsearch research system with CLI prune/clear and database schema
Implement a multi-agent deep web research subsystem including CLI commands for pruning expired jobs and clearing all artifacts, database tables for sessions/messages/URL cache with indexes, config paths for chroma storage, and internal embed URL for vector operations.
This commit is contained in:
@@ -246,6 +246,36 @@ def test_embeddings_remaps_alias_to_configured_model(local_db, monkeypatch):
|
||||
assert rt._client.calls[-1][1]["model"] == "qwen/qwen3-embedding-8b"
|
||||
|
||||
|
||||
def test_embeddings_success_records_ledger(local_db, monkeypatch):
|
||||
monkeypatch.setattr(gwmod.httpx, "AsyncClient", FakeEmbedClient_openai_gateway)
|
||||
svc = GatewayService()
|
||||
cfg = svc.effective_config()
|
||||
cfg["gateway_force_model"] = True
|
||||
cfg["gateway_embed_enabled"] = True
|
||||
cfg["gateway_embed_model"] = "qwen/qwen3-embedding-8b"
|
||||
rt = svc.runtime()
|
||||
before = rt.embed_calls
|
||||
resp = run_async(
|
||||
rt.handle_embeddings(
|
||||
{"model": "molodetz~embed", "input": "hello"},
|
||||
cfg,
|
||||
("guest", "ledger_probe"),
|
||||
"test",
|
||||
)
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
payload = json.loads(bytes(resp.body).decode())
|
||||
assert payload["data"][0]["embedding"] == [0.1, 0.2]
|
||||
assert rt.embed_calls == before + 1
|
||||
row = get_table("gateway_usage_ledger").find_one(owner_id="ledger_probe")
|
||||
assert row is not None
|
||||
assert row["backend"] == "embed"
|
||||
assert row["endpoint"] == "embeddings"
|
||||
assert row["requested_model"] == "molodetz~embed"
|
||||
assert row["model"] == "qwen/qwen3-embedding-8b"
|
||||
assert row["success"] == 1
|
||||
|
||||
|
||||
def test_embeddings_disabled_returns_503(local_db, monkeypatch):
|
||||
monkeypatch.setattr(gwmod.httpx, "AsyncClient", FakeEmbedClient_openai_gateway)
|
||||
svc = GatewayService()
|
||||
|
||||
Reference in New Issue
Block a user