Skip to content

[pull] main from civitai:main #363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import packageJson from './package.json' assert { type: 'json' };
const isProd = process.env.NODE_ENV === 'production';
const isDev = process.env.NODE_ENV === 'development';
const analyze = process.env.ANALYZE === 'true';
const shouldOptimizeImports = (isDev && analyze) || isProd
const shouldOptimizeImports = (isDev && analyze) || isProd;

const withBundleAnalyzer = bundlAnalyzer({
enabled: analyze,
Expand Down Expand Up @@ -68,10 +68,7 @@ export default defineNextConfig(
experimental: {
// scrollRestoration: true,
largePageDataBytes: 512 * 100000,
optimizePackageImports: [
'@civitai/client',
'./srs/libs/form'
],
optimizePackageImports: ['@civitai/client', './srs/libs/form'],
},
headers: async () => {
// Add X-Robots-Tag header to all pages matching /sitemap.xml and /sitemap-models.xml /sitemap-articles.xml, etc
Expand Down Expand Up @@ -231,6 +228,11 @@ export default defineNextConfig(
destination: '/events/holiday2023',
permanent: true,
},
{
source: '/air/confirm',
destination: '/studio/confirm',
permanent: true,
},
{
source: '/blocked-by-octoml',
destination: '/articles/3307',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "model-share",
"version": "5.0.518",
"version": "5.0.519",
"private": true,
"scripts": {
"start": "next start",
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoginRedirect/LoginRedirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function LoginRedirect({ children, reason, returnUrl }: Props) {
}

function handleClick(e: React.MouseEvent) {
if (running) closeTour({ reset: true });
if (running) closeTour();
requireLogin({
uiEvent: e,
reason,
Expand Down
11 changes: 11 additions & 0 deletions src/components/Tours/ToursProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ export function ToursProvider({ children }: { children: React.ReactNode }) {
// Set initial step based on user settings
const currentStep = currentTourData?.currentStep ?? 0;
setState((old) => ({ ...old, currentStep, returnUrl: path }));

// handle initialization of the active tour
switch (tourKey) {
case 'content-generation':
case 'remix-content-generation':
generationPanel.setView('generate');
generationPanel.open();
break;
default:
break;
}
}, [isInitialLoading, tourKey]);

const completed = currentTourData?.completed;
Expand Down
16 changes: 13 additions & 3 deletions src/pages/moderator/review/training-data/[versionId].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Loader, Popover, Text } from '@mantine/core';
import { IconInfoSquareRounded } from '@tabler/icons-react';
import { Button, Loader, Popover, Text, ActionIcon } from '@mantine/core';
import { IconInfoSquareRounded, IconExternalLink } from '@tabler/icons-react';
import { useRouter } from 'next/router';
import React, { useEffect, useRef, useState } from 'react';
import { Page } from '~/components/AppLayout/Page';
Expand All @@ -14,6 +14,7 @@ import { fetchBlob } from '~/utils/file-utils';
import { getJSZip } from '~/utils/lazy';
import { unzipTrainingData } from '~/utils/training';
import { trpc } from '~/utils/trpc';
import { NextLink } from '~/components/NextLink/NextLink';

function ReviewTrainingData() {
const router = useRouter();
Expand Down Expand Up @@ -104,9 +105,18 @@ function ReviewTrainingData() {
) : (
<>
<div className="container flex max-w-lg justify-end gap-3 p-3">
<ActionIcon
component={NextLink}
href={`/models/${data?.modelId}?modelVersionId=${versionId}`}
target="_blank"
>
<IconExternalLink />
</ActionIcon>
<Popover width={300} withArrow withinPortal shadow="sm">
<Popover.Target>
<IconInfoSquareRounded size={16} style={{ cursor: 'pointer', opacity: 0.7 }} />
<ActionIcon>
<IconInfoSquareRounded />
</ActionIcon>
</Popover.Target>
<Popover.Dropdown>
<DescriptionTable items={details} />
Expand Down
10 changes: 5 additions & 5 deletions src/pages/air/confirm.tsx → src/pages/studio/confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function Confirm() {
const confirmEmail = (
<Container size="xs">
<Stack>
<Text size="xl" weight={500} ta="center">{`Thanks for being a Civitai Supporter ❤️`}</Text>
<Text size="xl" weight={500} ta="center">{`Thanks for being a Civitai Member ❤️`}</Text>
<Text>{`To complete your application, please enter the email that you used when you applied for the Artist in Residence program`}</Text>
<Stack spacing={5}>
<TextInput
Expand Down Expand Up @@ -93,11 +93,11 @@ export default function Confirm() {
</Alert>
<Button
component="a"
href="https://air.civitai.com/application-success"
href="https://studio.civitai.com/cohort-application/success"
rightIcon={<IconArrowRight />}
size="lg"
>
Return to AiR Application
Return to Studio Cohort Application
</Button>
</Stack>
</Container>
Expand All @@ -106,7 +106,7 @@ export default function Confirm() {
const subscriptionsLoading = subscriptionLoading || productsLoading;
const notMember = (
<Stack>
<Text size="xl" weight={500} ta="center">{`Become a Supporter today!`}</Text>
<Text size="xl" weight={500} ta="center">{`Become a Member today!`}</Text>
{subscriptionsLoading ? (
<Loader />
) : (
Expand All @@ -127,7 +127,7 @@ export default function Confirm() {
return (
<Container>
<Title order={1} align="center" mb="lg">
AiR Supporter Confirmation
Studio Member Confirmation
</Title>
{!isMember ? notMember : isConfirmed ? confirmed : confirmEmail}
</Container>
Expand Down
3 changes: 2 additions & 1 deletion src/server/controllers/model-version.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ export async function getModelVersionForTrainingReviewHandler({ input }: { input
const version = await getVersionById({
...input,
select: {
model: { select: { user: { select: userWithCosmeticsSelect } } },
model: { select: { id: true, user: { select: userWithCosmeticsSelect } } },
files: {
select: {
metadata: true,
Expand All @@ -745,6 +745,7 @@ export async function getModelVersionForTrainingReviewHandler({ input }: { input
?.trainingResults as TrainingResultsV2;

return {
modelId: version.model.id,
user: version.model.user,
workflowId: trainingResults?.workflowId,
jobId: trainingResults?.jobId as string | null,
Expand Down
1 change: 1 addition & 0 deletions src/server/redis/caches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ export const modelVersionAccessCache = createCachedObject<ModelVersionAccessCach
key: REDIS_KEYS.CACHES.ENTITY_AVAILABILITY.MODEL_VERSIONS,
idKey: 'entityId',
ttl: CacheTTL.day,
cacheNotFound: false,
dontCacheFn: (data) => {
// We only wanna cache public models. Otherwise, we better confirm every time. It's a safer bet.
// Also, only cache it if it's been published for more than an hour.
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/feature-flags.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const featureFlags = createFeatureFlags({
safety: ['public'],
csamReports: ['granted'],
appealReports: ['granted'],
reviewTrainingData: ['granted'],
reviewTrainingData: isDev ? ['mod'] : ['granted'],
clubs: ['mod'],
createClubs: ['mod', 'granted'],
moderateTags: ['granted'],
Expand Down