build(cli): 迁移到 uni-app 官方 Vite CLI 骨架(src/ 布局)

按地图口径把 HBuilderX 工程改成官方 #vite(JS 版)CLI 工程:

- 业务代码 git mv 进 src/(176 个 rename,逐文件字节比对零内容改动):
  App.vue / main.js / manifest.json / pages.json / uni.scss /
  pages/ / packageMine/ / components/ / utils/ / static/ /
  uni_modules/ / uni.promisify.adaptor.js
- 新增官方骨架:package.json(@dcloudio/* 同版本 pin
  3.0.0-5020620260917001,vite 精确 5.2.8,vue ^3.4.21;只留 h5 与
  mp-weixin 脚本)、vite.config.js、shims-uni.d.ts;补 sass devDependency
  以支持既有 lang="scss"
- index.html 沿用本仓文件,入口改为 /src/main.js
- manifest.json 删除 app-plus / quickapp / mp-alipay / mp-baidu /
  mp-toutiao 五个死平台段,只留 mp-weixin
- .gitignore 加 dist/
- pnpm-workspace.yaml 新增 allowBuilds 白名单:pnpm 12 起
  onlyBuiltDependencies 已被移除,且 strictDepBuilds 默认 true 会把
  「未复核构建脚本」判成非零退出。白名单只列传递依赖
  esbuild / @parcel/watcher / core-js / core-js-pure。
  未使用 shamefully-hoist 或 node-linker=hoisted。

验收:pnpm build:mp-weixin 退出码 0,产物 app.json 的
pages / subPackages / tabBar / window 与改造前基线逐项一致;
project.config.json 落产物且 appid = wxf7ee9cd5801bf7a6。
This commit is contained in:
ticket-02 agent
2026-10-15 15:14:11 +08:00
parent 3a0c099704
commit 81a093120c
184 changed files with 5524 additions and 73 deletions
+59
View File
@@ -0,0 +1,59 @@
import { API_BASE_URL, apiRequest, getToken } from '../assistant/chat-service'
export function creativeAssistant(data) {
return apiRequest({
url: `${API_BASE_URL}/ai/creativeAssistant`,
method: 'POST',
data,
withTenant: true,
timeout: 600000
})
}
/**
* AI 文件上传(喂给 Dify 开始节点的 file-list 变量)。
*
* @param {object} file `uni.chooseMessageFile` 拿到的临时文件(需有 `path`)
* @param {string} [app] 应用代号(后端按代号选择 Dify 应用凭证)
*
* `app` 不是可选项而是**硬约束**:Dify 的 `/files/upload` 按应用鉴权,
* 文件只能被「上传时所用应用」的工作流引用。不传 `app` 时后端走旧逻辑
* (`type` 为空 → chat 凭证),本页附件必然报 `Invalid upload file`(issue 14 实测)。
*/
export function uploadAiFile(file, app) {
const token = getToken()
const formData = {
tenantId: '10049'
}
if (app) {
formData.app = app
}
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${API_BASE_URL}/ai/file/upload`,
filePath: file.path,
name: 'file',
header: token
? {
Authorization: token
}
: {},
formData,
success: (response) => {
try {
const result = JSON.parse(response.data || '{}')
if (result.code === 0 && result.data) {
resolve(result.data)
return
}
reject(new Error(result.message || '上传失败'))
} catch (error) {
reject(new Error('上传响应解析失败'))
}
},
fail: (error) => {
reject(new Error(error.errMsg || '上传失败'))
}
})
})
}