refactor(tui): remove core loading, delegate to aigpt MCP
This commit is contained in:
23
src/tui.rs
23
src/tui.rs
@@ -683,29 +683,18 @@ fn load_identity_context() -> String {
|
|||||||
"[identity]\nuser: {user_handle}\nyou: {bot_handle} ({bot_did})\nnetwork: {network}\n\n"
|
"[identity]\nuser: {user_handle}\nyou: {bot_handle} ({bot_did})\nnetwork: {network}\n\n"
|
||||||
));
|
));
|
||||||
|
|
||||||
// Core personality: read directly from atproto record
|
// Core personality: handled by aigpt MCP (instructions = core + memory)
|
||||||
// aigpt MCP also injects this via instructions, but direct read is more reliable at startup
|
// aishell only provides identity + chat context
|
||||||
|
|
||||||
|
// Recent chat
|
||||||
let bot_path = config["bot"]["path"].as_str().unwrap_or("");
|
let bot_path = config["bot"]["path"].as_str().unwrap_or("");
|
||||||
let expanded = expand_tilde(bot_path);
|
let expanded = expand_tilde(bot_path);
|
||||||
let base = if expanded.is_empty() {
|
let base = if expanded.is_empty() {
|
||||||
format!("{}/ai.syui.log/at", crate::config::config_dir())
|
format!("{}/ai.syui.log/at", crate::config::config_dir())
|
||||||
} else {
|
} else {
|
||||||
expanded.clone()
|
expanded
|
||||||
};
|
};
|
||||||
let core_path = format!("{}/{bot_did}/ai.syui.gpt.core/self.json", base);
|
let chat_dir = format!("{base}/{bot_did}/ai.syui.log.chat");
|
||||||
if let Ok(content) = std::fs::read_to_string(&core_path) {
|
|
||||||
if let Ok(record) = serde_json::from_str::<serde_json::Value>(&content) {
|
|
||||||
if let Some(text) = record["value"]["content"]["text"].as_str() {
|
|
||||||
if !text.is_empty() {
|
|
||||||
let short: String = text.chars().take(500).collect();
|
|
||||||
ctx.push_str(&format!("[core]\n{short}\n\n"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recent chat (reuse base from core path)
|
|
||||||
let chat_dir = format!("{}/{bot_did}/ai.syui.log.chat", base);
|
|
||||||
let user_did = config["did"].as_str().unwrap_or("");
|
let user_did = config["did"].as_str().unwrap_or("");
|
||||||
let user_chat_dir = format!("{base}/{user_did}/ai.syui.log.chat");
|
let user_chat_dir = format!("{base}/{user_did}/ai.syui.log.chat");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user