Skip to content

finebyme99/AI_Land_HRAS

Repository files navigation

AI Land (AILand)

English | 中文

English

AI Land is an HR AI community platform for the HRAS team. It brings together the scenario library, AI war report, courses, AI competitions, and recommended AI applications in one place.

Tech Stack

  • Framework: Next.js 16 (App Router)
  • UI: React 19 + Ant Design 6 + Tailwind CSS 4
  • Backend: Supabase (PostgreSQL + RLS)
  • Authentication: Feishu OAuth
  • Deployment: Vercel

Local Development

npm install
npm run dev

Open http://localhost:3000.

Environment Variables

Variable Description
NEXT_PUBLIC_SUPABASE_URL Supabase project URL
NEXT_PUBLIC_SUPABASE_ANON_KEY Supabase anon key
SUPABASE_SERVICE_ROLE_KEY Supabase service role key, used by API routes

Feishu app credentials are stored in the feishu_apps table and managed through the admin UI. They are not stored in environment variables. See CONTRIBUTING.md for details.

Project Structure

src/
├── app/              # Next.js App Router pages
│   ├── api/          # API routes
│   ├── admin/        # Admin console
│   ├── wish-pool/    # Scenario library with three tab views
│   ├── war-report/   # Admin-only AI adoption war report
│   ├── resources/    # Courses and resources, including courses and tools
│   ├── competitions/ # AI competitions
│   └── page.tsx      # Home page with centered hero and 5-item glass metrics strip
├── components/       # Shared components: Navigation, ChoDashboard, resource cards, EntryCard, etc.
└── lib/              # Utilities: Supabase, Feishu, auth, bitable mapping, resource normalization, export-image styles

Permissions And Admin

  • The admin console uses lightweight RBAC through the roles and user_roles tables. role_permissions is a legacy table and is not read at runtime. Permission points and role rules are declared in src/lib/permissions/registry.ts.
  • The visible admin console entry is an admin-only top navigation module. Its menu currently contains Content Review, User Permissions, Bitable Field Mapping, and Feishu App Configuration.
  • /war-report is an admin-only main navigation module. Its data API is GET /api/admin/war-report; the Feishu sync button on that page reuses POST /api/admin/competition-sync and remains guarded by competition.sync.
  • User permission management is available at /admin/roles, with Role List and User Assignment views. Role permissions are maintained in code, not configured through an admin matrix.
  • The legacy /admin/users route is kept for compatibility and redirects to /admin/roles?tab=users.
  • The admin role has all permissions by default. Reviewer role assignment is a legacy flow and is no longer shown or maintained in the user authorization UI.
  • The user role has case.submit, resource.submit, and resource.generate-feishu-card by default.

Resources And Feishu Cards

  • The tools page can generate a visual Feishu card for a single tool and send it to the currently logged-in user.
  • API: POST /api/resources/card-to-me, with body { "resourceId": "<apps.id>" }.
  • The server reads the current user from the feishu_user_id cookie, looks up that user's feishu_open_id, and sends with receive_id_type=open_id. It does not broadcast to group chats.
  • The card template reuses src/lib/feishu-cards.ts#buildResourceCard. The tools entry point is /resources?tab=apps.

Scenario Snapshot Sync

  • Scenario library, AI competition progress, and CHO dashboard pages read competition_submissions snapshots from Supabase by default. Foreground page refreshes do not pull Feishu directly.
  • AI war report also reads the same competition_submissions snapshots. It defaults to all review periods, aggregates team performance, and keeps committee operation sections in war_report_manual_sections.
  • Full Feishu bitable sync is centralized in the admin field-map page: /admin/bitable-field-map -> 全量同步飞书场景数据 -> POST /api/admin/competition-sync, guarded by the competition.sync permission.
  • The Vercel cron route GET /api/cron/sync-competitions uses the same sync service.
  • Sync status is stored in platform_settings through migration 074_competition_sync_status.sql, including the latest attempt time, latest successful sync time, status, and result counts such as synced and changed rows.
  • Sync code preserves historical submission IDs that already have review records, then writes the latest Feishu fields onto that ID and removes duplicate shadow rows.

Detailed Guidelines

See CONTRIBUTING.md, AGENTS.md, docs/operator-runbook.md, and docs/war-report.md.

中文

AI Land 是面向 HRAS 团队的 HR AI 社区平台,集成场景大全、AI 战报、课程、AI 大赛、应用推荐等模块。

技术栈

  • 框架: Next.js 16 (App Router)
  • UI: React 19 + Ant Design 6 + Tailwind CSS 4
  • 后端: Supabase (PostgreSQL + RLS)
  • 认证: 飞书 OAuth
  • 部署: Vercel

本地开发

