Show privacy popup on launch, gate login on legal consent, and link user agreement and privacy policy pages in the mini program. Co-authored-by: Cursor <cursoragent@cursor.com>
TKMind WeChat Mini Program
This directory contains the native WeChat Mini Program client. It is intentionally isolated from the H5/backend code so development can proceed without changing existing services.
Current MVP
- Native WeChat login entry via
wx.login. - H5 account/password login fallback through
/auth/login. - Chat submission through
/api/agent/runs. - Agent run polling through
/api/agent/runs/:runId. - Session detail refresh through
/api/sessions/:sessionId. - Session list through
/api/sessions. - MindSpace page list through
/api/mindspace/v1/pages. - Page preview through Mini Program
web-view.
Backend Assumptions
The H5 APIs are reused as-is. Native Mini Program login posts the wx.login code to MINIAPP_LOGIN_PATH in utils/config.js; the current default is /auth/wechat-miniapp/login. If that backend endpoint is not available yet, use the account/password login fallback during local development.
Production / 提审前(当前默认)
utils/config.js默认LOCAL_DEV = false,API 指向https://m.tkmind.cn。project.config.json中urlCheck: true;DevTools 需配置真实小程序 AppID(非 tourist)。- 微信公众平台需配置 request / web-view 合法域名:
m.tkmind.cn。 - 已启用
__usePrivacyCheck__,登录页含协议勾选(默认不勾选)、协议全文页与微信隐私弹窗组件。 - 首次登录须主动勾选协议;登录成功后本地保存 cookie 与同意记录,下次自动登录不再展示协议区。
- 此配置不会触发 103 发版;仅小程序客户端连线上 Portal。
微信公众平台后台(提审必配)
- 设置 → 服务内容声明 → 用户隐私保护指引
- 声明收集:用户账号、邮箱、微信登录标识、聊天记录、设备信息
- 用途:账号登录验证、身份识别、提供 AI 对话与会话服务
- 设置 → 基本设置 → 服务内容声明
- 补充用户服务协议与隐私政策说明(协议已内置在小程序
pages/legal/)
- 补充用户服务协议与隐私政策说明(协议已内置在小程序
- 提审备注可写:「登录页已增加协议勾选与隐私政策全文,未同意前不提交用户信息;已接入微信隐私保护检测」
- 微信一键登录还需 Portal 侧配置
H5_WECHAT_MINIAPP_APP_ID/H5_WECHAT_MINIAPP_APP_SECRET并实现/auth/wechat-miniapp/login;未部署前可先用账号密码登录。
开发者工具仍显示「游客模式」时
- 关闭项目,重新「导入项目」并选择 AppID
wx3e79ecd530c88da4(不要选测试号/游客模式) - 或:详情 → 基本信息 → AppID 改为你自己的小程序
- 确认
project.config.json与project.private.config.json中appid均为wx3e79ecd530c88da4 - 重新编译后再点「微信一键登录」
Local Debug (optional)
- Start local Portal in the repo root:
pnpm dev
# or ensure http://127.0.0.1:8081/auth/status responds
-
Switch miniapp back to local Portal without touching production:
- In
utils/config.js, setLOCAL_DEV = true, or - Copy
utils/config.local.example.js→utils/config.local.jsand setAPI_BASE_URL.
project.private.config.jsononly affects DevTools compiler settings; it is not available to runtimerequire(). - In
-
WeChat DevTools → 详情 → 本地设置 (local only):
- enable Do not verify合法域名 / TLS
- keep tourist AppID only if you use account/password login; real AppID is required for
wx.login
-
Restart Portal after pulling local server changes. Local Portal only bypasses CSRF for WeChat
servicewechat.comreferrers; productionm.tkmind.cnis unchanged. -
Use an account that exists in your local
.envdatabase auth. Wrong credentials return401, not403.
Isolation Rule
Mini Program work should stay inside miniapp/. Do not modify backend, H5, Memory, MindSpace, or production release files for this MVP unless explicitly approved.