# KOC LOOP KOC 内容分发与数据回收闭环,运行于 vinext、Cloudflare D1 和 R2。 ## Prerequisites - Node.js `>=22.13.0` ## Quick Start ```bash npm install npm run dev npm run build ``` 复制 `.dev.vars.example` 为 `.dev.vars` 并配置运行时变量。飞书动态导入需要: - `FEISHU_APP_ID` - `FEISHU_APP_SECRET` 飞书自建应用需开通电子表格读取、知识库节点读取和云文档素材下载权限, 并将应用添加到目标知识库或电子表格的文档应用中。 后台登录首次启动还需要配置: - `SUPER_ADMIN_USERNAME`:唯一的超级管理员登录账号 - `SUPER_ADMIN_PASSWORD`:超级管理员初始密码,至少 8 位 - `ADMIN_INTERNAL_TOKEN`:自动采集等内部任务使用的服务密钥 系统首次登录时创建唯一的超级管理员。后续管理员和普通用户均由“用户管理”页面创建,普通用户不能访问 KOC 资源库。 This starter does not use `wrangler.jsonc`. ## Included Shape - edit site code under `app/` - `.openai/hosting.json` declares optional Sites D1 and R2 bindings - `vite.config.ts` simulates declared bindings for local development - `db/schema.ts` starts intentionally empty - `examples/d1/` contains an optional D1 example surface - `drizzle.config.ts` supports local migration generation when needed ## 后台账号与角色 - 超级管理员:唯一系统管理员,可管理管理员和普通用户。 - 管理员:可访问全部业务模块,可创建和重置普通用户账号。 - 普通用户:可使用工作台、任务、内容分发和数据回收,不可查看或导出 KOC 资源库。 后台不提供注册、找回密码和普通用户个人改密。密码重置统一由管理员在后台完成。 ## Useful Commands - `npm run dev`: start local development - `npm run build`: verify the vinext build output - `npm test`: build the starter and verify its rendered loading skeleton - `npm run db:generate`: generate Drizzle migrations after schema changes ## Learn More - [vinext Documentation](https://github.com/cloudflare/vinext) - [Drizzle D1 Guide](https://orm.drizzle.team/docs/get-started/d1-new)