## Agents Added - Alateya: R&D, biotech, innovations - Clan (Spirit): Community spirit agent - Eonarch: Consciousness evolution agent ## Changes - docker-compose.node1.yml: Added tokens for all 3 new agents - gateway-bot/http_api.py: Added configs and webhook endpoints - gateway-bot/clan_prompt.txt: New prompt file - gateway-bot/eonarch_prompt.txt: New prompt file ## Fixes - Fixed ROUTER_URL from :9102 to :8000 (internal container port) - All 9 Telegram agents now working ## Documentation - Created PROJECT-MASTER-INDEX.md - single entry point - Added various status documents and scripts Tokens configured: - Helion, NUTRA, Agromatrix (existing) - Alateya, Clan, Eonarch (new) - Druid, GreenFood, DAARWIZZ (configured)
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""
|
||
Tests for query pipeline
|
||
"""
|
||
|
||
import pytest
|
||
from unittest.mock import AsyncMock, patch, MagicMock
|
||
from app.query_pipeline import answer_query, _build_citations
|
||
|
||
|
||
class TestQueryPipeline:
|
||
"""Tests for RAG query pipeline"""
|
||
|
||
@pytest.mark.asyncio
|
||
async def test_answer_query_no_documents(self):
|
||
"""Test query when no documents found"""
|
||
with patch("app.query_pipeline._retrieve_documents", return_value=[]):
|
||
result = await answer_query(
|
||
dao_id="test-dao",
|
||
question="Test question"
|
||
)
|
||
|
||
assert "answer" in result
|
||
assert "На жаль, я не знайшов" in result["answer"]
|
||
assert result["citations"] == []
|
||
|
||
@pytest.mark.asyncio
|
||
async def test_build_citations(self):
|
||
"""Test citation building"""
|
||
documents = [
|
||
{"content": "Test content 1", "meta": {"doc_id": "doc1", "page": 1, "section": "Section 1"}},
|
||
{"content": "Test content 2", "meta": {"doc_id": "doc2", "page": 2}},
|
||
]
|
||
citations = _build_citations([MagicMock(**d) for d in documents])
|
||
|
||
assert len(citations) == 2
|
||
assert citations[0]["doc_id"] == "doc1"
|
||
assert citations[0]["page"] == 1
|
||
assert citations[0]["section"] == "Section 1"
|
||
assert citations[1]["doc_id"] == "doc2"
|
||
assert citations[1]["page"] == 2
|
||
|