Commit Graph

47 Commits

Author SHA1 Message Date
Justin Maier 64cb925bd0 feat(contests): gate entries on allowed base models (#3425)
* feat(contests): gate model entries on allowed base models

Contest collections can now declare `metadata.baseModels`; a model entry
only qualifies if it has a live version on one of them. Empty/absent means
no gating, so existing contests are unaffected.

The date rule and the base-model rule are satisfied by a SINGLE version
predicate rather than two independent checks — otherwise a two-year-old
SDXL LoRA could qualify by pairing an old allowed-base-model version with
a throwaway version pushed during the submission window. The model block
also moved out of `if (metadata.submissionStartDate)` so base-model gating
still applies to windowless contests.

Moderators are not exempt, matching the neighbouring date/window checks
(the eligibility family) rather than `maxItemsPerUser` (an anti-spam quota
mods legitimately bypass when curating). A mod who wants an exception edits
the contest's allowed base models instead of side-stepping the rule.

* fix(contests): harden base-model gating and lock the where shape

Review follow-ups on the base-model gate:

- Guard the model-row date filter on submissionStartDate being set. It
  was unreachable with undefined today, but Prisma's lt is optional so
  undefined type-checks, and loosening the outer guard later would
  silently drop the filter and let every model through.
- Validate metadata.baseModels against the known base models. The value
  has to match ModelVersion.baseModel exactly; an unrecognized one like
  'FluxKrea' matched no version and locked the contest to zero entries
  while reporting a plausible-looking error.
- Spell out in the field description that with a submission window the
  same version must satisfy both rules.

Adds tests covering the where shape, most importantly that the
no-gating path is unchanged -- a live contest with accepted entries
depends on it -- and that the date and base-model conditions stay in
one modelVersions.none object.

Draft versions still qualify. Requiring Published would re-block the 69
in-window draft Krea 2 versions the preceding commits deliberately
unblocked, and entries pass through moderator review anyway.

* fix(contests): source base models from basemodel.constants

The gate read the legacy base-model.constants.ts, whose list stops
short of current ecosystems -- 'Krea 2' is absent from it, so the very
contest this was built for could not be configured, and the zod refine
would have rejected the value outright.

basemodel.constants.ts is the live source (95 importers vs 4, and it
carries a compatibility layer explicitly marked as the migration target
for the old file). Points the schema and the picker at it, moves the
two remaining importers over, and deletes the legacy file.

The picker now offers every base model rather than the non-hidden ones.
Hidden means "not offered on upload", which is a different question
from whether a contest can target it -- SD 3.5, SDXL Turbo, Kling and
Sora 2 are all populated and were unselectable. The field is
moderator-only.

* docs: drop references to the removed base-model.constants

Both docs described the legacy module as current. The plan doc keeps
its original snippets with a note, since rewriting a historical plan
would misrepresent what was proposed.
2026-07-28 13:48:04 -06:00
Briant Diehl 343c3c9bb4 fix(build): update prisma/build paths for the db-schema package move
The Prisma schema/migrations moved to packages/civitai-db-schema; point the build and migration tooling at the new path.

- Dockerfile: workspace-aware deps layer (copy pnpm-workspace.yaml + packages/*), schema paths -> packages/civitai-db-schema/prisma
- prisma-migrate-with-views-workaround / mark-migration-applied / prepare-programmability / local-dev/run_migrations: updated hardcoded prisma/ paths

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 15:34:21 -06:00
Justin Maier 9d0ee49644 Optimize collection image fetching 2025-11-21 17:27:21 -07:00
Briant Diehl f9239dd8e6 reference lazy dayjs 2025-08-22 13:57:45 -06:00
Brett Woodward 8ab42f4981 logical rep setup 2025-08-12 13:20:21 -04:00
Briant Diehl 9284836a9c removed baseModels from server constants file 2025-08-08 17:59:55 -06:00
Briant Diehl 6c82da6289 update tip-tap packages 2025-07-15 11:45:04 -06:00
Brett Woodward bfaf5df6aa handling clavata nsfw only 2025-07-02 14:38:41 -04:00
Brett Woodward fcbf96817b baseModelType non-nullable, fix tag service 2025-07-02 13:46:12 -04:00
Brett Woodward 06ad5e3c5f add bounty image connection to seed data 2025-06-12 16:57:08 -04:00
Brett Woodward d05c773f12 fix report service return and adjust chat logic 2025-06-11 16:11:21 -04:00
Brett Woodward fe00e4d05c add bad words to seed data, add bounties and userprofiles 2025-06-11 15:06:37 -04:00
Brett Woodward 44b35718ed add chats to seed data 2025-06-10 10:34:43 -04:00
Brett Woodward e21ea7aa85 create new reportAutomated table, add ability to skip wordlists, add automated to report list, remove value from various tables, clear automated reports job 2025-06-09 15:50:08 -04:00
Brett Woodward f8e34fbbeb change redis key structure, words in redis 2025-06-08 11:31:29 -04:00
Brett Woodward ee5ae53fff wordlist and various fixes 2025-06-07 17:36:07 -04:00
Brett Woodward 479a957ae3 various gen_seed improvements, initial gen spec 2025-05-21 17:15:20 -04:00
Brett Woodward 51827aaf64 - stage deployment update
- hide auction titles that have bad words in them
- show tooltip on truncated titles
2025-05-15 15:23:29 -04:00
Brett Woodward 9bda23ae1b add sticky to changelog 2025-05-13 14:15:40 -04:00
Brett Woodward 49c64238f9 switch to trigram, allow title colors, use last seen local storage, put in header, case insensitive search 2025-05-12 14:32:11 -04:00
Brett Woodward b607356efc adding dummy data, fixing skip 2025-05-10 12:08:20 -04:00
Brett Woodward 927be2a0df initial changelog pushes 2025-05-09 09:32:26 -04:00
Brett Woodward ae060c75d4 virtualize auction cards 2025-05-06 14:42:30 -04:00
Brett Woodward 8b66090dac more sys-redis data for local dev 2025-05-05 11:09:29 -04:00
Brett Woodward 03466b0d0d adding misc auction 2025-04-15 14:31:30 -04:00
Brett Woodward 235f3e7226 some db drivebys, adding media type for training, videos have own section 2025-04-10 09:45:28 -04:00
Brett Woodward 3d77625675 some video training adjustments 2025-04-07 13:23:34 -04:00
Brett Woodward e6bea636e1 nothing to see here 2025-03-31 11:02:32 -04:00
Brett Woodward 242aa0eb8d - actually add coveredCheckpoint
- switch back verbiage to featured
- adjust homeblock links and metadata
- move popularity to description table
- add isfeatured filter for models
- only show bid button if available and published
- insert winners into covered checkpoints
2025-03-26 12:44:55 -04:00
Brett Woodward a8d87276f5 - add new homeblock for boosted models
- adjust auction to handle run/valid for days
- fix some seed script data
- adjust generate button to always show bid or create
- hide markup for popularity
- update the tour
- remove coveredCheckpointDetails
2025-03-24 15:59:25 -04:00
Manuel Emilio Urena 88a20e54a4 Updates post nsfw level function and leaderboard to set correct nsfw level (#1658) 2025-03-19 17:16:35 -04:00
Brett Woodward a007b36511 promoted -> boosted 2025-03-07 13:35:43 -05:00
Brett Woodward 5aec2c84b3 renaming to promoted, fixing deleting bids not updating other positions, hide pop for non checkpoint, fix title not updating 2025-03-06 08:37:15 -05:00
Brett Woodward d12705dee4 hide bid position when we don't know it, fix mobile wrapping for auctions, adjust gotPosFromBid logic, introduce topics (not for auction itself yet), change popularity to query and topics, fix generation resource long name wrapping, change logic for advanced mode to only apply for generation, fix some WEIRD ass issues with circular imports for training stuff, fix user multiplier missing issue, hide auction behind mod flag, retry featured models looking back to the previous day, update auction job to use steps and notifications, fix recurring bids to use correct auction 2025-03-03 19:15:49 -05:00
Brett Woodward d945c84dd7 using multiple transactionIds, updating gen_seed for removal of user columns, adjusting logic in code for possible null transaction ID 2025-03-02 10:09:15 -05:00
Brett Woodward 28fdbb24ff - adjust normalize migration
- show resources like checkpoints
- blur nsfw model names
- fix delete bid setData
- fix top 3 featured style
- show mv popularity on model page
- add cache for popularity / isFeatured
- add pop/feat to model index
- fix additional price needed logic
- update civ client
- add a basic test
2025-03-01 13:22:08 -05:00
Brett Woodward b04b48c897 add data to seed, update migration, make featured default, fix meili filtering, improve featured display, adjust featured query, add auctin job 2025-02-28 13:55:36 -05:00
Brett Woodward eec709e36c all the auction things! 2025-02-26 16:54:08 -05:00
Brett Woodward 69ecd2c555 - add extra users to gen_seed
- add some test-ids
- add new log in provider in dev only for testing
- dont rate limit in dev
- remove testids from production builds
- add test npm scripts
- user auth utils
- setup script
- example tests
- playwright config
2025-02-07 11:06:01 -05:00
Brett Woodward d0571cab57 Merge remote-tracking branch 'origin/main' into feature/redis-split
# Conflicts:
#	src/libs/form/hooks/usePersistForm.ts
#	src/pages/api/generation/history/index.ts
#	src/pages/api/webhooks/run-jobs/[[...run]].ts
#	src/server/controllers/orchestrator.controller.ts
#	src/server/services/orchestrator/common.ts
2025-01-13 14:14:58 -05:00
Brett Woodward 5ca6ebfe51 all the redis things 2025-01-13 14:05:00 -05:00
Briant Diehl 8127aeed52 change env mjs files to ts files and update import statements 2025-01-10 11:47:47 -07:00
Brett Woodward 70b16cf6bb fixing some makefile stuff 2024-12-17 14:22:24 -05:00
Brett Woodward 1777d7c1ef fixing import issue 2024-12-17 11:32:21 -05:00
Brett Woodward c5398a6ec8 adding exceptions for container envs 2024-11-07 12:28:16 -05:00
manuelurenah 7e24d3739c Updates to create minio buckets and .env-example file 2024-11-05 11:22:09 -04:00
Brett Woodward 73dd207509 moving files, adding extra checks 2024-11-04 15:24:49 -05:00