Merge branch 'main' into feat/agent-schema-response

This commit is contained in:
Alex
2025-08-13 17:12:26 +01:00
committed by GitHub
6 changed files with 84 additions and 96 deletions

View File

@@ -179,6 +179,12 @@ class BaseAnswerResource:
log_data["structured_output"] = True
if schema_info:
log_data["schema"] = schema_info
# clean up text fields to be no longer than 10000 characters
for key, value in log_data.items():
if isinstance(value, str) and len(value) > 10000:
log_data[key] = value[:10000]
self.user_logs_collection.insert_one(log_data)
# End of stream

View File

@@ -66,6 +66,11 @@ class ConversationService:
if not user_id:
raise ValueError("User ID not found in token")
current_time = datetime.now(timezone.utc)
# clean up in sources array such that we save max 1k characters for text part
for source in sources:
if "text" in source and isinstance(source["text"], str):
source["text"] = source["text"][:1000]
if conversation_id is not None and index is not None:
# Update existing conversation with new query

View File

@@ -64,7 +64,7 @@ attachments_collection = db["attachments"]
try:
agents_collection.create_index(
[("shared_publicly", 1)],
[("shared", 1)],
name="shared_index",
background=True,
)