Skip to content
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

[pull] main from civitai:main #332

Merged
merged 12 commits into from
Feb 7, 2025
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "model-share",
"version": "5.0.464",
"version": "5.0.465",
"private": true,
"scripts": {
"start": "next start",
Expand Down Expand Up @@ -52,7 +52,7 @@
"@aws-sdk/lib-storage": "^3.490.0",
"@aws-sdk/s3-request-presigner": "^3.490.0",
"@axiomhq/axiom-node": "^0.12.0",
"@civitai/client": "^0.1.9-beta.19",
"@civitai/client": "^0.1.9-beta.20",
"@civitai/next-axiom": "^0.17.0",
"@clickhouse/client": "^0.2.2",
"@cloudamqp/amqp-client": "^2.1.1",
Expand Down
2 changes: 2 additions & 0 deletions src/components/ImageGeneration/GeneratedImageActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export function GeneratedImageActions({
const workflow = data?.find((x) => x.id === image.workflowId);
if (workflow) {
const step = workflow.steps.find((x) => x.name === image.stepName);
// TODO - handle resources
const resources = step?.resources?.map(({ id, strength }) => ({ id, strength }));
return { url: image.url, meta: step?.params };
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,11 @@ function ResourceSelectCard({
const { id } = version;

setLoading(true);
await fetchGenerationData({ type: 'modelVersion', id }).then((data) => {
await fetchGenerationData({
type: 'modelVersion',
id,
generation: selectSource !== 'generation' ? false : undefined,
}).then((data) => {
const resource = data.resources[0];
if (selectSource !== 'generation') {
onSelect({ ...resource, image });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,16 @@ function MinimaxImg2VidGenerationForm() {
}

function LightricksPromptDescription() {
const url = 'https://education.civitai.com/civitais-quickstart-guide-to-lightricks-ltxv/#prompting'
return <span>If you see poor results, please refer to the <Anchor href={url} target="_blank">prompt guide</Anchor></span>
const url =
'https://education.civitai.com/civitais-quickstart-guide-to-lightricks-ltxv/#prompting';
return (
<span>
If you see poor results, please refer to the{' '}
<Anchor href={url} target="_blank">
prompt guide
</Anchor>
</span>
);
}
function LightricksTxt2VidGenerationForm() {
return (
Expand Down Expand Up @@ -487,7 +495,7 @@ function LightricksTxt2VidGenerationForm() {
</div>
}
min={20}
max={30}
max={40}
reverse
/>
<InputSeed name="seed" label="Seed" />
Expand All @@ -498,7 +506,13 @@ function LightricksTxt2VidGenerationForm() {
function LightricksImg2VidGenerationForm() {
return (
<FormWrapper engine="lightricks">
<InputTextArea name="prompt" label="Prompt" placeholder="Your prompt goes here..." autosize description={LightricksPromptDescription()}/>
<InputTextArea
name="prompt"
label="Prompt"
placeholder="Your prompt goes here..."
autosize
description={LightricksPromptDescription()}
/>
<InputTextArea name="negativePrompt" label="Negative Prompt" autosize />
<div className="flex flex-col gap-0.5">
<Input.Label>Duration</Input.Label>
Expand Down Expand Up @@ -556,7 +570,7 @@ function LightricksImg2VidGenerationForm() {
</div>
}
min={20}
max={30}
max={40}
reverse
/>
<InputSeed name="seed" label="Seed" />
Expand Down
10 changes: 0 additions & 10 deletions src/components/Model/Infinite/ModelFiltersDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export function DumbModelFiltersDropdown({
(mergedFilters.earlyAccess ? 1 : 0) +
(mergedFilters.supportsGeneration ? 1 : 0) +
(mergedFilters.fromPlatform ? 1 : 0) +
(mergedFilters.archived ? 1 : 0) +
(mergedFilters.hidden ? 1 : 0) +
(mergedFilters.fileFormats?.length ?? 0) +
(mergedFilters.period && mergedFilters.period !== MetricTimeframe.AllTime ? 1 : 0);
Expand All @@ -118,7 +117,6 @@ export function DumbModelFiltersDropdown({
supportsGeneration: false,
followed: false,
hidden: undefined,
archived: undefined,
fileFormats: undefined,
fromPlatform: false,
period: MetricTimeframe.AllTime,
Expand All @@ -134,7 +132,6 @@ export function DumbModelFiltersDropdown({
supportsGeneration: undefined,
followed: undefined,
hidden: undefined,
archived: undefined,
fileFormats: undefined,
fromPlatform: undefined,
period: MetricTimeframe.AllTime,
Expand Down Expand Up @@ -331,13 +328,6 @@ export function DumbModelFiltersDropdown({
</Chip>
</>
)}
<Chip
checked={mergedFilters.archived}
onChange={(checked) => handleChange({ archived: checked })}
{...chipProps}
>
<span>Include Archived</span>
</Chip>
</Group>
</Stack>
{filterLength > 0 && (
Expand Down
18 changes: 9 additions & 9 deletions src/pages/api/admin/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ const test = [1183765, 164821];
export default WebhookEndpoint(async function (req: NextApiRequest, res: NextApiResponse) {
try {
const session = await getServerAuthSession({ req, res });
// const modelVersions = await getGenerationResourceData({
// ids: [...test, ...covered, ...notCovered],
// user: session?.user,
// });
const modelVersions = await getResourceData({
ids: [1182093],
user: session?.user,
});
// const modelVersions = await dbRead.$queryRaw`
// SELECT
// mv."id",
Expand Down Expand Up @@ -66,12 +66,12 @@ export default WebhookEndpoint(async function (req: NextApiRequest, res: NextApi
// WHERE mv.id IN (${Prisma.join([1325378])})
// `;

const thread = await getCommentsThreadDetails2({
entityId: 10936,
entityType: 'article',
});
// const thread = await getCommentsThreadDetails2({
// entityId: 10936,
// entityType: 'article',
// });

res.status(200).send(thread);
res.status(200).send(modelVersions);
} catch (e) {
console.log(e);
res.status(400).end();
Expand Down
49 changes: 23 additions & 26 deletions src/pages/models/[id]/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -768,32 +768,6 @@ export default function ModelDetailsV2({
>
Edit Model
</Menu.Item>
{!model.mode ? (
<>
<Menu.Item
icon={<IconArchive size={14} stroke={1.5} />}
onClick={() => handleChangeMode(ModelModifier.Archived)}
>
Archive
</Menu.Item>
{isModerator && (
<Menu.Item
icon={<IconCircleMinus size={14} stroke={1.5} />}
onClick={() => handleChangeMode(ModelModifier.TakenDown)}
>
Take Down
</Menu.Item>
)}
</>
) : model.mode === ModelModifier.Archived ||
(isModerator && model.mode === ModelModifier.TakenDown) ? (
<Menu.Item
icon={<IconReload size={14} stroke={1.5} />}
onClick={() => handleChangeMode(null)}
>
Bring Back
</Menu.Item>
) : null}
</>
)}
{features.collections && (
Expand Down Expand Up @@ -876,6 +850,29 @@ export default function ModelDetailsV2({
entityId={model.id}
key="toggle-searchable-menu-item"
/>
{!model.mode ? (
<>
<Menu.Item
icon={<IconArchive size={14} stroke={1.5} />}
onClick={() => handleChangeMode(ModelModifier.Archived)}
>
Archive
</Menu.Item>
<Menu.Item
icon={<IconCircleMinus size={14} stroke={1.5} />}
onClick={() => handleChangeMode(ModelModifier.TakenDown)}
>
Take Down
</Menu.Item>
</>
) : (
<Menu.Item
icon={<IconReload size={14} stroke={1.5} />}
onClick={() => handleChangeMode(null)}
>
Bring Back
</Menu.Item>
)}
</>
)}
</>
Expand Down
3 changes: 2 additions & 1 deletion src/server/db/db-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ type LaggingType =
| 'commentModel'
| 'resourceReview'
| 'post'
| 'postImages';
| 'postImages'
| 'article';

export async function getDbWithoutLag(type: LaggingType, id?: number) {
if (env.REPLICATION_LAG_DELAY <= 0 || !id) return dbRead;
Expand Down
4 changes: 3 additions & 1 deletion src/server/games/daily-challenge/daily-challenge.utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { mergeWith } from 'lodash-es';
import { z } from 'zod';
import { dbRead, dbWrite } from '~/server/db/client';
import { getDbWithoutLag } from '~/server/db/db-helpers';
import { redis, REDIS_KEYS, REDIS_SYS_KEYS, sysRedis } from '~/server/redis/client';

const challengeConfigSchema = z.object({
Expand Down Expand Up @@ -152,7 +153,8 @@ type DailyChallengeDetails = {
entryPrize: Prize;
};
export async function getChallengeDetails(articleId: number) {
const rows = await dbRead.$queryRaw<DailyChallengeDetails[]>`
const db = await getDbWithoutLag('article', articleId);
const rows = await db.$queryRaw<DailyChallengeDetails[]>`
SELECT
a."id" as "articleId",
(a.metadata->>'challengeType') as "type",
Expand Down
Loading