ai-chatbot/types/agent.ts
Your Name 64cb485dfa
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
feat: refine agent workflow flow
2026-03-17 18:23:32 +08:00

243 lines
5.9 KiB
TypeScript

export type AgentPresetType = "image" | "video" | "text";
export type AgentPresetVisibility = "public" | "private";
export type AgentCategoryScope = "public" | "private" | "global";
export type AgentPresetStatus = "active" | "disabled" | "hidden" | "blocked";
export interface AgentCategoryPath {
productCategory?: string | null;
audienceTag?: string | null;
usageScenario?: string | null;
brand?: string | null;
}
export type AgentWorkflowStepKey =
| "audience"
| "style"
| "space"
| "subSpace"
| "hardDecoration"
| "softDecoration"
| "lighting"
| "accessories";
export interface AgentWorkflowOptionUiConfig {
key: string;
buttonName: string;
description?: string | null;
previewImageUrl?: string | null;
enabled: boolean;
sortOrder: number;
promptFragment?: string | null;
}
export interface AgentWorkflowStepUiConfig {
key: AgentWorkflowStepKey;
title: string;
description?: string | null;
enabled: boolean;
sortOrder: number;
options: AgentWorkflowOptionUiConfig[];
}
export interface AgentWorkflowUiConfig {
inputOptions?: {
brands: string[];
stores: string[];
};
steps: AgentWorkflowStepUiConfig[];
}
export interface AgentWorkflowComposerSelection {
stepKey: AgentWorkflowStepKey;
stepTitle: string;
optionKey: string;
optionName: string;
promptFragment?: string | null;
}
export interface AgentWorkflowComposerContext {
primarySku?: string;
secondarySku?: string;
brand?: string;
store?: string;
selections: AgentWorkflowComposerSelection[];
summaryText: string;
promptText: string;
}
export interface AgentWorkflowPersistedState {
inputs: {
primarySku: string;
secondarySku: string;
brand: string;
store: string;
};
selections: Partial<Record<AgentWorkflowStepKey, string>>;
selectedAgentPresetId?: string | null;
currentStage?: "workflow" | "mode";
}
export interface AgentCategoryTreeConfig {
productCategories: string[];
audienceTags: string[];
usageScenarios: string[];
brands: string[];
}
export interface AgentCategory {
id: string;
name: string;
slug: string;
scope: AgentCategoryScope;
createdBy?: string | null;
sortOrder: number;
isEnabled: boolean;
createdAt: string | Date;
updatedAt: string | Date;
}
export interface AgentReferenceAsset {
id: string;
assetId: string;
sortOrder: number;
originalUrl: string;
previewUrl?: string | null;
thumbnailUrl?: string | null;
mimeType?: string | null;
displayName?: string | null;
}
export interface AgentPresetSlot {
id?: string;
slotIndex: number;
title?: string | null;
promptTemplate: string;
defaultParams?: Record<string, any> | null;
requireUpload?: boolean;
uploadLabel?: string | null;
referenceAssets?: AgentReferenceAsset[];
referenceAssetIds?: string[];
}
export interface AgentModelSummary {
id: string;
modelId?: string | null;
displayName?: string | null;
avatarUrl?: string | null;
}
export interface AgentOwnerSummary {
id: string;
name?: string | null;
email?: string | null;
}
export interface AgentPreset {
id: string;
ownerUserId: string;
name: string;
type: AgentPresetType;
secondaryType?: string | null;
visibility: AgentPresetVisibility;
categoryId?: string | null;
categoryPath?: AgentCategoryPath | null;
promptTemplate: string;
description?: string | null;
defaultModelId?: string | null;
defaultParams?: Record<string, any> | null;
slotCount: number;
requiredUploadCount: number;
avatarAssetId?: string | null;
avatarUrl?: string | null;
coverAssetId?: string | null;
status: AgentPresetStatus;
sortOrder: number;
usageCount: number;
lastUsedAt?: string | Date | null;
forkedFromPresetId?: string | null;
createdAt: string | Date;
updatedAt: string | Date;
owner?: AgentOwnerSummary | null;
category?: AgentCategory | null;
defaultModel?: AgentModelSummary | null;
slots?: AgentPresetSlot[];
referenceAssets?: AgentReferenceAsset[];
referenceAssetIds?: string[];
referenceAssetCount?: number;
}
export interface AgentPresetListResponse {
categories: AgentCategory[];
public: AgentPreset[];
private: AgentPreset[];
}
export interface AgentExecutionSnapshot {
id: string;
presetId: string;
projectId?: string | null;
chatId?: string | null;
messageId?: string | null;
userId: string;
presetName: string;
presetType: AgentPresetType;
visibility: AgentPresetVisibility;
categoryId?: string | null;
categoryName?: string | null;
promptTemplate: string;
defaultModelId?: string | null;
resolvedModelId?: string | null;
defaultParams?: Record<string, any> | null;
slotCount: number;
requiredUploadCount: number;
slots: Array<{
slotIndex: number;
title?: string | null;
promptTemplate: string;
defaultParams?: Record<string, any> | null;
requireUpload?: boolean;
uploadLabel?: string | null;
referenceAssetIds: string[];
referenceImageUrls: string[];
}>;
referenceAssetIds: string[];
referenceImageUrls: string[];
userInputText?: string | null;
requestPayload?: Record<string, any> | null;
createdAt: string | Date;
defaultModel?: AgentModelSummary | null;
resolvedModel?: AgentModelSummary | null;
}
export interface AgentCreatePayload {
name: string;
type: AgentPresetType;
secondaryType?: string | null;
visibility: AgentPresetVisibility;
categoryPath?: AgentCategoryPath | null;
description?: string;
defaultModelId: string;
defaultParams?: Record<string, any>;
avatarAssetId?: string;
slots: AgentPresetSlot[];
}
export interface AgentUpdatePayload {
name?: string;
type?: AgentPresetType;
secondaryType?: string | null;
visibility?: AgentPresetVisibility;
categoryPath?: AgentCategoryPath | null;
description?: string | null;
defaultModelId?: string;
defaultParams?: Record<string, any> | null;
avatarAssetId?: string | null;
slots?: AgentPresetSlot[];
status?: AgentPresetStatus;
}
export interface AgentCategoryCreatePayload {
name: string;
scope?: "public" | "private";
}