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

Post Intent #1168

Merged
merged 15 commits into from
May 14, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "Tool"
ADD COLUMN "domain" TEXT;
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,6 @@ model ChatMessage {
chatId Int
content String
contentType ChatMessageType @default(Markdown)
// isSystemMessage Boolean @default(false)
referenceMessageId Int?
editedAt DateTime?
// TODO deletedAt DateTime
Expand Down Expand Up @@ -2998,6 +2997,7 @@ model Tool {
createdAt DateTime @default(now())
enabled Boolean @default(true)
type ToolType
domain String?
imageTools ImageTool[]
}

Expand Down
8 changes: 7 additions & 1 deletion src/components/Image/ImageDropzone/ImageDropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ export function ImageDropzone({

const handleDropCapture = async (e: DragEvent) => {
const url = e.dataTransfer.getData('text/uri-list');
if (!url.startsWith('https://orchestration.civitai.com')) return;
if (
!(
url.startsWith('https://orchestration.civitai.com') ||
url.startsWith('https://orchestration-stage.civitai.com')
)
)
return;
const blob = await fetchBlob(url);
if (!blob) return;
const file = new File([blob], url.substring(url.lastIndexOf('/')), { type: blob.type });
Expand Down
11 changes: 7 additions & 4 deletions src/components/Image/ImageDropzone/MediaDropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { DragEvent } from 'react';
import { constants } from '~/server/common/constants';
import { IMAGE_MIME_TYPE, MIME_TYPES, VIDEO_MIME_TYPE } from '~/server/common/mime-types';
import { fetchBlob } from '~/utils/file-utils';
import { formatBytes } from '~/utils/number-helpers';
import { PreprocessFileReturnType } from '~/utils/media-preprocessors';
import { MediaUploadOnCompleteProps, useMediaUpload } from '~/hooks/useMediaUpload';

const MAX_IMAGE_SIZE = constants.mediaUpload.maxImageFileSize;

Expand Down Expand Up @@ -39,7 +36,13 @@ export function MediaDropzone({
// #region [handle drop]
const handleDropCapture = async (e: DragEvent) => {
const url = e.dataTransfer.getData('text/uri-list');
if (!url.startsWith('https://orchestration.civitai.com')) return;
if (
!(
url.startsWith('https://orchestration.civitai.com') ||
url.startsWith('https://orchestration-stage.civitai.com')
)
)
return;
const blob = await fetchBlob(url);
if (!blob) return;
const file = new File([blob], url.substring(url.lastIndexOf('/')), { type: blob.type });
Expand Down
Loading