新增: 初始化 DevFlow 项目仓库
Tauri 2 + Vue 3 + Vite 6 桌面应用,Rust workspace 含 13 个 crate (df-ai / df-storage / df-workflow / df-core / df-execute 等)。 核心能力:AI 聊天 agentic 循环(工具调用+人工审批)、工作流引擎、 任务/想法/项目/阶段管理、可追溯性,及配套前端组件。
This commit is contained in:
98
crates/df-ideas/src/capture.rs
Normal file
98
crates/df-ideas/src/capture.rs
Normal file
@@ -0,0 +1,98 @@
|
||||
//! 想法捕获 — 快速记录与管理
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use df_core::types::{IdeaId, Priority};
|
||||
|
||||
/// 捕获一个新想法的输入
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CaptureInput {
|
||||
/// 标题
|
||||
pub title: String,
|
||||
/// 详细描述
|
||||
pub description: String,
|
||||
/// 优先级
|
||||
#[serde(default)]
|
||||
pub priority: Priority,
|
||||
/// 标签
|
||||
#[serde(default)]
|
||||
pub tags: Vec<String>,
|
||||
/// 来源(如 "用户输入"、"AI 生成"、"会议记录")
|
||||
pub source: Option<String>,
|
||||
}
|
||||
|
||||
/// 想法实体
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Idea {
|
||||
/// 唯一 ID
|
||||
pub id: IdeaId,
|
||||
/// 标题
|
||||
pub title: String,
|
||||
/// 详细描述
|
||||
pub description: String,
|
||||
/// 当前状态
|
||||
pub status: df_core::types::IdeaStatus,
|
||||
/// 优先级
|
||||
pub priority: Priority,
|
||||
/// 评分
|
||||
pub scores: Option<IdeaScores>,
|
||||
/// 标签
|
||||
pub tags: Vec<String>,
|
||||
/// 来源
|
||||
pub source: Option<String>,
|
||||
/// 关联的想法 ID
|
||||
pub related_ids: Vec<IdeaId>,
|
||||
/// 创建时间
|
||||
pub created_at: chrono::DateTime<chrono::Utc>,
|
||||
/// 更新时间
|
||||
pub updated_at: chrono::DateTime<chrono::Utc>,
|
||||
}
|
||||
|
||||
/// 想法评分详情
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct IdeaScores {
|
||||
/// 可行性评分 (0-10)
|
||||
pub feasibility: f64,
|
||||
/// 影响力评分 (0-10)
|
||||
pub impact: f64,
|
||||
/// 紧急度评分 (0-10)
|
||||
pub urgency: f64,
|
||||
/// 综合评分 (加权平均)
|
||||
pub overall: f64,
|
||||
}
|
||||
|
||||
/// 想法捕获器
|
||||
pub struct IdeaCapture;
|
||||
|
||||
impl IdeaCapture {
|
||||
/// 捕获一个新想法
|
||||
///
|
||||
/// TODO: 接入存储层持久化
|
||||
pub fn capture(input: CaptureInput) -> Idea {
|
||||
let now = chrono::Utc::now();
|
||||
Idea {
|
||||
id: df_core::types::new_id(),
|
||||
title: input.title,
|
||||
description: input.description,
|
||||
status: df_core::types::IdeaStatus::Draft,
|
||||
priority: input.priority,
|
||||
scores: None,
|
||||
tags: input.tags,
|
||||
source: input.source,
|
||||
related_ids: Vec::new(),
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
}
|
||||
}
|
||||
|
||||
/// 快速捕获(仅标题)
|
||||
pub fn quick_capture(title: String) -> Idea {
|
||||
Self::capture(CaptureInput {
|
||||
title,
|
||||
description: String::new(),
|
||||
priority: Priority::default(),
|
||||
tags: Vec::new(),
|
||||
source: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user