feat: add prompt startup actions and shared vision config

This commit is contained in:
Xin Wang
2026-08-01 23:31:14 +08:00
parent b747144ff1
commit 0331f8cd07
22 changed files with 1238 additions and 344 deletions
@@ -0,0 +1,72 @@
"use client";
import { Camera } from "lucide-react";
import {
ResourceSelectField,
ToggleRow,
} from "@/components/assistant-editor/editor-controls";
import { SectionCard } from "@/components/editor/section-card";
type VisionModelOption = {
value: string;
label: string;
};
export function VisionConfigSection({
description,
hint,
enabled,
modelResourceId,
mainModelResourceId,
modelOptions,
onEnabledChange,
onModelResourceIdChange,
}: {
description: string;
hint: string;
enabled: boolean;
modelResourceId: string;
mainModelResourceId: string;
modelOptions: VisionModelOption[];
onEnabledChange: (enabled: boolean) => void;
onModelResourceIdChange: (modelResourceId: string) => void;
}) {
const mainModelSupportsVision = modelOptions.some(
(option) => option.value === mainModelResourceId,
);
const independentModelOptions = modelOptions.filter(
(option) => option.value !== mainModelResourceId,
);
return (
<SectionCard
icon={<Camera size={15} />}
title="视觉理解"
description={description}
>
<ToggleRow
title="允许理解当前画面"
hint={hint}
checked={enabled}
onChange={onEnabledChange}
/>
{enabled && (
<>
<ResourceSelectField
label="视觉模型"
value={modelResourceId}
onChange={onModelResourceIdChange}
options={independentModelOptions}
noneLabel="模型自己"
/>
{!modelResourceId && !mainModelSupportsVision && (
<p className="text-xs text-destructive">
当前大语言模型未标记支持图片输入,请选择独立视觉模型。
</p>
)}
</>
)}
</SectionCard>
);
}