From a722e16fe2cc8bdc2d483db374a5deadb8572fdc Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 3 Jun 2026 10:41:10 +0000 Subject: [PATCH] Fix VectorDB search: use content field instead of text The vector-db API returns message content in a top-level "content" field with "author" and "channel" also top-level (not nested under metadata). Previous code read "text" and "metadata.author" which returned empty strings, making all vector search results invisible to the LLM. Co-Authored-By: Claude Opus 4.7 --- wiki-vector-chat.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wiki-vector-chat.py b/wiki-vector-chat.py index c3d0a76..b0d186c 100644 --- a/wiki-vector-chat.py +++ b/wiki-vector-chat.py @@ -152,12 +152,11 @@ async def search_vector(query: str, top_k: int = 5) -> str: return "" lines = [] for h in hits[:top_k]: - text = h.get("text", "")[:300] + text = h.get("content", "") or h.get("text", "") score = h.get("score", 0) source = h.get("source", "unknown") - meta = h.get("metadata", {}) - author = meta.get("author", "") - channel = meta.get("channel", "") + author = h.get("author", "") + channel = h.get("channel", "") preview = text.replace("\n", " ")[:200] lines.append(f"[{source}] @{author} in #{channel}: {preview} (score: {score:.2f})") return "\n\n".join(lines)