fix: align PromptTemplateEditor, SmartActionsPanel, prompts page with backend enums; fix RunPromptModal type cast
This commit is contained in:
parent
192c7baf2f
commit
d4cc696e02
@ -11,10 +11,8 @@ const CATEGORY_LABELS: Record<PromptCategory, string> = {
|
||||
transform: "Transform",
|
||||
extract: "Extract",
|
||||
generate: "Generate",
|
||||
analysis: "Analysis",
|
||||
vision: "Vision",
|
||||
analyze: "Analyze",
|
||||
export: "Export",
|
||||
custom: "Custom",
|
||||
};
|
||||
|
||||
const INPUT_ICONS: Record<string, typeof FileText> = {
|
||||
|
||||
@ -6,9 +6,9 @@ import { createPromptTemplate } from "@/lib/prompt-client";
|
||||
import { toast } from "@/lib/toast";
|
||||
import type { PromptCategory } from "@/lib/types";
|
||||
|
||||
const CATEGORIES: PromptCategory[] = ["transform", "extract", "generate", "analysis", "vision", "export", "custom"];
|
||||
const CATEGORIES: PromptCategory[] = ["transform", "extract", "generate", "analyze", "export"];
|
||||
const INPUT_TYPES = ["text", "image", "text+image", "multi-note"] as const;
|
||||
const OUTPUT_TYPES = ["new_note", "replace", "artifact", "clipboard", "update_note"] as const;
|
||||
const OUTPUT_TYPES = ["new_note", "replace", "artifact", "inline"] as const;
|
||||
|
||||
interface PromptTemplateEditorProps {
|
||||
onClose: () => void;
|
||||
@ -19,7 +19,7 @@ export function PromptTemplateEditor({ onClose, onCreated }: PromptTemplateEdito
|
||||
const [name, setName] = useState("");
|
||||
const [slug, setSlug] = useState("");
|
||||
const [description, setDescription] = useState("");
|
||||
const [category, setCategory] = useState<PromptCategory>("custom");
|
||||
const [category, setCategory] = useState<PromptCategory>("transform");
|
||||
const [inputType, setInputType] = useState<(typeof INPUT_TYPES)[number]>("text");
|
||||
const [outputType, setOutputType] = useState<(typeof OUTPUT_TYPES)[number]>("new_note");
|
||||
const [systemPrompt, setSystemPrompt] = useState("");
|
||||
|
||||
@ -31,22 +31,15 @@ export function RunPromptModal({
|
||||
async function handleRun() {
|
||||
setRunning(true);
|
||||
try {
|
||||
const input: Record<string, unknown> = {
|
||||
const input: Parameters<typeof runPrompt>[0] = {
|
||||
templateId: template.slug,
|
||||
noteId,
|
||||
workspaceId,
|
||||
dryRun,
|
||||
};
|
||||
if (inlinePrompt.trim()) {
|
||||
input.inlinePrompt = inlinePrompt.trim();
|
||||
input.inputText = inlinePrompt.trim();
|
||||
}
|
||||
if (isMultiNote && additionalNoteIds.trim()) {
|
||||
input.additionalNoteIds = additionalNoteIds
|
||||
.split(",")
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
const result = await runPrompt(input as Parameters<typeof runPrompt>[0]);
|
||||
const result = await runPrompt(input);
|
||||
onResult(result);
|
||||
toast.success(`"${template.name}" completed`);
|
||||
} catch (err) {
|
||||
|
||||
@ -10,10 +10,8 @@ const CATEGORY_LABELS: Record<PromptCategory, string> = {
|
||||
transform: "Transform",
|
||||
extract: "Extract",
|
||||
generate: "Generate",
|
||||
analysis: "Analysis",
|
||||
vision: "Vision",
|
||||
analyze: "Analyze",
|
||||
export: "Export",
|
||||
custom: "Custom",
|
||||
};
|
||||
|
||||
interface SmartActionsPanelProps {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user