npm install
npm run dev

访问 http://localhost:3000

环境变量

变量 说明
NEXT_PUBLIC_SUPABASE_URL Supabase 项目 URL
NEXT_PUBLIC_SUPABASE_ANON_KEY Supabase anon key
SUPABASE_SERVICE_ROLE_KEY Supabase service role key,供 API 路由使用

飞书应用凭证存于 feishu_apps 表,并通过 admin UI 管理,不放在环境变量中。详见 CONTRIBUTING.md

项目结构

src/
├── app/              # Next.js App Router 页面
│   ├── api/          # API 路由
│   ├── admin/        # 管理后台
│   ├── wish-pool/    # 场景大全(三 Tab 视图)
│   ├── war-report/   # 管理员专属 AI 应用推广战报
│   ├── resources/    # 课程与资源(课程 + 工具)
│   ├── competitions/ # AI 大赛
│   └── page.tsx      # 首页(居中 Hero + 5 项 glass 指标带)
├── components/       # 共享组件:Navigation、ChoDashboard、资源卡片、EntryCard 等
└── lib/              # 工具函数:Supabase、飞书、认证、bitable 映射、资源字段归一化、导出图片样式

权限与管理后台

  • 管理后台权限使用轻量 RBAC:运行时读取 roles / user_rolesrole_permissions 是历史遗留表不再读取;权限点和角色规则在 src/lib/permissions/registry.ts 声明。
  • 管理后台入口是顶部导航里的管理员专属模块,当前菜单只包含:内容审核、用户权限、字段映射配置、飞书应用配置、操作日志。
  • /war-report 是管理员专属主导航模块,数据 API 为 GET /api/admin/war-report;页面上的飞书同步按钮复用 POST /api/admin/competition-sync,继续由 competition.sync 权限控制。
  • 用户权限入口为 /admin/roles,包含 角色列表用户授权 两个视图。角色权限在代码规则中维护,不再通过后台权限矩阵配置。
  • /admin/users 保留为兼容跳转,自动重定向到 /admin/roles?tab=users
  • admin 角色默认拥有全部权限;评委角色授权是历史流程,用户授权页不再展示或维护。
  • user 角色默认拥有 case.submitresource.submitresource.generate-feishu-card

资源与飞书卡片

  • 工具页支持把单个工具生成飞书可视化卡片并发送给当前登录用户本人。
  • API:POST /api/resources/card-to-me,body 为 { "resourceId": "<apps.id>" }
  • 服务端按 feishu_user_id cookie 查询当前用户的 feishu_open_id,使用 receive_id_type=open_id 发送,不会群发到群聊。
  • 卡片模板复用 src/lib/feishu-cards.ts#buildResourceCard,工具列表入口为 /resources?tab=apps

场景快照同步

  • 场景大全、AI 大赛进展和成效看板页面默认读取 Supabase 的 competition_submissions 快照,前台页面刷新不直接拉取飞书。
  • AI 战报也读取同一份 competition_submissions 快照,默认展示全部评审周期,按团队聚合业务表现;组委会运营层的人工维护事项保存在 war_report_manual_sections
  • 飞书多维表全量同步统一收口到管理后台字段映射页:/admin/bitable-field-map -> 全量同步飞书场景数据 -> POST /api/admin/competition-sync,由 competition.sync 权限控制。
  • Vercel 定时任务 GET /api/cron/sync-competitions 复用同一套同步服务。
  • 同步状态通过 074_competition_sync_status.sql 写入 platform_settings,记录最近尝试时间、最近成功同步时间、状态,以及成功/变化等结果数量;前台展示文案为「数据最近更新时间:...」。
  • 同步审计通过 075_operation_logs.sql 写入 operation_logs:后台手动同步记录 source=admin、操作者和结果,Vercel cron 记录 source=cron,后台 /admin/operation-logs 为查看入口。
  • 同步逻辑会保留已有评审记录关联的历史方案 ID,把最新飞书字段写回该 ID,并清理重复影子行。
  • 场景大全列表的落地计划字段依赖 073_competition_landing_plan_fields.sql 写入 competition_submissions:进展备注、计划启动日期、试点上线日期、推广上线日期、全面上线日期、业务对接人、AI 对接人。
  • 业务/AI 对接人详情依赖 076_competition_owner_profiles.sqlbiz_owner_profilesai_owner_profiles 快照列。前台统一用 src/components/PersonContactDisplay.tsx 展示姓名、飞书头像、工号/岗位 hover 信息和飞书跳转;部门不展示,缺失工号/岗位时显示「无权限/暂无资料」。

详细规范

CONTRIBUTING.mdAGENTS.mddocs/operator-runbook.mddocs/war-report.md

About

No description or website provided.

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors