P0 — 新建 common/js/media-upload.js (12KB)
- uploadImage(filePath) / uploadMedia(filePath, kind) 落地
- 此前 ai-chat-tools-panel.vue 引用但文件从未入库, 选图立即抛 "Cannot find module"
- 12 cloud provider 分流: 4-field STS (alioss/qiniu/txcos/baidubos/qingstor/jdoss/ucloud/wyoss) vs single-URL signed PUT (huaweiobs/volcengine/awsoss/minio)
- 端点必须 addon namespace: /<addon>/api/upload/{image|file|ossSts}, 普通 /api/kefu/upload/* 不命中 InitRoute
- 补 docs 设计稿漏写的 `import store from '@/store/index.js'` (H5 上传需带 token)
P1 — ai-chat-message.vue 用户附件全支持
- P1.1 filter 不再丢 file/audio/video 消息
- P1.2 用户气泡加 type==='file' 分支: 文件图标 + 名称 + 大小 + 上传状态
- P1.3 sendMessage type 不再强制把 audio/video 折成 file
P2 — AI 侧 audio 播放引擎接通
- P2.1 previewAttachment audio 分支 → 跳 file-preview
- P2.2 音频气泡接 uni.createInnerAudioContext: data 加 innerAudioCtx/_innerAudioSrc, 改写 playAudio/pauseAudio, beforeDestroy 必 destroy, slider 区分 change (显示) / changeend (实际 seek)
- P2.3 file-preview.vue 加 image-viewer + audio-viewer 两个分支;inferFileType 识别 jpg/png/mp3/wav 等扩展
P3 — sendMessageWithContent 透传 attachments 参数
- 默认 attachments = [], 传给 sendStreamMessage/sendNormalMessage
- tools panel 选完文件 push 到 attachments → 链到 send
lang — zh-cn + en-us file-preview 加 4 项
- audioUrlNotExist / audioDefaultTitle / audioPlaying / audioPaused
docs — docs/ai-agent-integration.md (跨 PR 累积同步, 2149 行)
- 版本基线提到 PR-WB-MP-INLINE-MEDIA (2026-09-16) 及之后
- 加 §3.1.5 attachments.data 字段协议 (PR-WB-MP-INLINE-MEDIA)
- 12 cloud provider 替换原"阿里云"单点 (PR-OSS-REGISTRY)
- media-upload.js 章节补 fileToBase64 (PR-FRONTEND-MEDIA-UPLOAD)
- 上传策略表 backend/oss_sts/auto 全替换为"云存储"措辞
对齐后端:
- PR-WB-MP-INLINE-MEDIA (a707b90): media data 字段
- PR-OSS-REGISTRY (12 provider): OssProviderRegistry
- PR-FRONTEND-MEDIA-UPLOAD (本 commit): 前端落地
兼容性:
- 后端未升级到 PR-WB-MP-INLINE-MEDIA 之前, attachments 不带 data 字段, 走 URL 路径 (退化到老行为, 不破)
- 后端 oss_sts 单点 alioss 时, securityToken 不带 -SIGNED 后缀, 走 4-field STS 分支 (与 PR-OSS-REGISTRY 之前兼容)
回归:
- node --check media-upload.js OK
- lang zh ESM import OK, 输出 8 个 key 全对
- ai-chat-message.vue 11 处 PR-FRONTEND-MEDIA-UPLOAD 标记, file-preview.vue 9 处
- 旧 chat 路径不带 attachments 走默认 [], 不破坏现有响应结构
安全约束: 不涉及 nginx 层防盗链 / 限速
17 lines
594 B
JavaScript
17 lines
594 B
JavaScript
export const lang = {
|
|
//title为每个页面的标题
|
|
title: 'File Preview',
|
|
// file-preview/file-preview.vue page new translation items
|
|
// File URL does not exist
|
|
fileUrlNotExist: 'File URL does not exist',
|
|
// Video URL does not exist
|
|
videoUrlNotExist: 'Video URL does not exist',
|
|
// PR-FRONTEND-MEDIA-UPLOAD (2026-09-16): audio related
|
|
audioUrlNotExist: 'Audio URL does not exist',
|
|
audioDefaultTitle: 'Voice message',
|
|
audioPlaying: 'Playing…',
|
|
audioPaused: 'Paused',
|
|
// This file type preview is not supported
|
|
unsupportedFileType: 'This file type preview is not supported',
|
|
}
|