Allow entering agent mode without preset
This commit is contained in:
parent
1f864294c9
commit
a219397344
@ -3220,28 +3220,27 @@ export function CanvasChatPanel({
|
||||
const [composerModeOverride, setComposerModeOverride] = useState<
|
||||
"agent" | "image" | "video" | "detail" | null
|
||||
>(null);
|
||||
const activeComposerMode = composerModeOverride || computedComposerMode;
|
||||
const agentSelectableModels = useMemo(
|
||||
() => (agentEnabled ? [SMART_AUTO_MODEL, ...conversationOnlyModels] : conversationOnlyModels),
|
||||
[SMART_AUTO_MODEL, agentEnabled, conversationOnlyModels]
|
||||
);
|
||||
const selectableModels = useMemo(() => {
|
||||
if (isDetailGenerationMode) {
|
||||
if (activeComposerMode === "detail") {
|
||||
return [SMART_AUTO_MODEL];
|
||||
}
|
||||
if (isVideoModel) {
|
||||
if (activeComposerMode === "video") {
|
||||
return videoOnlyModels;
|
||||
}
|
||||
if (isAgentModel) {
|
||||
if (activeComposerMode === "agent") {
|
||||
return agentSelectableModels;
|
||||
}
|
||||
return imageOnlyModels;
|
||||
}, [
|
||||
SMART_AUTO_MODEL,
|
||||
activeComposerMode,
|
||||
agentSelectableModels,
|
||||
imageOnlyModels,
|
||||
isAgentModel,
|
||||
isDetailGenerationMode,
|
||||
isVideoModel,
|
||||
videoOnlyModels,
|
||||
]);
|
||||
const modelSelectValue = selectableModels.some((model) => model.id === selectedModelId)
|
||||
@ -3259,7 +3258,6 @@ export function CanvasChatPanel({
|
||||
if (videoParams.mode === "first-frame") return ["首帧"] as string[];
|
||||
return [] as string[];
|
||||
}, [isVideoModel, videoParams]);
|
||||
const activeComposerMode = composerModeOverride || computedComposerMode;
|
||||
const activeComposerModeRef = useRef(activeComposerMode);
|
||||
const agentUploadSlots = useMemo(() => {
|
||||
if (
|
||||
@ -3506,19 +3504,6 @@ export function CanvasChatPanel({
|
||||
activeComposerModeRef.current = activeComposerMode;
|
||||
}, [activeComposerMode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (composerModeOverride !== "agent") return;
|
||||
if (agentEnabled && hasSelectedAgentPreset) return;
|
||||
|
||||
activeComposerModeRef.current = computedComposerMode;
|
||||
setComposerModeOverride(null);
|
||||
}, [
|
||||
agentEnabled,
|
||||
composerModeOverride,
|
||||
computedComposerMode,
|
||||
hasSelectedAgentPreset,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedModelId && siteSettings) {
|
||||
const nextModelId = agentEnabled ? "auto" : firstImageModelId || firstVideoModelId || "";
|
||||
@ -3764,11 +3749,6 @@ export function CanvasChatPanel({
|
||||
if (!agentEnabled) {
|
||||
return;
|
||||
}
|
||||
if (!hasSelectedAgentPreset) {
|
||||
toast.error("请先选择生图模式后再使用 Agent 模式");
|
||||
activeComposerModeRef.current = computedComposerMode;
|
||||
return;
|
||||
}
|
||||
const preferredAgentModelId =
|
||||
allModels.find(
|
||||
(model) =>
|
||||
@ -8413,12 +8393,12 @@ export function CanvasChatPanel({
|
||||
!isLoading &&
|
||||
!shouldShowImageLoading;
|
||||
const workspaceEmptyTitle = !selectedAgentPresetId
|
||||
? "请先在左侧选择生图模式"
|
||||
? "请先在左侧选择智能体"
|
||||
: hasAgentUploadSlots && attachments.length < agentRequiredUploadCount
|
||||
? `请先补齐图片槽位(${attachments.length}/${agentRequiredUploadCount})`
|
||||
: "准备开始生成";
|
||||
const workspaceEmptyDescription = !selectedAgentPresetId
|
||||
? "选择生图模式后,这里会显示生成结果。"
|
||||
? "切换到 Agent 模式后,请先选择智能体,随后这里会显示生成结果。"
|
||||
: hasAgentUploadSlots && attachments.length < agentRequiredUploadCount
|
||||
? "从左侧 SKU / SPU 获取图片,或在下方继续上传替换后,再点击开始生成。"
|
||||
: "可在下方补充要求后点击开始生成,结果会显示在这里。";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user