feat: implement file upload handler and related functionality
- Added file upload handler to process both multipart and raw file uploads. - Implemented parsing logic for upload requests, including handling file metadata. - Introduced SaveFileDecodedInput structure for handling decoded file uploads. - Created unit tests for file upload parsing and validation. feat: add metadata retry configuration and functionality - Introduced MetadataRetryConfig to the application configuration. - Implemented MetadataRetryer to handle retrying metadata extraction for thoughts. - Added new tool for retrying failed metadata extractions. - Updated thought metadata structure to include status and timestamps for metadata processing. fix: enhance metadata normalization and error handling - Updated metadata normalization functions to track status and errors. - Improved handling of metadata extraction failures during thought updates and captures. - Ensured that metadata status is correctly set during various operations. refactor: streamline file saving logic in FilesTool - Refactored Save method in FilesTool to utilize new SaveDecoded method. - Simplified project and thought ID resolution logic during file saving.
This commit is contained in:
@@ -106,15 +106,18 @@ func (t *ReparseMetadataTool) Handle(ctx context.Context, req *mcp.CallToolReque
|
||||
|
||||
normalizedCurrent := metadata.Normalize(thought.Metadata, t.capture)
|
||||
|
||||
attemptedAt := time.Now().UTC()
|
||||
extracted, extractErr := t.provider.ExtractMetadata(ctx, thought.Content)
|
||||
normalizedTarget := normalizedCurrent
|
||||
if extractErr != nil {
|
||||
normalizedTarget = metadata.MarkMetadataFailed(normalizedCurrent, t.capture, attemptedAt, extractErr)
|
||||
mu.Lock()
|
||||
out.Normalized++
|
||||
mu.Unlock()
|
||||
t.logger.Warn("metadata reparse extract failed, using normalized existing metadata", slog.String("thought_id", thought.ID.String()), slog.String("error", extractErr.Error()))
|
||||
} else {
|
||||
normalizedTarget = metadata.Normalize(extracted, t.capture)
|
||||
normalizedTarget = metadata.MarkMetadataComplete(extracted, t.capture, attemptedAt)
|
||||
normalizedTarget.Attachments = thought.Metadata.Attachments
|
||||
mu.Lock()
|
||||
out.Reparsed++
|
||||
mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user