feat: remove chat-style UI from generation workspace
This commit is contained in:
parent
7ce4d4cdc2
commit
3443dc01d3
@ -1689,6 +1689,7 @@ export function CanvasChatPanel({
|
|||||||
workflowContext = null,
|
workflowContext = null,
|
||||||
presentation = "panel",
|
presentation = "panel",
|
||||||
}: CanvasChatPanelProps) {
|
}: CanvasChatPanelProps) {
|
||||||
|
const isWorkspacePresentation = presentation === "workspace";
|
||||||
const { data: session } = useSession();
|
const { data: session } = useSession();
|
||||||
const [input, setInput] = useState("");
|
const [input, setInput] = useState("");
|
||||||
const [attachments, setAttachments] = useState<PickedObjectAttachment[]>([]);
|
const [attachments, setAttachments] = useState<PickedObjectAttachment[]>([]);
|
||||||
@ -2836,6 +2837,12 @@ export function CanvasChatPanel({
|
|||||||
setSelectedSkillTagId(null);
|
setSelectedSkillTagId(null);
|
||||||
}
|
}
|
||||||
}, [canvasSkillTags, selectedSkillTagId]);
|
}, [canvasSkillTags, selectedSkillTagId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isWorkspacePresentation) return;
|
||||||
|
if (!selectedSkillTagId) return;
|
||||||
|
setSelectedSkillTagId(null);
|
||||||
|
}, [isWorkspacePresentation, selectedSkillTagId]);
|
||||||
|
|
||||||
const VIDEO_PROVIDER_TYPES = new Set(["volcano-video", "doubao-video", "qianwen-video", "fal-video", "ruxa-video"]);
|
const VIDEO_PROVIDER_TYPES = new Set(["volcano-video", "doubao-video", "qianwen-video", "fal-video", "ruxa-video"]);
|
||||||
const visualModels = useMemo(() => {
|
const visualModels = useMemo(() => {
|
||||||
@ -7673,16 +7680,22 @@ export function CanvasChatPanel({
|
|||||||
input.trim() || attachments.length > 0 || (!isDetailGenerationMode && selectedSkillTag)
|
input.trim() || attachments.length > 0 || (!isDetailGenerationMode && selectedSkillTag)
|
||||||
);
|
);
|
||||||
const hasEnoughAgentUploads = !hasAgentUploadSlots || attachments.length >= agentRequiredUploadCount;
|
const hasEnoughAgentUploads = !hasAgentUploadSlots || attachments.length >= agentRequiredUploadCount;
|
||||||
const composerPlaceholder = isDetailGenerationMode
|
const composerPlaceholder = isWorkspacePresentation
|
||||||
? "可选补充:风格、情绪氛围、禁用元素、期望生成张数(如:生成8张)"
|
? isDetailGenerationMode
|
||||||
: activeComposerMode === "agent" && selectedAgentPreset?.type === "text"
|
? "可选补充:风格、情绪氛围、禁用元素、期望生成张数(如:生成8张)"
|
||||||
? "可上传图片做分析,也可直接输入文案需求"
|
: hasAgentUploadSlots
|
||||||
: hasAgentUploadSlots
|
? "可选补充本次生图要求,例如:高级感、暖灰色、近景特写、生成3张。"
|
||||||
? "请先上传产品图1、产品图2、模特图,再补充说明"
|
: "可选补充本次生成要求,例如:更高级、更生活化、暖调灯光。"
|
||||||
: selectedSkillTag?.placeholder?.trim() ||
|
: isDetailGenerationMode
|
||||||
(selectedSkillTag
|
? "可选补充:风格、情绪氛围、禁用元素、期望生成张数(如:生成8张)"
|
||||||
? `请输入「${selectedSkillTag.name}」相关需求`
|
: activeComposerMode === "agent" && selectedAgentPreset?.type === "text"
|
||||||
: canvasDynamicPlaceholder || "请输入你的设计需求,例如:绿色椅子 替换 Image");
|
? "可上传图片做分析,也可直接输入文案需求"
|
||||||
|
: hasAgentUploadSlots
|
||||||
|
? "请先上传产品图1、产品图2、模特图,再补充说明"
|
||||||
|
: selectedSkillTag?.placeholder?.trim() ||
|
||||||
|
(selectedSkillTag
|
||||||
|
? `请输入「${selectedSkillTag.name}」相关需求`
|
||||||
|
: canvasDynamicPlaceholder || "请输入你的设计需求,例如:绿色椅子 替换 Image");
|
||||||
const detailProductCount = DETAIL_PRODUCT_SLOT_INDEXES.filter((index) => Boolean(detailSlots[index]?.url)).length;
|
const detailProductCount = DETAIL_PRODUCT_SLOT_INDEXES.filter((index) => Boolean(detailSlots[index]?.url)).length;
|
||||||
const detailModelReady = DETAIL_MODEL_SLOT_INDEX >= 0 ? Boolean(detailSlots[DETAIL_MODEL_SLOT_INDEX]?.url) : false;
|
const detailModelReady = DETAIL_MODEL_SLOT_INDEX >= 0 ? Boolean(detailSlots[DETAIL_MODEL_SLOT_INDEX]?.url) : false;
|
||||||
const detailBundleCount = DETAIL_BUNDLE_SLOT_INDEXES.filter((index) => Boolean(detailSlots[index]?.url)).length;
|
const detailBundleCount = DETAIL_BUNDLE_SLOT_INDEXES.filter((index) => Boolean(detailSlots[index]?.url)).length;
|
||||||
@ -7798,6 +7811,16 @@ export function CanvasChatPanel({
|
|||||||
renderableVisibleMessages.length === 0 &&
|
renderableVisibleMessages.length === 0 &&
|
||||||
!isLoading &&
|
!isLoading &&
|
||||||
!shouldShowImageLoading;
|
!shouldShowImageLoading;
|
||||||
|
const workspaceEmptyTitle = !selectedAgentPresetId
|
||||||
|
? "请先在左侧选择生图模式"
|
||||||
|
: hasAgentUploadSlots && attachments.length < agentRequiredUploadCount
|
||||||
|
? `请先补齐图片槽位(${attachments.length}/${agentRequiredUploadCount})`
|
||||||
|
: "准备开始生成";
|
||||||
|
const workspaceEmptyDescription = !selectedAgentPresetId
|
||||||
|
? "选择生图模式后,这里会显示生成结果。"
|
||||||
|
: hasAgentUploadSlots && attachments.length < agentRequiredUploadCount
|
||||||
|
? "从左侧 SKU / SPU 获取图片,或在下方继续上传替换后,再点击开始生成。"
|
||||||
|
: "可在下方补充要求后点击开始生成,结果会显示在这里。";
|
||||||
|
|
||||||
const renderModelSelectContent = () => (
|
const renderModelSelectContent = () => (
|
||||||
<SelectContent className="w-[238px] max-h-[340px] overflow-hidden rounded-[18px] border border-[#cfd4dc] bg-[#f3f4f6]/90 p-1.5 shadow-[0_8px_20px_rgba(15,23,42,0.13)]">
|
<SelectContent className="w-[238px] max-h-[340px] overflow-hidden rounded-[18px] border border-[#cfd4dc] bg-[#f3f4f6]/90 p-1.5 shadow-[0_8px_20px_rgba(15,23,42,0.13)]">
|
||||||
@ -7884,7 +7907,6 @@ export function CanvasChatPanel({
|
|||||||
const fallbackTitle = String(projectTitle || "").trim();
|
const fallbackTitle = String(projectTitle || "").trim();
|
||||||
return fallbackTitle || "未命名画布";
|
return fallbackTitle || "未命名画布";
|
||||||
}, [activeSessionTitle, projectTitle]);
|
}, [activeSessionTitle, projectTitle]);
|
||||||
const isWorkspacePresentation = presentation === "workspace";
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -8042,88 +8064,124 @@ export function CanvasChatPanel({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="space-y-6 overflow-x-hidden pb-24 pr-1">
|
<div className="space-y-6 overflow-x-hidden pb-24 pr-1">
|
||||||
{!isDetailGenerationMode && renderableVisibleMessages.length === 0 && (
|
{!isDetailGenerationMode && renderableVisibleMessages.length === 0 ? (
|
||||||
<div className={cn("flex flex-col h-full", isDetailGenerationMode ? "pt-0" : "pt-4")}>
|
isWorkspacePresentation ? (
|
||||||
{/* Greeting */}
|
<div className="flex h-full min-h-[360px] items-center justify-center">
|
||||||
<div className={cn(isDetailGenerationMode ? "mb-4" : "mb-8")}>
|
<div className="w-full max-w-3xl rounded-[28px] border border-dashed border-[#d7dce5] bg-white/78 p-10 text-center shadow-sm backdrop-blur-sm dark:border-white/10 dark:bg-zinc-900/60">
|
||||||
<h1 className="mb-2 text-2xl font-bold">
|
<div className="mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-[#eef2ff] text-[#4f46e5] dark:bg-[#312e81]/40 dark:text-[#a5b4fc]">
|
||||||
<span>Hi</span>
|
<Sparkles className="h-6 w-6" />
|
||||||
{greetingUserName ? (
|
|
||||||
<>
|
|
||||||
<span>, </span>
|
|
||||||
<span className="text-blue-600">{greetingUserName}</span>
|
|
||||||
<span> {greetingPeriodText}</span>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<span> {greetingPeriodText}</span>
|
|
||||||
)}
|
|
||||||
</h1>
|
|
||||||
<p className="text-muted-foreground">
|
|
||||||
开始创作吧!
|
|
||||||
{Number.isFinite(totalGeneratedImages) ? (
|
|
||||||
<>
|
|
||||||
{" "}累计为你生成了{" "}
|
|
||||||
<span className="text-blue-600 font-semibold">
|
|
||||||
{totalGeneratedImages.toLocaleString()}
|
|
||||||
</span>{" "}
|
|
||||||
张图。
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{canvasSkillTags.length > 0 && (
|
|
||||||
<div className="mb-8 rounded-3xl border border-[#eceef2] bg-white/90 p-4">
|
|
||||||
<div className="mb-3 text-center">
|
|
||||||
<h3 className="text-[16px] font-semibold text-[#1f2937]">{canvasSkillTagsTitle}</h3>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-3 gap-2">
|
<div className="text-2xl font-semibold tracking-tight text-foreground">
|
||||||
{canvasSkillTags.map((tag) => {
|
{workspaceEmptyTitle}
|
||||||
const isActive = selectedSkillTag?.id === tag.id;
|
</div>
|
||||||
const TagIcon = getCanvasSkillIconComponent(tag.iconName);
|
<div className="mt-3 text-sm leading-6 text-muted-foreground">
|
||||||
return (
|
{workspaceEmptyDescription}
|
||||||
<button
|
</div>
|
||||||
key={tag.id}
|
{attachments.length > 0 ? (
|
||||||
type="button"
|
<div className="mt-6 flex flex-wrap justify-center gap-2">
|
||||||
onClick={() => {
|
{attachments.map((attachment, index) => (
|
||||||
setSelectedSkillTagId(tag.id);
|
<div
|
||||||
const editor = textareaRef.current as HTMLDivElement | null;
|
key={`${attachment.url}-${index}`}
|
||||||
editor?.focus();
|
className="overflow-hidden rounded-2xl border bg-white shadow-sm dark:bg-zinc-900"
|
||||||
}}
|
|
||||||
className={cn(
|
|
||||||
"inline-flex min-w-0 items-center justify-center gap-1.5 rounded-2xl border px-2 py-1.5 text-[13px] font-medium transition-colors",
|
|
||||||
isActive
|
|
||||||
? "border-[#6d7fff] bg-[#eef1ff] text-[#3341a9]"
|
|
||||||
: "border-[#e4e7ec] bg-white text-[#30343b] hover:border-[#d6dae3] hover:bg-[#fafbfc]"
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{tag.iconUrl ? (
|
<img
|
||||||
<img
|
src={buildPreviewImageUrl(attachment.url, 160)}
|
||||||
src={buildPreviewImageUrl(tag.iconUrl, 48)}
|
alt={attachment.name || `素材${index + 1}`}
|
||||||
alt={tag.name}
|
className="h-20 w-20 object-cover"
|
||||||
className="h-3.5 w-3.5 rounded-sm object-cover"
|
loading="lazy"
|
||||||
loading="lazy"
|
decoding="async"
|
||||||
decoding="async"
|
onError={(event) => {
|
||||||
onError={(event) => {
|
if (event.currentTarget.src !== attachment.url) {
|
||||||
if (event.currentTarget.src !== tag.iconUrl) {
|
event.currentTarget.src = attachment.url;
|
||||||
event.currentTarget.src = tag.iconUrl || "";
|
}
|
||||||
}
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
</div>
|
||||||
) : (
|
))}
|
||||||
<TagIcon className="h-3.5 w-3.5 text-current opacity-70" />
|
</div>
|
||||||
)}
|
) : null}
|
||||||
<span className="truncate">{tag.name}</span>
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
|
) : (
|
||||||
{/* Refresh - Removed */}
|
<div className={cn("flex flex-col h-full", isDetailGenerationMode ? "pt-0" : "pt-4")}>
|
||||||
</div>
|
<div className={cn(isDetailGenerationMode ? "mb-4" : "mb-8")}>
|
||||||
)}
|
<h1 className="mb-2 text-2xl font-bold">
|
||||||
|
<span>Hi</span>
|
||||||
|
{greetingUserName ? (
|
||||||
|
<>
|
||||||
|
<span>, </span>
|
||||||
|
<span className="text-blue-600">{greetingUserName}</span>
|
||||||
|
<span> {greetingPeriodText}</span>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<span> {greetingPeriodText}</span>
|
||||||
|
)}
|
||||||
|
</h1>
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
开始创作吧!
|
||||||
|
{Number.isFinite(totalGeneratedImages) ? (
|
||||||
|
<>
|
||||||
|
{" "}累计为你生成了{" "}
|
||||||
|
<span className="text-blue-600 font-semibold">
|
||||||
|
{totalGeneratedImages.toLocaleString()}
|
||||||
|
</span>{" "}
|
||||||
|
张图。
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{canvasSkillTags.length > 0 && (
|
||||||
|
<div className="mb-8 rounded-3xl border border-[#eceef2] bg-white/90 p-4">
|
||||||
|
<div className="mb-3 text-center">
|
||||||
|
<h3 className="text-[16px] font-semibold text-[#1f2937]">{canvasSkillTagsTitle}</h3>
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-3 gap-2">
|
||||||
|
{canvasSkillTags.map((tag) => {
|
||||||
|
const isActive = selectedSkillTag?.id === tag.id;
|
||||||
|
const TagIcon = getCanvasSkillIconComponent(tag.iconName);
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={tag.id}
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedSkillTagId(tag.id);
|
||||||
|
const editor = textareaRef.current as HTMLDivElement | null;
|
||||||
|
editor?.focus();
|
||||||
|
}}
|
||||||
|
className={cn(
|
||||||
|
"inline-flex min-w-0 items-center justify-center gap-1.5 rounded-2xl border px-2 py-1.5 text-[13px] font-medium transition-colors",
|
||||||
|
isActive
|
||||||
|
? "border-[#6d7fff] bg-[#eef1ff] text-[#3341a9]"
|
||||||
|
: "border-[#e4e7ec] bg-white text-[#30343b] hover:border-[#d6dae3] hover:bg-[#fafbfc]"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{tag.iconUrl ? (
|
||||||
|
<img
|
||||||
|
src={buildPreviewImageUrl(tag.iconUrl, 48)}
|
||||||
|
alt={tag.name}
|
||||||
|
className="h-3.5 w-3.5 rounded-sm object-cover"
|
||||||
|
loading="lazy"
|
||||||
|
decoding="async"
|
||||||
|
onError={(event) => {
|
||||||
|
if (event.currentTarget.src !== tag.iconUrl) {
|
||||||
|
event.currentTarget.src = tag.iconUrl || "";
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<TagIcon className="h-3.5 w-3.5 text-current opacity-70" />
|
||||||
|
)}
|
||||||
|
<span className="truncate">{tag.name}</span>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
) : null}
|
||||||
|
|
||||||
{renderableVisibleMessages.map((message, index) => {
|
{renderableVisibleMessages.map((message, index) => {
|
||||||
const assistantTextParts = message.role === "assistant"
|
const assistantTextParts = message.role === "assistant"
|
||||||
@ -8196,6 +8254,12 @@ export function CanvasChatPanel({
|
|||||||
(vote) => vote.messageId === message.id
|
(vote) => vote.messageId === message.id
|
||||||
);
|
);
|
||||||
const isVotingCurrentMessage = votingMessageId === message.id;
|
const isVotingCurrentMessage = votingMessageId === message.id;
|
||||||
|
|
||||||
|
if (isWorkspacePresentation) {
|
||||||
|
if (message.role !== "assistant" || !hasAssistantMedia) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={message.id} className="space-y-3">
|
<div key={message.id} className="space-y-3">
|
||||||
@ -8644,7 +8708,7 @@ export function CanvasChatPanel({
|
|||||||
document.body
|
document.body
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{shouldShowCanvasBanner ? (
|
{!isWorkspacePresentation && shouldShowCanvasBanner ? (
|
||||||
<div className="px-4 pb-2">
|
<div className="px-4 pb-2">
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
@ -8681,6 +8745,14 @@ export function CanvasChatPanel({
|
|||||||
className="relative flex flex-col bg-card rounded-3xl border transition-all duration-200 focus-within:border-primary/50 focus-within:bg-background"
|
className="relative flex flex-col bg-card rounded-3xl border transition-all duration-200 focus-within:border-primary/50 focus-within:bg-background"
|
||||||
data-canvas-chat-input-anchor="true"
|
data-canvas-chat-input-anchor="true"
|
||||||
>
|
>
|
||||||
|
{isWorkspacePresentation && !isDetailGenerationMode ? (
|
||||||
|
<div className="border-b px-5 py-3">
|
||||||
|
<div className="text-sm font-semibold text-foreground">补充要求</div>
|
||||||
|
<div className="mt-1 text-xs text-muted-foreground">
|
||||||
|
这里填写本次生图补充要求。图片槽位和生成结果都在当前工作台内完成,不再使用聊天对话方式。
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
{isDetailGenerationMode && (
|
{isDetailGenerationMode && (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
@ -9419,7 +9491,7 @@ export function CanvasChatPanel({
|
|||||||
isDetailGenerationMode ? "min-h-[72px]" : "min-h-[60px]"
|
isDetailGenerationMode ? "min-h-[72px]" : "min-h-[60px]"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{!isDetailGenerationMode && selectedSkillTag && (
|
{!isWorkspacePresentation && !isDetailGenerationMode && selectedSkillTag && (
|
||||||
<div className="mb-2 flex">
|
<div className="mb-2 flex">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@ -9466,7 +9538,7 @@ export function CanvasChatPanel({
|
|||||||
</div>
|
</div>
|
||||||
) : hasAgentUploadSlots ? (
|
) : hasAgentUploadSlots ? (
|
||||||
<div className="inline-flex items-center rounded-full bg-[#f4f5f7] px-3 py-1.5 text-xs text-[#5b6472]">
|
<div className="inline-flex items-center rounded-full bg-[#f4f5f7] px-3 py-1.5 text-xs text-[#5b6472]">
|
||||||
请上传产品图1、产品图2、模特图
|
{isWorkspacePresentation ? "请确认产品图1、产品图2、模特图槽位" : "请上传产品图1、产品图2、模特图"}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
@ -9714,92 +9786,94 @@ export function CanvasChatPanel({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<DropdownMenu>
|
{!isWorkspacePresentation ? (
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenu>
|
||||||
<Button
|
<DropdownMenuTrigger asChild>
|
||||||
type="button"
|
<Button
|
||||||
variant="ghost"
|
type="button"
|
||||||
className={cn(
|
variant="ghost"
|
||||||
"relative h-8 cursor-pointer rounded-full px-3 text-sm font-medium",
|
|
||||||
activeComposerMode === "video"
|
|
||||||
? "border border-blue-500 bg-blue-50 text-blue-600 hover:bg-blue-100"
|
|
||||||
: activeComposerMode === "detail"
|
|
||||||
? "border border-violet-500 bg-violet-50 text-violet-700 hover:bg-violet-100"
|
|
||||||
: activeComposerMode === "image"
|
|
||||||
? "border border-purple-500 bg-purple-50 text-purple-700 hover:bg-purple-100"
|
|
||||||
: "border border-[#9eb3ff] bg-white text-zinc-700 hover:bg-zinc-50"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<span className="flex items-center">
|
|
||||||
{activeComposerMode === "video" ? (
|
|
||||||
<Video className="mr-1 h-4 w-4" />
|
|
||||||
) : activeComposerMode === "detail" ? (
|
|
||||||
<LayoutGrid className="mr-1 h-4 w-4" />
|
|
||||||
) : activeComposerMode === "image" ? (
|
|
||||||
<ImagePlus className="mr-1 h-4 w-4" />
|
|
||||||
) : (
|
|
||||||
<Sparkles className="mr-1 h-4 w-4" />
|
|
||||||
)}
|
|
||||||
{activeModeLabel}
|
|
||||||
</span>
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent
|
|
||||||
align="start"
|
|
||||||
side="top"
|
|
||||||
sideOffset={10}
|
|
||||||
className="w-[156px] rounded-xl border border-[#d6d9df] bg-[#f4f5f7]/90 p-1.5 shadow-[0_8px_18px_rgba(15,23,42,0.14)]"
|
|
||||||
>
|
|
||||||
<DropdownMenuItem
|
|
||||||
onClick={() => handleSelectGenerationMode("agent")}
|
|
||||||
className={cn(
|
|
||||||
"h-8 cursor-pointer rounded-lg px-2 text-[13px] font-medium text-[#2e3238]",
|
|
||||||
activeComposerMode === "agent" ? "bg-white/80" : "hover:bg-white/70"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<Sparkles className="h-4 w-4" />
|
|
||||||
<span className="flex-1">Agent</span>
|
|
||||||
{activeComposerMode === "agent" ? <Check className="h-4 w-4 text-[#3b82f6]" /> : null}
|
|
||||||
</DropdownMenuItem>
|
|
||||||
{aiDetailGenerationEnabled ? (
|
|
||||||
<DropdownMenuItem
|
|
||||||
onClick={() => handleSelectGenerationMode("detail")}
|
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-8 cursor-pointer rounded-lg px-2 text-[13px] font-medium text-[#2e3238]",
|
"relative h-8 cursor-pointer rounded-full px-3 text-sm font-medium",
|
||||||
activeComposerMode === "detail" ? "bg-white/80" : "hover:bg-white/70"
|
activeComposerMode === "video"
|
||||||
|
? "border border-blue-500 bg-blue-50 text-blue-600 hover:bg-blue-100"
|
||||||
|
: activeComposerMode === "detail"
|
||||||
|
? "border border-violet-500 bg-violet-50 text-violet-700 hover:bg-violet-100"
|
||||||
|
: activeComposerMode === "image"
|
||||||
|
? "border border-purple-500 bg-purple-50 text-purple-700 hover:bg-purple-100"
|
||||||
|
: "border border-[#9eb3ff] bg-white text-zinc-700 hover:bg-zinc-50"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<LayoutGrid className="h-4 w-4" />
|
<span className="flex items-center">
|
||||||
<span className="flex-1">AI详情生成</span>
|
{activeComposerMode === "video" ? (
|
||||||
{activeComposerMode === "detail" ? <Check className="h-4 w-4 text-[#3b82f6]" /> : null}
|
<Video className="mr-1 h-4 w-4" />
|
||||||
|
) : activeComposerMode === "detail" ? (
|
||||||
|
<LayoutGrid className="mr-1 h-4 w-4" />
|
||||||
|
) : activeComposerMode === "image" ? (
|
||||||
|
<ImagePlus className="mr-1 h-4 w-4" />
|
||||||
|
) : (
|
||||||
|
<Sparkles className="mr-1 h-4 w-4" />
|
||||||
|
)}
|
||||||
|
{activeModeLabel}
|
||||||
|
</span>
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent
|
||||||
|
align="start"
|
||||||
|
side="top"
|
||||||
|
sideOffset={10}
|
||||||
|
className="w-[156px] rounded-xl border border-[#d6d9df] bg-[#f4f5f7]/90 p-1.5 shadow-[0_8px_18px_rgba(15,23,42,0.14)]"
|
||||||
|
>
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={() => handleSelectGenerationMode("agent")}
|
||||||
|
className={cn(
|
||||||
|
"h-8 cursor-pointer rounded-lg px-2 text-[13px] font-medium text-[#2e3238]",
|
||||||
|
activeComposerMode === "agent" ? "bg-white/80" : "hover:bg-white/70"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Sparkles className="h-4 w-4" />
|
||||||
|
<span className="flex-1">Agent</span>
|
||||||
|
{activeComposerMode === "agent" ? <Check className="h-4 w-4 text-[#3b82f6]" /> : null}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
) : null}
|
{aiDetailGenerationEnabled ? (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={() => handleSelectGenerationMode("image")}
|
onClick={() => handleSelectGenerationMode("detail")}
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-8 cursor-pointer rounded-lg px-2 text-[13px] font-medium text-[#2e3238]",
|
"h-8 cursor-pointer rounded-lg px-2 text-[13px] font-medium text-[#2e3238]",
|
||||||
activeComposerMode === "image" ? "bg-white/80" : "hover:bg-white/70"
|
activeComposerMode === "detail" ? "bg-white/80" : "hover:bg-white/70"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<ImagePlus className="h-4 w-4" />
|
<LayoutGrid className="h-4 w-4" />
|
||||||
<span className="flex-1">图像生成</span>
|
<span className="flex-1">AI详情生成</span>
|
||||||
{activeComposerMode === "image" ? <Check className="h-4 w-4 text-[#3b82f6]" /> : null}
|
{activeComposerMode === "detail" ? <Check className="h-4 w-4 text-[#3b82f6]" /> : null}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem
|
) : null}
|
||||||
onClick={() => handleSelectGenerationMode("video")}
|
<DropdownMenuItem
|
||||||
className={cn(
|
onClick={() => handleSelectGenerationMode("image")}
|
||||||
"h-8 cursor-pointer rounded-lg px-2 text-[13px] font-medium text-[#2e3238]",
|
className={cn(
|
||||||
activeComposerMode === "video" ? "bg-white/80" : "hover:bg-white/70"
|
"h-8 cursor-pointer rounded-lg px-2 text-[13px] font-medium text-[#2e3238]",
|
||||||
)}
|
activeComposerMode === "image" ? "bg-white/80" : "hover:bg-white/70"
|
||||||
>
|
)}
|
||||||
<Video className="h-4 w-4" />
|
>
|
||||||
<span className="flex-1">视频生成</span>
|
<ImagePlus className="h-4 w-4" />
|
||||||
{activeComposerMode === "video" ? <Check className="h-4 w-4 text-[#3b82f6]" /> : null}
|
<span className="flex-1">图像生成</span>
|
||||||
</DropdownMenuItem>
|
{activeComposerMode === "image" ? <Check className="h-4 w-4 text-[#3b82f6]" /> : null}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuItem>
|
||||||
</DropdownMenu>
|
<DropdownMenuItem
|
||||||
|
onClick={() => handleSelectGenerationMode("video")}
|
||||||
|
className={cn(
|
||||||
|
"h-8 cursor-pointer rounded-lg px-2 text-[13px] font-medium text-[#2e3238]",
|
||||||
|
activeComposerMode === "video" ? "bg-white/80" : "hover:bg-white/70"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Video className="h-4 w-4" />
|
||||||
|
<span className="flex-1">视频生成</span>
|
||||||
|
{activeComposerMode === "video" ? <Check className="h-4 w-4 text-[#3b82f6]" /> : null}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{!isDetailGenerationMode && (!isVideoModel || showVideoAttachmentButton) && (
|
{!isWorkspacePresentation && !isDetailGenerationMode && (!isVideoModel || showVideoAttachmentButton) && (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
@ -9841,7 +9915,7 @@ export function CanvasChatPanel({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-2 flex-shrink-0">
|
<div className="flex items-center gap-2 flex-shrink-0">
|
||||||
{activeComposerMode === "image" ? (
|
{!isWorkspacePresentation && activeComposerMode === "image" ? (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
@ -9859,7 +9933,7 @@ export function CanvasChatPanel({
|
|||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{activeComposerMode !== "detail" ? (
|
{!isWorkspacePresentation && activeComposerMode !== "detail" ? (
|
||||||
<Select
|
<Select
|
||||||
value={modelSelectValue}
|
value={modelSelectValue}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
@ -9897,9 +9971,11 @@ export function CanvasChatPanel({
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
size="icon"
|
size={isWorkspacePresentation ? "default" : "icon"}
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-8 w-8 rounded-full transition-all duration-200 flex-shrink-0",
|
isWorkspacePresentation
|
||||||
|
? "h-10 rounded-full px-4 transition-all duration-200 flex-shrink-0"
|
||||||
|
: "h-8 w-8 rounded-full transition-all duration-200 flex-shrink-0",
|
||||||
isDetailGenerationMode
|
isDetailGenerationMode
|
||||||
? canSend
|
? canSend
|
||||||
? "bg-gradient-to-r from-violet-600 to-fuchsia-600 text-white shadow-md hover:shadow-lg hover:opacity-90 dark:from-violet-500 dark:to-fuchsia-500"
|
? "bg-gradient-to-r from-violet-600 to-fuchsia-600 text-white shadow-md hover:shadow-lg hover:opacity-90 dark:from-violet-500 dark:to-fuchsia-500"
|
||||||
@ -9912,11 +9988,20 @@ export function CanvasChatPanel({
|
|||||||
disabled={isSubmitting || !canSend}
|
disabled={isSubmitting || !canSend}
|
||||||
>
|
>
|
||||||
{isSubmitting ? (
|
{isSubmitting ? (
|
||||||
<Loader2 className="h-4 w-4 animate-spin" />
|
<>
|
||||||
|
<Loader2 className="h-4 w-4 animate-spin" />
|
||||||
|
{isWorkspacePresentation ? <span className="ml-2">生成中</span> : null}
|
||||||
|
</>
|
||||||
) : isDetailGenerationMode ? (
|
) : isDetailGenerationMode ? (
|
||||||
<Sparkles className="h-4 w-4" />
|
<>
|
||||||
|
<Sparkles className="h-4 w-4" />
|
||||||
|
{isWorkspacePresentation ? <span className="ml-2">开始生成</span> : null}
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<ArrowUp className="h-4 w-4" />
|
<>
|
||||||
|
<ArrowUp className="h-4 w-4" />
|
||||||
|
{isWorkspacePresentation ? <span className="ml-2">开始生成</span> : null}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user