feat: 更新文件路径解析逻辑,自动保存会话到用户主目录下的 .picobot/sessions/ 目录;修改 InboundProcessor 结构体字段命名
This commit is contained in:
parent
102a4a63c5
commit
4181253b17
@ -327,7 +327,8 @@ pub fn format_timestamp(ts: i64) -> String {
|
|||||||
|
|
||||||
/// 解析文件路径
|
/// 解析文件路径
|
||||||
///
|
///
|
||||||
/// 如果未提供路径,自动生成基于会话标题和时间戳的文件名
|
/// 如果未提供路径,自动生成基于会话标题和时间戳的文件名,
|
||||||
|
/// 保存到用户主目录下的 .picobot/sessions/ 目录
|
||||||
pub fn resolve_filepath(filepath: Option<String>, record: &SessionRecord) -> PathBuf {
|
pub fn resolve_filepath(filepath: Option<String>, record: &SessionRecord) -> PathBuf {
|
||||||
match filepath {
|
match filepath {
|
||||||
Some(path) => PathBuf::from(path),
|
Some(path) => PathBuf::from(path),
|
||||||
@ -357,7 +358,12 @@ pub fn resolve_filepath(filepath: Option<String>, record: &SessionRecord) -> Pat
|
|||||||
let timestamp = Local::now().format("%Y%m%d_%H%M%S");
|
let timestamp = Local::now().format("%Y%m%d_%H%M%S");
|
||||||
let filename = format!("{}_{}.md", base_name, timestamp);
|
let filename = format!("{}_{}.md", base_name, timestamp);
|
||||||
|
|
||||||
PathBuf::from(filename)
|
// 保存到用户主目录下的 .picobot/sessions/ 目录
|
||||||
|
dirs::home_dir()
|
||||||
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
|
.join(".picobot")
|
||||||
|
.join("sessions")
|
||||||
|
.join(filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ pub struct InboundProcessor {
|
|||||||
bus: Arc<MessageBus>,
|
bus: Arc<MessageBus>,
|
||||||
session_manager: SessionManager,
|
session_manager: SessionManager,
|
||||||
semaphore: Arc<Semaphore>,
|
semaphore: Arc<Semaphore>,
|
||||||
provider_config: LLMProviderConfig,
|
_provider_config: LLMProviderConfig,
|
||||||
command_router: Arc<InChatCommandRouter>,
|
command_router: Arc<InChatCommandRouter>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ impl InboundProcessor {
|
|||||||
bus,
|
bus,
|
||||||
session_manager,
|
session_manager,
|
||||||
semaphore,
|
semaphore,
|
||||||
provider_config,
|
_provider_config: provider_config,
|
||||||
command_router: Arc::new(command_router),
|
command_router: Arc::new(command_router),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user