geo/frontend/types/suggestion.ts

161 lines
3.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 优化建议相关类型定义
* 包含统一的行动建议基础类型ActionItem, ActionPriority
*/
// ========== 统一行动建议基础类型 ==========
// 行动优先级ActionSuggestion 和 NextAction 共享)
export type ActionPriority = "primary" | "secondary" | "optional";
// 统一行动项接口
export interface ActionItem {
id: string;
title: string;
description: string;
priority: ActionPriority;
icon: string;
href: string;
}
// ========== 优化建议相关类型 ==========
// 建议类型
export type SuggestionType =
| "content_optimization"
| "platform_targeting"
| "competitor_gap"
| "query_expansion"
| "citation_improvement";
// 建议优先级
export type SuggestionPriority = "high" | "medium" | "low";
// 建议难度
export type SuggestionDifficulty = "easy" | "medium" | "hard";
// 建议状态
export type SuggestionStatus = "pending" | "in_progress" | "completed" | "dismissed";
// 优化建议
export interface Suggestion {
id: string;
brand_id: string;
type: SuggestionType;
priority: SuggestionPriority;
title: string;
description: string;
action: string | null;
expected_impact: string | null;
difficulty: SuggestionDifficulty;
status: SuggestionStatus;
generated_at: string;
updated_at: string;
batch_id: string;
source: "rule" | "llm";
}
// 建议列表响应
export interface SuggestionListResponse {
suggestions: Suggestion[];
total: number;
}
// 建议历史条目
export interface SuggestionHistoryItem {
batch_id: string;
generated_at: string;
source: "rule" | "llm";
suggestion_count: number;
suggestions: Suggestion[];
}
// 建议历史响应
export interface SuggestionHistoryResponse {
history: SuggestionHistoryItem[];
total: number;
}
// 建议类型配置
export const SUGGESTION_TYPE_CONFIG: Record<
SuggestionType,
{ label: string; icon: string; color: string; bgColor: string }
> = {
content_optimization: {
label: "内容优化",
icon: "FileText",
color: "text-blue-600",
bgColor: "bg-blue-50",
},
platform_targeting: {
label: "平台定向",
icon: "Monitor",
color: "text-purple-600",
bgColor: "bg-purple-50",
},
competitor_gap: {
label: "竞品差距",
icon: "GitCompare",
color: "text-red-600",
bgColor: "bg-red-50",
},
query_expansion: {
label: "查询词扩展",
icon: "Search",
color: "text-emerald-600",
bgColor: "bg-emerald-50",
},
citation_improvement: {
label: "引用改善",
icon: "Quote",
color: "text-amber-600",
bgColor: "bg-amber-50",
},
};
// 优先级配置
export const PRIORITY_CONFIG: Record<
SuggestionPriority,
{ label: string; color: string; bgColor: string; borderColor: string }
> = {
high: {
label: "高优先级",
color: "text-red-700",
bgColor: "bg-red-100",
borderColor: "border-l-red-500",
},
medium: {
label: "中优先级",
color: "text-amber-700",
bgColor: "bg-amber-100",
borderColor: "border-l-amber-500",
},
low: {
label: "低优先级",
color: "text-gray-600",
bgColor: "bg-gray-100",
borderColor: "border-l-gray-400",
},
};
// 难度配置
export const DIFFICULTY_CONFIG: Record<
SuggestionDifficulty,
{ label: string; color: string }
> = {
easy: { label: "简单", color: "text-emerald-600" },
medium: { label: "中等", color: "text-amber-600" },
hard: { label: "困难", color: "text-red-600" },
};
// 状态配置
export const STATUS_CONFIG: Record<
SuggestionStatus,
{ label: string; color: string; bgColor: string }
> = {
pending: { label: "待处理", color: "text-gray-600", bgColor: "bg-gray-100" },
in_progress: { label: "进行中", color: "text-blue-600", bgColor: "bg-blue-100" },
completed: { label: "已完成", color: "text-emerald-600", bgColor: "bg-emerald-100" },
dismissed: { label: "已忽略", color: "text-gray-400", bgColor: "bg-gray-50" },
};