diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e398d9..274fce5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: uses: hoverkraft-tech/compose-action@3846bcd61da338e9eaaf83e7ed0234a12b099b72 # v2.4.1 with: compose-file: "./docker-compose.yml" - compose-flags: "--profile qdrant" + #compose-flags: "--profile qdrant" up-flags: "--build" - name: Install the latest version of uv diff --git a/docker-compose.yml b/docker-compose.yml index f8bd866..e5105d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -94,9 +94,9 @@ services: # 1. Network mode: Set QDRANT_URL=http://qdrant:6333 (requires qdrant service) # 2. In-memory mode: Set QDRANT_LOCATION=:memory: (default if nothing set) # 3. Persistent local: Set QDRANT_LOCATION=/app/data/qdrant (stored in mcp-data volume) - #- QDRANT_LOCATION=/app/data/qdrant - - QDRANT_URL=http://qdrant:6333 # Uncomment for network mode - - QDRANT_API_KEY=${QDRANT_API_KEY:-my_secret_api_key} # Only for network mode + - QDRANT_LOCATION=":memory:" # In-memory mode for CI/testing (no external service required) + #- QDRANT_URL=http://qdrant:6333 # Uncomment for network mode + #- QDRANT_API_KEY=${QDRANT_API_KEY:-my_secret_api_key} # Only for network mode # Collection naming: Auto-generated as {deployment-id}-{model-name} # - Deployment ID: OTEL_SERVICE_NAME (if set) or hostname (fallback) diff --git a/nextcloud_mcp_server/vector/qdrant_client.py b/nextcloud_mcp_server/vector/qdrant_client.py index 16d8157..8b2fbfa 100644 --- a/nextcloud_mcp_server/vector/qdrant_client.py +++ b/nextcloud_mcp_server/vector/qdrant_client.py @@ -93,10 +93,10 @@ async def get_qdrant_client() -> AsyncQdrantClient: except Exception as e: # Check if it's a dimension mismatch error (re-raise it) - if isinstance(e, ValueError): + if isinstance(e, ValueError) and "Dimension mismatch" in str(e): raise - # Collection doesn't exist, create it + # Collection doesn't exist or other error, create it await _qdrant_client.create_collection( collection_name=collection_name, vectors_config=VectorParams( diff --git a/tests/integration/test_sampling.py b/tests/integration/test_sampling.py index 3a09165..6112a01 100644 --- a/tests/integration/test_sampling.py +++ b/tests/integration/test_sampling.py @@ -146,12 +146,23 @@ Avoid blocking operations in async code.""", assert "search_method" in result # For this test, sampling might fail (no real LLM client) - # So we check for either success or fallback - if "[Sampling unavailable" in result["generated_answer"]: - # Fallback mode - should still have sources - assert result["search_method"] == "semantic_sampling_fallback" + # So we check for either success or various fallback states + unsupported_methods = { + "semantic_sampling_unsupported", + "semantic_sampling_user_declined", + "semantic_sampling_timeout", + "semantic_sampling_mcp_error", + "semantic_sampling_fallback", + } + + if result["search_method"] in unsupported_methods: + # Fallback/unsupported mode - should still have sources assert len(result["sources"]) > 0 - pytest.skip("Sampling not supported by test client (expected fallback)") + assert result["total_found"] > 0 + pytest.skip( + f"Sampling not available (method: {result['search_method']}), " + f"but search results returned successfully" + ) else: # Successful sampling assert result["search_method"] == "semantic_sampling"