feat: enhance Google Docs and Drive functionality

- Add insert_doc_image_from_drive() with permission checking
- Add insert_doc_image_url() for URL-based image insertion
- Add gdrive/drive_file_permissions.py with permission utilities
- Add gdrive/drive_helpers.py with Drive utility functions
- Add create_insert_text_segment_request() helper for headers/footers
- Improve error handling to distinguish auth vs validation errors
- Maintain backward compatibility with existing functionality
- Include comprehensive error messages and user guidance

Tested successfully with real Google Workspace integration.
This commit is contained in:
Rob Sherman
2025-08-14 18:38:37 -07:00
parent 99018d32d4
commit 203005b76d
5 changed files with 449 additions and 1 deletions

View File

@@ -295,12 +295,16 @@ def handle_http_errors(tool_name: str, is_read_only: bool = False, service_type:
f"The required API is not enabled for your project. "
f"Please check the Google Cloud Console to enable it."
)
else:
elif error.resp.status in [401, 403]:
# Authentication/authorization errors
message = (
f"API error in {tool_name}: {error}. "
f"You might need to re-authenticate for user '{user_google_email}'. "
f"LLM: Try 'start_google_auth' with the user's email and the appropriate service_name."
)
else:
# Other HTTP errors (400 Bad Request, etc.) - don't suggest re-auth
message = f"API error in {tool_name}: {error}"
logger.error(f"API error in {tool_name}: {error}", exc_info=True)
raise Exception(message) from error