Open
Conversation
dynamder
reviewed
Feb 2, 2026
| fn summarize(&self) { | ||
| let mut summary_text = self.summary.lock().unwrap().clone(); | ||
| async fn summarize(&self) -> Result<Arc<RwLock<String>>, Box<dyn Error>> { | ||
| let mut summary_text = self.summary.write().unwrap().clone(); |
dynamder
reviewed
Feb 2, 2026
| Err(e) => eprintln!("LLM Error: {}", e), | ||
| match call_llm(&summary_text).await { | ||
| Ok(response) => { | ||
| *summary_arc.write().unwrap() = response; |
dynamder
reviewed
Feb 2, 2026
| } | ||
| //获取摘要记忆 | ||
| pub fn get_summary(&self) -> Arc<Mutex<String>> { | ||
| pub fn get_summary(&self) -> Arc<RwLock<String>> { |
Owner
There was a problem hiding this comment.
传出的类型应该不允许可变,summary是一个滑动窗口维护的状态。
dynamder
requested changes
Feb 2, 2026
Owner
dynamder
left a comment
There was a problem hiding this comment.
请采用更加健壮的错误处理方式,并更细致的控制方法返回的类型是否应该允许可变。
dynamder
requested changes
Feb 3, 2026
| } | ||
|
|
||
| //将摘要记忆和当前滑动窗口信息合并提供LLM | ||
| async fn summarize(&self) -> Result<Arc<RwLock<String>>, Box<dyn Error>> { |
Comment on lines
+101
to
+107
| let mut summary_text = match self.summary.write() { | ||
| Ok(mut value) => value.clone(), | ||
| Err(e) => { | ||
| eprintln!("Summary Error: {}", e); | ||
| String::new() | ||
| } | ||
| }; |
| println!("Summary updated in background."); | ||
| *value = response | ||
| }, | ||
| Err(e) => eprintln!("LLM Error: {}", e), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
一坨草案