Skip to content

feat: support document and collection summary#1107

Merged
iziang merged 10 commits into
mainfrom
feature/summary
Jul 18, 2025
Merged

feat: support document and collection summary#1107
iziang merged 10 commits into
mainfrom
feature/summary

Conversation

@iziang
Copy link
Copy Markdown
Contributor

@iziang iziang commented Jul 14, 2025

No description provided.

@apecloud-bot apecloud-bot added size/XL Denotes a PR that changes 500-999 lines. size/XXL Denotes a PR that changes 1000+ lines. and removed size/XL Denotes a PR that changes 500-999 lines. labels Jul 14, 2025
cursor[bot]

This comment was marked as outdated.

@iziang iziang force-pushed the feature/summary branch from 12e53f3 to 0127e09 Compare July 15, 2025 06:01
@iziang
Copy link
Copy Markdown
Contributor Author

iziang commented Jul 17, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

iziang added 4 commits July 17, 2025 17:28
- Removed the summary field from the collection schema and its associated status.
- Introduced a new CollectionSummary model to manage collection summaries with distinct statuses (PENDING, GENERATING, COMPLETE, FAILED).
- Updated the CollectionService to trigger summary generation based on collection configuration.
- Enhanced the collection summary reconciliation process with a dedicated reconciler and callbacks for task completion and failure.
- Adjusted frontend components to reflect the removal of the summary field and updated status handling.
@iziang iziang force-pushed the feature/summary branch from 2356b06 to 1060072 Compare July 17, 2025 09:28
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Callback Parameters Mismatch

The on_summary_failed callback is called with incorrect parameters. It expects (summary_id, error_message, target_version) but receives (collection_id, str(e)). This incorrectly uses collection_id instead of summary_id and omits target_version, preventing the failure callback from working properly.

config/celery_tasks.py#L806-L810

# Mark as failed using callback if we've exhausted retries
if self.request.retries >= self.max_retries:
from aperag.service.collection_summary_service import collection_summary_callbacks
collection_summary_callbacks.on_summary_failed(collection_id, str(e))

Fix in CursorFix in Web


Bug: Mismatched Collection Models in Summary Generation

The generate_collection_summary_view endpoint passes a view_models.Collection object (returned by collection_service.get_collection) to collection_summary_service.trigger_collection_summary_generation. This service expects a db_models.Collection database model, leading to runtime errors. Specifically, the config attribute's type differs (CollectionConfig in the view model vs. Text in the database model), causing issues when parseCollectionConfig() is called.

aperag/views/main.py#L112-L118

ApeRAG/aperag/views/main.py

Lines 112 to 118 in 28f7178

# Check if collection exists
collection = await collection_service.get_collection(str(user.id), collection_id)
if not collection:
raise HTTPException(status_code=404, detail="Collection not found")
# Trigger async summary generation
task_triggered = await collection_summary_service.trigger_collection_summary_generation(collection)

Fix in CursorFix in Web


Bug: Null Check Error in Configuration Parsing

Missing null check: The parseCollectionConfig() function might return None, but the code immediately attempts to access config.enable_summary without verifying if config is None. This can lead to an AttributeError at runtime.

aperag/tasks/document.py#L128-L131

# Check if summary is enabled in collection config
config = parseCollectionConfig(collection.config)
if not config.enable_summary:

aperag/tasks/document.py#L291-L294

from aperag.schema.utils import parseCollectionConfig
# Check if summary is enabled in collection config
config = parseCollectionConfig(collection.config)

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@iziang iziang merged commit 26d90af into main Jul 18, 2025
6 of 7 checks passed
@iziang iziang deleted the feature/summary branch July 18, 2025 02:24
@iziang iziang linked an issue Jul 18, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 1000+ lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Features] Support for Document and Collection Summaries

2 participants