feat: add image upload functionality for articles

- Implemented image upload API in the article service, allowing users to upload images associated with articles.
- Added validation for image size and type, ensuring only supported formats (PNG, JPG, GIF, WebP) are accepted.
- Created a new Aliyun object storage client to handle image storage and retrieval.
- Updated the article handler to include an endpoint for image uploads.
- Enhanced error handling for image upload failures and added relevant error messages.
- Introduced public URL generation for stored images, allowing access via signed tokens.
- Updated localization files to include new messages related to image upload functionality.
- Added tests for image upload and retrieval processes.
This commit is contained in:
2026-04-05 22:10:05 +08:00
parent 1401b50556
commit 94f7186cce
19 changed files with 1033 additions and 14 deletions
+7
View File
@@ -24,8 +24,15 @@ const errorMessageMap: Record<string, string> = {
outline_task_not_found: "文章大纲任务不存在或已失效",
article_generating: "文章仍在生成中",
article_not_editable: "只有已完成文章才可编辑",
article_lookup_failed: "文章状态读取失败",
draft_not_editable: "只有草稿或生成失败的文章才可继续在向导中编辑",
article_title_required: "请输入文章标题",
invalid_image: "请选择图片文件",
article_image_too_large: "图片不能超过 10MB",
article_image_type_not_supported: "仅支持 PNG、JPG、GIF、WebP 图片",
article_image_upload_failed: "图片上传失败",
article_image_url_unavailable: "图片地址生成失败",
object_storage_unavailable: "对象存储未配置或当前不可用",
invalid_payload: "请求参数不合法",
update_failed: "保存文章失败",
publisher_plugin_timeout: "浏览器插件响应超时,请刷新当前页面后重试",