Skip to content

Commit 775ba94

Browse files
committed
fix(sdk/mcp): correct aggregator API path and response model attributes
- SDK: Change chat endpoint paths from /chat to /api/v1/chat to match aggregator router configuration - MCP: Remove non-existent attributes from SourceInfo (retrieval_time_ms) and ChatMetadata (model_used, tokens_used) response formatting Fixes 404 errors when calling aggregator and attribute errors in response parsing.
1 parent 9ff5fa4 commit 775ba94

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

mcp/server.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,12 +1737,14 @@ def chat_with_syfthub(
17371737
sources_info = []
17381738
if response.sources:
17391739
for source in response.sources:
1740-
sources_info.append({
1740+
source_entry = {
17411741
"path": source.path,
17421742
"status": source.status.value if hasattr(source.status, 'value') else str(source.status),
17431743
"documents_retrieved": source.documents_retrieved,
1744-
"retrieval_time_ms": source.retrieval_time_ms
1745-
})
1744+
}
1745+
if source.error_message:
1746+
source_entry["error_message"] = source.error_message
1747+
sources_info.append(source_entry)
17461748

17471749
# Format metadata
17481750
metadata_info = {}
@@ -1751,8 +1753,6 @@ def chat_with_syfthub(
17511753
"retrieval_time_ms": response.metadata.retrieval_time_ms,
17521754
"generation_time_ms": response.metadata.generation_time_ms,
17531755
"total_time_ms": response.metadata.total_time_ms,
1754-
"model_used": response.metadata.model_used,
1755-
"tokens_used": response.metadata.tokens_used
17561756
}
17571757

17581758
logger.info(f"Chat query successful. Response length: {len(response.response)}")

sdk/python/src/syfthub_sdk/chat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def complete(
501501

502502
try:
503503
response = self._agg_client.post(
504-
f"{self._aggregator_url}/chat",
504+
f"{self._aggregator_url}/api/v1/chat",
505505
json=request_body,
506506
headers={"Content-Type": "application/json"},
507507
)
@@ -627,7 +627,7 @@ def stream(
627627
try:
628628
with self._agg_client.stream(
629629
"POST",
630-
f"{self._aggregator_url}/chat/stream",
630+
f"{self._aggregator_url}/api/v1/chat/stream",
631631
json=request_body,
632632
headers={
633633
"Content-Type": "application/json",

0 commit comments

Comments
 (0)