chat system test

This commit is contained in:
ValueOn AG 2025-07-12 22:59:53 +02:00
parent b1be8dd81c
commit a721a3f364
3 changed files with 31 additions and 13 deletions

View file

@ -1828,14 +1828,14 @@ NOTE: Respond with ONLY the JSON object. Do not include any explanatory text."""
# Only consider empty results a problem if there are no documents produced
has_empty_results = any(
not result.data.get('result', '').strip() and
not result.documents and
not result.documents
not result.data.get('documents') and
not result.data.get('documents')
for result in action_results
if result.success
)
has_incomplete_metadata = any(
any(doc.get('filename') == 'unknown' for doc in result.documents or [])
any(doc.get('filename') == 'unknown' for doc in result.data.get('documents', []) or [])
for result in action_results
if result.success
)
@ -2351,9 +2351,9 @@ Please review the task requirements and try again with different input or approa
# Add action completion message with result documents
documents_info = ""
if result.documents and len(result.documents) > 0:
doc_names = [doc.filename if hasattr(doc, 'filename') else f"Document {j+1}"
for j, doc in enumerate(result.documents)]
if result.data.get("documents") and len(result.data.get("documents", [])) > 0:
doc_names = [doc.get('filename', f"Document {j+1}") if isinstance(doc, dict) else (doc.filename if hasattr(doc, 'filename') else f"Document {j+1}")
for j, doc in enumerate(result.data.get("documents", []))]
documents_info = f"\n📄 Generated documents: {', '.join(doc_names)}"
# Create completion message
@ -2390,9 +2390,9 @@ Please review the task requirements and try again with different input or approa
# Add retry success log
retry_documents_info = ""
if retry_result.documents and len(retry_result.documents) > 0:
doc_names = [doc.filename if hasattr(doc, 'filename') else f"Document {j+1}"
for j, doc in enumerate(retry_result.documents)]
if retry_result.data.get("documents") and len(retry_result.data.get("documents", [])) > 0:
doc_names = [doc.get('filename', f"Document {j+1}") if isinstance(doc, dict) else (doc.filename if hasattr(doc, 'filename') else f"Document {j+1}")
for j, doc in enumerate(retry_result.data.get("documents", []))]
retry_documents_info = f"\n📄 Generated documents: {', '.join(doc_names)}"
self.chatInterface.createWorkflowLog({
@ -2790,7 +2790,7 @@ NOTE: Respond with ONLY the JSON object. Do not include any explanatory text."""
logger.info(f"Action {action.execMethod}.{action.execAction} validated successfully")
# Only create action message if documents were produced
if result.documents and len(result.documents) > 0:
if result.data.get("documents") and len(result.data.get("documents", [])) > 0:
await self._createActionMessage(action, result, workflow, action.execResultLabel)
else:
# Add validation success log instead of message

View file

@ -388,8 +388,26 @@ class ServiceCenter:
for doc_ref in documentList:
# Parse reference format
parts = doc_ref.split(':', 2) # Split into max 3 parts
if len(parts) < 3:
# Handle simple label format (e.g., "task1_action2_webpage_content")
if len(parts) == 1:
# Simple label - try to find documents by label
label = parts[0]
found = False
for message in self.workflow.messages:
if message.documentsLabel == label and message.documents:
all_documents.extend(message.documents)
found = True
break
if not found:
logger.warning(f"No documents found for label: {label}")
continue
# Handle structured reference format
if len(parts) < 3:
logger.warning(f"Invalid document reference format: {doc_ref}")
continue
ref_type = parts[0]
ref_id = parts[1]
ref_label = parts[2]

View file

@ -862,7 +862,7 @@ gateway/
│ │ ├── managerChat.py # Chat management and AI response validation
│ │ ├── managerPrompt.py # AI prompt generation and management
│ │ ├── methodBase.py # Base method class with result validation
│ │ └── processorDocument.py # Document content extraction
│ │ └── documentExtraction.py # Document content extraction
│ │
│ ├── agents/ # To be refactored into methods
│ │ ├── agentSharepoint.py → methods/methodSharepoint.py
@ -889,7 +889,7 @@ gateway/
#### Phase 1: Core Structure Setup
1. **File Renaming and Organization**
- Rename manager files to follow `manager*.py` pattern
- Move document processor to `processorDocument.py`
- Move document processor to `documentExtraction.py`
- Create new `methods` directory
2. **Model Updates**