接入反馈凭证原生图片导入

反馈页上传凭证在原生壳内优先调用 HostBridge 图片导入

宿主图片结果转换为 File 后复用现有凭证预览和提交校验

补充反馈凭证原生导入测试和宿主壳文档边界
This commit is contained in:
2026-06-18 06:24:44 +08:00
parent a7d713c806
commit 01349e7882
5 changed files with 88 additions and 3 deletions

View File

@@ -2312,3 +2312,10 @@
- 决策:创作 Agent 工作台在 `native_app` 且宿主声明 `file.importText` 时优先调用 `importHostTextFile()`,将宿主返回的 UTF-8 文本副本转换成浏览器 `File` 后继续调用现有 `/api/runtime/creation-agent/document-inputs/parse`。原生壳只负责受控选择和返回文本内容,不暴露设备 URI、本机路径或通用文件系统也不在前端绕过后端文档解析、256KB 解析限制、docx 支持或错误口径。普通浏览器、小程序和未声明该能力的裁剪壳继续使用原 `<input type="file">` 路径。
- 影响范围:`src/components/creation-agent/CreationAgentWorkspace.tsx``src/services/host-bridge/hostBridge.ts`、Expo / Tauri HostBridge 文档。
- 验证方式:`npm run check:native-shells``npm run test -- src/components/creation-agent/CreationAgentWorkspace.test.tsx`、针对变更文件执行 ESLint、`npm run typecheck``npm run check:encoding``git diff --check`
## 2026-06-18 反馈凭证上传接入原生壳图片导入
- 背景帮助与反馈页的上传凭证入口在原生壳内仍只能触发浏览器隐藏文件输入Expo / Tauri 壳已具备受控 `file.importImage` 图片选择能力。
- 决策:`PlatformFeedbackView``native_app` 且宿主声明 `file.importImage` 时优先调用 `importHostImageFile()`,把宿主返回的图片内容副本转换成浏览器 `File` 后继续走现有凭证预览和提交逻辑。反馈页仍保留最多 4 张、单张 1MB、总 4MB、图片 MIME 和 data URL payload 校验;宿主不暴露设备 URI、本机绝对路径或通用文件系统。普通浏览器、小程序和未声明该能力的裁剪壳继续使用原 `<input type="file">`
- 影响范围:`src/components/platform-entry/PlatformFeedbackView.tsx``src/services/host-bridge/hostBridge.ts`、Expo / Tauri HostBridge 文档。
- 验证方式:`npm run check:native-shells``npm run test -- src/components/platform-entry/PlatformFeedbackView.test.tsx`、针对变更文件执行 ESLint、`npm run typecheck``npm run check:encoding``git diff --check`