feat(ai): Site/Org/Repo AI settings UI and database schema #364

Open
opened 2026-05-31 16:28:33 +00:00 by jmiller · 0 comments
Owner

Summary

Add AI configuration pages at site admin, org, and repo levels with corresponding database schema.

Parent Issue

#359

Settings Locations

Site Administration > AI

  • Default Anthropic API key (platform-wide fallback)
  • Default model selection
  • Global rate limits (requests/hour, tokens/month)
  • Enable/disable AI features site-wide
  • Usage dashboard (all orgs)

Org Settings > AI Integration

  • Org API key (overrides site default, stored encrypted)
  • Model selection per org (Opus/Sonnet/Haiku)
  • Rate limit per org
  • Enable/disable per org
  • Team membership view for mokogitea-claude[bot]
  • Usage/cost dashboard for org

Repo Settings > AI Assistant

  • Enable/disable for this repo
  • Review strictness: minimal / standard / thorough
  • Auto-review on PR open: yes/no
  • File ignore patterns (glob)
  • Link to .mokogitea/CLAUDE.md for editing instructions

Database Schema

ai_org_setting: org_id, enabled, api_key_encrypted, model, rate_limit_requests, rate_limit_tokens_month, created_unix, updated_unix

ai_repo_setting: repo_id, enabled, auto_review, strictness, ignore_patterns, created_unix, updated_unix

ai_usage_log: id, org_id, repo_id, triggered_by_id, action_type (review/chat/agent), model, tokens_input, tokens_output, duration_ms, created_unix

Implementation

  • models/ai/setting.go
  • models/ai/usage.go
  • routers/web/admin/ai.go
  • routers/web/org/setting/ai.go
  • routers/web/repo/setting/ai.go
  • templates/admin/ai/
  • templates/org/settings/ai.tmpl
  • templates/repo/settings/ai.tmpl

Dependencies

  • #362 (mokogitea-claude[bot] user)
## Summary Add AI configuration pages at site admin, org, and repo levels with corresponding database schema. ## Parent Issue #359 ## Settings Locations ### Site Administration > AI - Default Anthropic API key (platform-wide fallback) - Default model selection - Global rate limits (requests/hour, tokens/month) - Enable/disable AI features site-wide - Usage dashboard (all orgs) ### Org Settings > AI Integration - Org API key (overrides site default, stored encrypted) - Model selection per org (Opus/Sonnet/Haiku) - Rate limit per org - Enable/disable per org - Team membership view for mokogitea-claude[bot] - Usage/cost dashboard for org ### Repo Settings > AI Assistant - Enable/disable for this repo - Review strictness: minimal / standard / thorough - Auto-review on PR open: yes/no - File ignore patterns (glob) - Link to .mokogitea/CLAUDE.md for editing instructions ## Database Schema ai_org_setting: org_id, enabled, api_key_encrypted, model, rate_limit_requests, rate_limit_tokens_month, created_unix, updated_unix ai_repo_setting: repo_id, enabled, auto_review, strictness, ignore_patterns, created_unix, updated_unix ai_usage_log: id, org_id, repo_id, triggered_by_id, action_type (review/chat/agent), model, tokens_input, tokens_output, duration_ms, created_unix ## Implementation - models/ai/setting.go - models/ai/usage.go - routers/web/admin/ai.go - routers/web/org/setting/ai.go - routers/web/repo/setting/ai.go - templates/admin/ai/ - templates/org/settings/ai.tmpl - templates/repo/settings/ai.tmpl ## Dependencies - #362 (mokogitea-claude[bot] user)
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoGitea#364