Skip to main content

FocusPoint

Struct FocusPoint 

Source
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 生成的焦点语义摘要(简洁描述焦点核心内容)

§related_files: Vec<PathBuf>

相关文件路径(通过代码分析提取)

§confidence: f32

置信度(AI 判断的焦点准确性,0.0-1.0)

§dynamic_switch_threshold: f32

动态切换阈值(根据历史反馈自适应调整)

§focus_type: FocusType

焦点类型分类

§feedback_history: Vec<FocusFeedback>

用户反馈历史(用于自适应学习)

Implementations§

Source§

impl FocusPoint

Source

pub fn new( id: String, topic: String, keywords: Vec<String>, entities: Vec<String>, core_question: Option<String>, message_index: usize, ) -> Self

创建基础聚焦点(手动创建)

Source

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 提取)

Source

pub fn adjust_threshold_from_feedback(&mut self)

根据反馈自适应调整阈值

Source

pub fn add_feedback( &mut self, feedback_type: FocusFeedbackType, rating: Option<u8>, message_index: usize, )

添加反馈

Source

pub fn should_switch(&self, relevance_score: f32) -> bool

判断是否应该切换焦点

Source

pub fn with_importance(self, importance: f32) -> Self

Builder method: set importance

Source

pub fn with_confidence(self, confidence: f32) -> Self

Builder method: set confidence

Source

pub fn with_type(self, focus_type: FocusType) -> Self

Builder method: set focus type

Source

pub fn effective_importance(&self) -> f32

计算有效重要性(考虑时间衰减)

衰减公式:importance * exp(-elapsed_minutes / half_life) 半衰期:30分钟(默认)

Source

pub fn effective_confidence(&self) -> f32

计算有效置信度(考虑反馈历史)

Source

pub fn wake_up(&mut self)

唤醒焦点(更新活跃时间并提升重要性)

Source

pub fn update_message_range(&mut self, message_index: usize)

更新消息范围

Source

pub fn add_keywords(&mut self, new_keywords: &[String])

添加关键词

Source

pub fn add_entities(&mut self, new_entities: &[String])

添加实体

Trait Implementations§

Source§

impl Clone for FocusPoint

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for FocusPoint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FocusPoint

Source§

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

Source§

fn eq(&self, other: &FocusPoint) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for FocusPoint

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FocusPoint

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,