Fixing user fields

This commit is contained in:
Cyber MacGeddon 2026-04-21 11:48:51 +01:00
parent cf5041eeb0
commit 0bc97b9374
4 changed files with 13 additions and 5 deletions

View file

@ -584,7 +584,7 @@ class AsyncFlowInstance:
result = await self.request("document-rag", request_data)
return result.get("response", "")
async def graph_embeddings_query(self, text: str, user: str, collection: str, limit: int = 10, **kwargs: Any):
async def graph_embeddings_query(self, text: str, collection: str, limit: int = 10, user: str = "", **kwargs: Any):
"""
Query graph embeddings for semantic entity search.

View file

@ -381,7 +381,7 @@ class AsyncSocketFlowInstance:
if hasattr(chunk, 'content'):
yield chunk.content
async def graph_embeddings_query(self, text: str, user: str, collection: str, limit: int = 10, **kwargs):
async def graph_embeddings_query(self, text: str, collection: str, limit: int = 10, user: str = "", **kwargs):
"""Query graph embeddings for semantic search"""
emb_result = await self.embeddings(texts=[text])
vector = emb_result.get("vectors", [[]])[0]

View file

@ -755,9 +755,9 @@ class SocketFlowInstance:
def graph_embeddings_query(
self,
text: str,
user: str,
collection: str,
limit: int = 10,
user: str = "",
**kwargs: Any
) -> Dict[str, Any]:
"""Query knowledge graph entities using semantic similarity."""
@ -777,9 +777,9 @@ class SocketFlowInstance:
def document_embeddings_query(
self,
text: str,
user: str,
collection: str,
limit: int = 10,
user: str = "",
**kwargs: Any
) -> Dict[str, Any]:
"""Query document chunks using semantic similarity."""

View file

@ -3,6 +3,7 @@ Collection management for the librarian - uses config service for storage
"""
import asyncio
import dataclasses
import logging
import json
import uuid
@ -173,10 +174,17 @@ class CollectionManager:
if response.error:
raise RuntimeError(f"Config query failed: {response.error.message}")
# Every value in this workspace is a collection for this user
# Every value in this workspace is a collection.
# Filter to fields the current schema knows about — older
# persisted values may carry fields that have since been
# dropped (e.g. `user` from the pre-workspace-refactor era).
known_fields = {f.name for f in dataclasses.fields(CollectionMetadata)}
collections = []
for config_value in response.values:
metadata_dict = json.loads(config_value.value)
metadata_dict = {
k: v for k, v in metadata_dict.items() if k in known_fields
}
metadata = CollectionMetadata(**metadata_dict)
collections.append(metadata)