mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
chore: add mcp documentation
This commit is contained in:
parent
5ecc0d4da9
commit
599dae87a9
6 changed files with 120 additions and 86 deletions
|
|
@ -62,8 +62,10 @@ def _snippet(content: str, query_tokens: list[str], width: int = 240) -> str:
|
|||
if idx >= 0:
|
||||
start = max(0, idx - width // 2)
|
||||
end = min(len(content), start + width)
|
||||
return ("…" if start > 0 else "") + content[start:end].strip() + (
|
||||
"…" if end < len(content) else ""
|
||||
return (
|
||||
("…" if start > 0 else "")
|
||||
+ content[start:end].strip()
|
||||
+ ("…" if end < len(content) else "")
|
||||
)
|
||||
return content[:width].strip() + ("…" if len(content) > width else "")
|
||||
|
||||
|
|
@ -83,9 +85,7 @@ async def search_dograh_docs(query: str, limit: int = 5) -> list[dict]:
|
|||
return []
|
||||
|
||||
scores = bm25.get_scores(tokens)
|
||||
ranked = sorted(
|
||||
zip(scores, docs), key=lambda pair: pair[0], reverse=True
|
||||
)[:limit]
|
||||
ranked = sorted(zip(scores, docs), key=lambda pair: pair[0], reverse=True)[:limit]
|
||||
|
||||
return [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue