pub struct FocusPoint {Show 17 fields
pub id: String,
pub topic: String,
pub keywords: Vec<String>,
pub entities: Vec<String>,
pub core_question: Option<String>,
pub status: FocusStatus,
pub created_at: DateTime<Utc>,
pub last_active: DateTime<Utc>,
pub importance: f32,
pub message_range: MessageRange,
pub sub_foci: Vec<String>,
pub semantic_summary: Option<String>,
pub related_files: Vec<PathBuf>,
pub confidence: f32,
pub dynamic_switch_threshold: f32,
pub focus_type: FocusType,
pub feedback_history: Vec<FocusFeedback>,
}Expand description
聚焦点 - 由 AI 动态提取的核心关注点
Fields§
§id: String聚焦点唯一标识
topic: String主题描述(AI 生成) 例如: “优化 Rust 代码性能” / “修复数据库连接问题”
keywords: Vec<String>相关关键词(AI 从对话中提取) 例如: [“performance”, “rust”, “optimization”, “benchmark”]
entities: Vec<String>相关实体(文件、函数、模块等) 例如: [“src/main.rs”, “process_data()”, “DatabasePool”]
core_question: Option<String>核心问题/任务 例如: “如何减少内存占用?” / “为什么数据库连接超时?”
status: FocusStatus当前状态
created_at: DateTime<Utc>创建时间
last_active: DateTime<Utc>最后活跃时间
importance: f32重要性分数(0.0-1.0)
message_range: MessageRange消息索引范围(该聚焦点涉及的对话范围)
sub_foci: Vec<String>子聚焦点(任务分解)
semantic_summary: Option<String>AI 生成的焦点语义摘要(简洁描述焦点核心内容)
相关文件路径(通过代码分析提取)
confidence: f32置信度(AI 判断的焦点准确性,0.0-1.0)
dynamic_switch_threshold: f32动态切换阈值(根据历史反馈自适应调整)
focus_type: FocusType焦点类型分类
feedback_history: Vec<FocusFeedback>用户反馈历史(用于自适应学习)
Implementations§
Source§impl FocusPoint
impl FocusPoint
Sourcepub fn new(
id: String,
topic: String,
keywords: Vec<String>,
entities: Vec<String>,
core_question: Option<String>,
message_index: usize,
) -> Self
pub fn new( id: String, topic: String, keywords: Vec<String>, entities: Vec<String>, core_question: Option<String>, message_index: usize, ) -> Self
创建基础聚焦点(手动创建)
Sourcepub fn new_with_ai(
id: String,
topic: String,
keywords: Vec<String>,
entities: Vec<String>,
core_question: Option<String>,
semantic_summary: Option<String>,
related_files: Vec<PathBuf>,
confidence: f32,
focus_type: FocusType,
message_index: usize,
) -> Self
pub fn new_with_ai( id: String, topic: String, keywords: Vec<String>, entities: Vec<String>, core_question: Option<String>, semantic_summary: Option<String>, related_files: Vec<PathBuf>, confidence: f32, focus_type: FocusType, message_index: usize, ) -> Self
创建智能聚焦点(AI 提取)
Sourcepub fn adjust_threshold_from_feedback(&mut self)
pub fn adjust_threshold_from_feedback(&mut self)
根据反馈自适应调整阈值
Sourcepub fn add_feedback(
&mut self,
feedback_type: FocusFeedbackType,
rating: Option<u8>,
message_index: usize,
)
pub fn add_feedback( &mut self, feedback_type: FocusFeedbackType, rating: Option<u8>, message_index: usize, )
添加反馈
Sourcepub fn should_switch(&self, relevance_score: f32) -> bool
pub fn should_switch(&self, relevance_score: f32) -> bool
判断是否应该切换焦点
Sourcepub fn with_importance(self, importance: f32) -> Self
pub fn with_importance(self, importance: f32) -> Self
Builder method: set importance
Sourcepub fn with_confidence(self, confidence: f32) -> Self
pub fn with_confidence(self, confidence: f32) -> Self
Builder method: set confidence
Sourcepub fn effective_importance(&self) -> f32
pub fn effective_importance(&self) -> f32
计算有效重要性(考虑时间衰减)
衰减公式:importance * exp(-elapsed_minutes / half_life) 半衰期:30分钟(默认)
Sourcepub fn effective_confidence(&self) -> f32
pub fn effective_confidence(&self) -> f32
计算有效置信度(考虑反馈历史)
Sourcepub fn update_message_range(&mut self, message_index: usize)
pub fn update_message_range(&mut self, message_index: usize)
更新消息范围
Sourcepub fn add_keywords(&mut self, new_keywords: &[String])
pub fn add_keywords(&mut self, new_keywords: &[String])
添加关键词
Sourcepub fn add_entities(&mut self, new_entities: &[String])
pub fn add_entities(&mut self, new_entities: &[String])
添加实体
Trait Implementations§
Source§impl Clone for FocusPoint
impl Clone for FocusPoint
Source§fn clone(&self) -> FocusPoint
fn clone(&self) -> FocusPoint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FocusPoint
impl Debug for FocusPoint
Source§impl<'de> Deserialize<'de> for FocusPoint
impl<'de> Deserialize<'de> for FocusPoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for FocusPoint
impl PartialEq for FocusPoint
Source§fn eq(&self, other: &FocusPoint) -> bool
fn eq(&self, other: &FocusPoint) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for FocusPoint
impl Serialize for FocusPoint
impl StructuralPartialEq for FocusPoint
Auto Trait Implementations§
impl Freeze for FocusPoint
impl RefUnwindSafe for FocusPoint
impl Send for FocusPoint
impl Sync for FocusPoint
impl Unpin for FocusPoint
impl UnsafeUnpin for FocusPoint
impl UnwindSafe for FocusPoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more